Then I guess you can try

new MessageContextImpl(PhaseInterceptorChain.getCurrentMessage());

and proceed from there by working with OAuthContextUtils

or

OAuthContext context = PhaseInterceptorChain.getCurrentMessage().getContent(OAuthContext.class)

and work with the OAuth context directly

HTH, Sergey

On 12/08/13 14:21, inteloid wrote:
We use spring configuration, and can't make our services per request.

The stack is as follows:

Web->JAX-RS Resource->Spring Service (Business Logic)->DB Layer->DB

JAX-RS resources effectively get access to valid MessageContext by
implementing
@Context
void setMessageContext(MessageContext mc)
The problem is, I don't need it inside my resource methods as they just
forward calls to appropriate business logic services.

Our business services are singletons and this can't be changed for many
reasons. To implement security checks inside them (which are also business
related checks) we need data from MessageContext (well, we'll wrap it in
something fancy and less transport dependent, we need only clinetId and
userSubject).

Currently, I'm trying to build a Utility class, which will be used by
business services, which gets that MessageContext data from some static
place.

Hope I've explained properly, if not I can post some diagrams.



--
View this message in context: 
http://cxf.547215.n5.nabble.com/Statically-access-MessageContext-tp5732065p5732197.html
Sent from the cxf-user mailing list archive at Nabble.com.



--
Sergey Beryozkin

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

Blog: http://sberyozkin.blogspot.com

Reply via email to