Your ClassCastException is because the Object referred to as "org.apache.
cxf.transport.http.AbstractHTTPDestination$2@16f3ed7*" is not an instance
of AbstractHTTPDestination, but a SecurityContext Object created in
AbstractHTTPDestination.

The SecurityContext object is created in a few different places depending
on where CXF can find a principal. So it could be in the transport code if
client authentication is used, or in the WSS4JInInterceptor if WS-Security
is used, etc.

Colm.


On Thu, Nov 7, 2013 at 6:55 PM, Faz <[email protected]> wrote:

> Hi All,
>
> Have a few queries pertaining SecurityContext.
>
> --When I include the ws-security policy in the WSDL file, then I get
> WSS4JINinterceptors when I do a get on the Message Object.
> -- When I dont have the ws-security in wsdl, then i have
> AbstractHTTPDestination when i do a get on the Message Object.
>
> 1. Now, is the above outcome normal? I mean is it supposed to behave in the
> similar fashion.
>
> 2 . In the case of my WSDL not having ws-security policy, I have  the
> message object with ,
>
>
> *org.apache.cxf.security.SecurityContext=org.apache.cxf.transport.http.AbstractHTTPDestination$2@16f3ed7
> *
>
>   - When I do message.get(SecurityContext.class).getUserPrincipal(), its
> always returning null in the above scenario.? Why is that?
>
>   - And I get a classcast exception, when i do the below.
>  *   SecurityContext context = message.get(SecurityContext.class);
>     AbstractHTTPDestination ahd1 = (AbstractHTTPDestination)context; *
> Even though the context holds AbstractHTTPDestination object in this
> context, am unable to retrieve it? am I DOING ANY OBVIOUS MISTAKE?
> thanks.
>
>
>
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/SecurityContext-AND-Principal-Object-tp5736103.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>



-- 
Colm O hEigeartaigh

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

Reply via email to