You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wss4j-dev@ws.apache.org by Lucaluke <lu...@gmail.com> on 2010/02/08 11:59:17 UTC

How do I read WSS Username Token after validation?

Hi guys,
by specifying a soapenv:header in the wsdd file of my web service, I have
managed to validate user name and password passed by the client...

The problem now is that later on in the code, I need  the username again,
but all I have in the web service implementing classes is the request...
which does not contain the header...
is there a way to get this info again or to tell wss4j to include it in the
request? any suggestions?

Thanks
-- 
View this message in context: http://old.nabble.com/How-do-I-read-WSS-Username-Token-after-validation--tp27498138p27498138.html
Sent from the WSS4J mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org


Re: How do I read WSS Username Token after validation?

Posted by Thilina Mahesh Buddhika <th...@gmail.com>.
Hi Lucaluke,

It is possible to get this through the Axis2 message context. Inside
Rampart, we add it as a property to message context.

msgCtx.getProperty(RampartMessageData.USERNAME);

Thanks.
/thilina


Thilina Mahesh Buddhika
http://blog.thilinamb.com


On Wed, Feb 10, 2010 at 1:30 PM, Lucaluke <lu...@gmail.com>wrote:

>
> I am using Axis1.4
> I do have a MessageContext in the PWCallback class and beyond, but no
> method
> getUserPrincipal, so it must be a different implementation from what you
> mention... still in the PWCallback as I am reading the user, I have set it
> as a property in the messageContext to make it available for later use.
> Another option would be to get the SOAPEnvelope from RequestMessage in the
> messageContext and get user and password from there...
>
> dkulp wrote:
> >
> >
> > You don't mention which webservice stack or anything that you are using.
> >
> > In general, the "results" vector returned from WSS4J does contain a
> > Principal
> > object that would hold the username/password stuff.   Thus, if that is
> > available somehow, that's where you would look.
> >
> > For CXF, we also map that into the standard JAX-WS
> > MessageContext.getUserPrincipal() call making it very easy to get.
> >
> > Dan
> >
> >
> > On Mon February 8 2010 5:59:17 am Lucaluke wrote:
> >> Hi guys,
> >> by specifying a soapenv:header in the wsdd file of my web service, I
> have
> >> managed to validate user name and password passed by the client...
> >>
> >> The problem now is that later on in the code, I need  the username
> again,
> >> but all I have in the web service implementing classes is the request...
> >> which does not contain the header...
> >> is there a way to get this info again or to tell wss4j to include it in
> >> the
> >> request? any suggestions?
> >>
> >> Thanks
> >>
> >
> > --
> > Daniel Kulp
> > dkulp@apache.org
> > http://www.dankulp.com/blog
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
> > For additional commands, e-mail: wss4j-dev-help@ws.apache.org
> >
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/How-do-I-read-WSS-Username-Token-after-validation--tp27498138p27527077.html
> Sent from the WSS4J mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>
>

Re: How do I read WSS Username Token after validation?

Posted by Lucaluke <lu...@gmail.com>.
I am using Axis1.4
I do have a MessageContext in the PWCallback class and beyond, but no method
getUserPrincipal, so it must be a different implementation from what you
mention... still in the PWCallback as I am reading the user, I have set it
as a property in the messageContext to make it available for later use.
Another option would be to get the SOAPEnvelope from RequestMessage in the
messageContext and get user and password from there... 

dkulp wrote:
> 
> 
> You don't mention which webservice stack or anything that you are using.
> 
> In general, the "results" vector returned from WSS4J does contain a
> Principal 
> object that would hold the username/password stuff.   Thus, if that is 
> available somehow, that's where you would look.
> 
> For CXF, we also map that into the standard JAX-WS 
> MessageContext.getUserPrincipal() call making it very easy to get.
> 
> Dan
> 
> 
> On Mon February 8 2010 5:59:17 am Lucaluke wrote:
>> Hi guys,
>> by specifying a soapenv:header in the wsdd file of my web service, I have
>> managed to validate user name and password passed by the client...
>> 
>> The problem now is that later on in the code, I need  the username again,
>> but all I have in the web service implementing classes is the request...
>> which does not contain the header...
>> is there a way to get this info again or to tell wss4j to include it in
>> the
>> request? any suggestions?
>> 
>> Thanks
>> 
> 
> -- 
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: wss4j-dev-help@ws.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/How-do-I-read-WSS-Username-Token-after-validation--tp27498138p27527077.html
Sent from the WSS4J mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org


Re: How do I read WSS Username Token after validation?

Posted by Daniel Kulp <dk...@apache.org>.
You don't mention which webservice stack or anything that you are using.

In general, the "results" vector returned from WSS4J does contain a Principal 
object that would hold the username/password stuff.   Thus, if that is 
available somehow, that's where you would look.

For CXF, we also map that into the standard JAX-WS 
MessageContext.getUserPrincipal() call making it very easy to get.

Dan


On Mon February 8 2010 5:59:17 am Lucaluke wrote:
> Hi guys,
> by specifying a soapenv:header in the wsdd file of my web service, I have
> managed to validate user name and password passed by the client...
> 
> The problem now is that later on in the code, I need  the username again,
> but all I have in the web service implementing classes is the request...
> which does not contain the header...
> is there a way to get this info again or to tell wss4j to include it in the
> request? any suggestions?
> 
> Thanks
> 

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org