You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Faz <ar...@gmail.com> on 2013/09/18 11:57:55 UTC

UserNameToken is Null

Hi , i'm trying to access the usernametoken from the message object, but for
some reasons am getting it as null. Here's the code & log that I have,

*Code Snippet*


*Log*




--
View this message in context: http://cxf.547215.n5.nabble.com/UserNameToken-is-Null-tp5734200.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: UserNameToken is Null

Posted by Colm O hEigeartaigh <co...@apache.org>.
The "UsernameToken" class is only set on the message context when a certain
property is set on the endpoint to stop WSS4J validating the UsernameToken.
I think I will merge a fix to just set it on the context anyway. But it
won't work with the current code. If you really want to, you can retrieve
the list of security results + get the UsernameToken that way, see for
example (method "doResults"):

svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java?view=markup

Colm.


On Wed, Sep 18, 2013 at 11:14 AM, Faz <ar...@gmail.com>wrote:

> Thanks Coheigea,
> I should have made myself clear before.Well, here is what am trying to do,
>
> AM trying to get the principal object which in this case gives me the
> WSUsernameTokenPrincipal which is all good, but then I need to get the
> usernametoken as mentioned below just to have the validation check as I
> procured the below code for creating auth interceptors.
>
>
>
> The usernametoken above always comes as null. If you have any suggestions
> on
> this validation check, I can give that a try. Thnx again!
>
>
>
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/UserNameToken-is-Null-tp5734200p5734203.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>



-- 
Colm O hEigeartaigh

Talend Community Coder
http://coders.talend.com

Re: UserNameToken is Null

Posted by Faz <ar...@gmail.com>.
Thanks Coheigea,
I should have made myself clear before.Well, here is what am trying to do,

AM trying to get the principal object which in this case gives me the
WSUsernameTokenPrincipal which is all good, but then I need to get the
usernametoken as mentioned below just to have the validation check as I
procured the below code for creating auth interceptors.

        

The usernametoken above always comes as null. If you have any suggestions on
this validation check, I can give that a try. Thnx again!



--
View this message in context: http://cxf.547215.n5.nabble.com/UserNameToken-is-Null-tp5734200p5734203.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: UserNameToken is Null

Posted by Colm O hEigeartaigh <co...@apache.org>.
If you just cast the Principal object to "WSUsernameTokenPrincipal", you
can get access to all the details of the received UsernameToken:

http://svn.apache.org/viewvc/webservices/wss4j/branches/1_6_x-fixes/src/main/java/org/apache/ws/security/WSUsernameTokenPrincipal.java?view=markup

Colm.


On Wed, Sep 18, 2013 at 10:57 AM, Faz <ar...@gmail.com>wrote:

> Hi , i'm trying to access the usernametoken from the message object, but
> for
> some reasons am getting it as null. Here's the code & log that I have,
>
> *Code Snippet*
>
>
> *Log*
>
>
>
>
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/UserNameToken-is-Null-tp5734200.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>



-- 
Colm O hEigeartaigh

Talend Community Coder
http://coders.talend.com