Here is the interceptor that is used to store the spring security context

https://github.com/pellcorp/cxf/blob/master/JavaFirst/src/main/java/com/pellcorp/server/interceptor/SecurityContextAuthenticationInterceptor.java




On Wed, Jun 25, 2014 at 11:10 AM, Jason Pell <ja...@pellcorp.com> wrote:

> For an example, check out how the spring
> org.springframework.security.core.context.SecurityContextHolder manages a
> thread local.  We use this to store a spring SecurityContext in the
> incoming interceptor chain of a service, so that we can use the
> @PreAuthorise spring security annotations.
>
> A thread local works well for this and we have not had any issues with it
> to date.
>
>
> On Wed, Jun 25, 2014 at 4:43 AM, New Groovy <newtogro...@gmail.com> wrote:
>
>> Hi,
>>
>> Thanks for the response...
>>
>> I need everything available in the classes that my SOAP/REST 'services'
>> call though...hence my intent to use ThreadLocal.
>>
>> Is this a reasonable/safe thing to do?
>>
>> Thanks!
>>
>>
>>
>> On Tue, Jun 24, 2014 at 2:40 PM, Andrei Shakirin <ashaki...@talend.com>
>> wrote:
>>
>> > Hi,
>> >
>> > You can consider to use CXF message or CXF exchange to store information
>> > should be available in different interceptors:
>> >
>> > org.apache.cxf.message.Message: put() and get() methods
>> > org.apache.cxf.message.Exchange: put() and get() methods
>> >
>> > If data should be available for one chain only (inbound, outbound or
>> > failure) than the message fit better.
>> > If you need access data in different chains, consider to use Exchange.
>> >
>> > Regards,
>> > Andrei.
>> >
>> > > -----Original Message-----
>> > > From: New Groovy [mailto:newtogro...@gmail.com]
>> > > Sent: Dienstag, 24. Juni 2014 15:39
>> > > To: users@cxf.apache.org
>> > > Subject: adding a ThreadLocal from Interceptor?
>> > >
>> > > Hi,
>> > >
>> > > I would like to create a 'context' that is available to all classes
>> > called for a
>> > > particular request.  This context would include a unique request Id,
>> user
>> > > information etc..
>> > >
>> > > I am thinking of creating a ThreadLocal variable in an Interceptor,
>> > which I can
>> > > access in all downstream classes, and then remove in an outgoing
>> > Interceptor.
>> > > However I don't know enough about the CXF internals to know if that's
>> a
>> > > safe/reasonable thing to do.
>> > >
>> > > Can someone who does comment?
>> > >
>> > > Thanks!
>> >
>>
>
>

Reply via email to