You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shiro.apache.org by Ryan McKinley <ry...@gmail.com> on 2009/03/30 22:58:58 UTC

ThreadContext vs SecurityUtils?

Assuming you are working in a web context, is there any reason to use  
SecurityUtils.getSubject() rather then ThreadContext.getSubject()

I'm guessing the former just enables you to have a static singleton as  
the SecurityManager and the later assums the SecurityManager has bound  
stuff to the ThreadContext.

thanks
ryan

Re: ThreadContext vs SecurityUtils?

Posted by Les Hazlewood <lh...@apache.org>.
Yes, the ThreadContext is used for deep-down internals of the framework and
shouldn't be accessed by end-users.  Its implementation (and referenced
keys) can change at any time without notification.

Cheers,

Les

On Mon, Mar 30, 2009 at 5:08 PM, Jeremy Haile <jh...@fastmail.fm> wrote:

> SecurityUtils is part of the API and intended for users to access.
>  ThreadContext is an internal helper class that most users would not access
> directly.
>
>
>
> On Mar 30, 2009, at 4:58 PM, Ryan McKinley wrote:
>
>  Assuming you are working in a web context, is there any reason to use
>> SecurityUtils.getSubject() rather then ThreadContext.getSubject()
>>
>> I'm guessing the former just enables you to have a static singleton as the
>> SecurityManager and the later assums the SecurityManager has bound stuff to
>> the ThreadContext.
>>
>> thanks
>> ryan
>>
>
>

Re: ThreadContext vs SecurityUtils?

Posted by Jeremy Haile <jh...@fastmail.fm>.
SecurityUtils is part of the API and intended for users to access.   
ThreadContext is an internal helper class that most users would not  
access directly.


On Mar 30, 2009, at 4:58 PM, Ryan McKinley wrote:

> Assuming you are working in a web context, is there any reason to  
> use SecurityUtils.getSubject() rather then ThreadContext.getSubject()
>
> I'm guessing the former just enables you to have a static singleton  
> as the SecurityManager and the later assums the SecurityManager has  
> bound stuff to the ThreadContext.
>
> thanks
> ryan