public class SubjectThreadState extends Object implements ThreadState
Subject access (supporting
SecurityUtils.getSubject() calls)
during a thread's execution.
The 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 and Description |
|---|
SubjectThreadState(Subject subject)
Creates a new
SubjectThreadState that will bind and unbind the specified Subject to the
thread |
| Modifier and Type | Method and Description |
|---|---|
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()
Removes all thread-state that was bound by this instance. |
public SubjectThreadState(Subject subject)
SubjectThreadState that will bind and unbind the specified Subject to the
threadsubject - the Subject instance to bind and unbind from the ThreadContext.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 ThreadStatepublic void restore()
Removes 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 ThreadStatepublic 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 ThreadStateCopyright © 2004-2016 The Apache Software Foundation. All Rights Reserved.