|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.shiro.subject.support.SubjectThreadState
public class SubjectThreadState
Manages thread-state for Subject
access (supporting
SecurityUtils.
getSubject()
calls)
during a thread's execution.
bind
method will bind a Subject
and a
SecurityManager
to the ThreadContext
so they can be retrieved
from the ThreadContext
later by any
SecurityUtils.
getSubject()
calls that might occur during
the thread's execution.
Constructor Summary | |
---|---|
SubjectThreadState(Subject subject)
Creates a new SubjectThreadState that will bind and unbind the specified Subject to the
thread |
Method Summary | |
---|---|
void |
bind()
Binds a Subject and SecurityManager to the
ThreadContext so they can be retrieved later by any
SecurityUtils. getSubject() calls that might occur
during the thread's execution. |
void |
clear()
Completely removes the ThreadContext state. |
protected Subject |
getSubject()
Returns the Subject instance managed by this ThreadState implementation. |
void |
restore()
Remove s all thread-state that was bound by this instance. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SubjectThreadState(Subject subject)
SubjectThreadState
that will bind and unbind the specified Subject
to the
thread
subject
- the Subject
instance to bind and unbind from the ThreadContext
.Method Detail |
---|
protected Subject getSubject()
Subject
instance managed by this ThreadState
implementation.
Subject
instance managed by this ThreadState
implementation.public void bind()
Subject
and SecurityManager
to the
ThreadContext
so they can be retrieved later by any
SecurityUtils.
getSubject()
calls that might occur
during the thread's execution.
Prior to binding, the ThreadContext
's existing resources
are
retained so they can be restored later via the restore
call.
bind
in interface ThreadState
public void restore()
Remove
s all thread-state that was bound by this instance. If any previous
thread-bound resources existed prior to the bind
call, they are restored back to the
ThreadContext
to ensure the thread state is exactly as it was before binding.
restore
in interface ThreadState
public void clear()
removes
the ThreadContext
state. Typically this method should
only be called in special cases - it is more 'correct' to restore
a thread to its previous
state than to clear it entirely.
clear
in interface ThreadState
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |