By the way, this is how you access it directly from a message :


org.apache.cxf.security.SecurityContext sc = msg.get(SecurityContext.class);
sc.getUserPrincipal();

There's also a JAXRS SecurityContext, but it can only be injected either into the application resource class or JAXRS message body providers.

Cheers, Sergey

Hi Gabo

CXF has interceptors, and JAXRS input processing is implemented in a CXF input interceptor (JAXRSInInterceptor, currently sitting at stage PRE_STREAM). JAXRSInInterceptor itself invokes on a chain of RequestHandlers which are interceptors too, but they're only recognized by JAXRSInInterceptor and they have an interface different to CXF Interceptor interface (which is what JAXRSInInterceptor implements) and RequestHandlers has currently no notion of phases, they're executed in scope of the JAXRSInInterceptor invocation.

You were asking Dan about phases, so I'm assuming you're trying to get a Proncipal object from a CXF interceptor (that is, not from a JAXRS RequestFilter) ?

Is it correct ?

Cheers, Sergey

Hi Sergey,

PRE_INVOKE does not help.

I'm a bit lost with regards to the filter. I checked the user's guide, it just talks about Request and ResponseHandlers, which I am already implementing.. am I missing something?

Gabo

Sergey Beryozkin wrote:
Hi

Perhaps PRE_INVOKE can do ?
You can also try to get to this Principal object from a JAX-RS RequestHandler 
filter...

Cheers, Sergey



Reply via email to