|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.security.SecurityAssociation
The SecurityAssociation class maintains the security principal and credentials. This can be done on either a singleton basis or a thread local basis depending on the server property. When the server property has been set to true, the security information is maintained in thread local storage. The type of thread local storage depends on the org.jboss.security.SecurityAssociation.ThreadLocal property. If this property is true, then the thread local storage object is of type java.lang.ThreadLocal which results in the current thread's security information NOT being propagated to child threads. When the property is false or does not exist, the thread local storage object is of type java.lang.InheritableThreadLocal, and any threads spawned by the current thread will inherit the security information of the current thread. Subseqent changes to the current thread's security information are NOT propagated to any previously spawned child threads. When the server property is false, security information is maintained in class variables which makes the information available to all threads within the current VM. Note that this is not a public API class. Its an implementation detail that is subject to change without notice.
Nested Class Summary | |
static class |
SecurityAssociation.SubjectContext
The encapsulation of the authenticated subject |
Constructor Summary | |
SecurityAssociation()
|
Method Summary | |
static void |
clear()
Clear all principal information. |
static Principal |
getCallerPrincipal()
Get the caller's principal information. |
static Object |
getContextInfo(Object key)
Get the current thread context info. |
static Object |
getCredential()
Get the current principal credential information. |
static Principal |
getPrincipal()
Get the current principal information. |
static Subject |
getSubject()
Get the current Subject information. |
static RunAsIdentity |
peekRunAsIdentity()
Look at the current thread of control's run-as identity on the top of the stack. |
static RunAsIdentity |
peekRunAsIdentity(int depth)
Look at the current thread of control's run-as identity at the indicated depth. |
static RunAsIdentity |
popRunAsIdentity()
Pop the current thread of control's run-as identity. |
static SecurityAssociation.SubjectContext |
popSubjectContext()
Pop the current SubjectContext from the previous pushSubjectContext call and return the pushed SubjectContext ig there was one. |
static void |
pushRunAsIdentity(RunAsIdentity runAs)
Push the current thread of control's run-as identity. |
static void |
pushSubjectContext(Subject subject,
Principal principal,
Object credential)
Push the current authenticated context. |
static Object |
setContextInfo(Object key,
Object value)
Set the current thread context info. |
static void |
setCredential(Object credential)
Set the current principal credential information. |
static void |
setPrincipal(Principal principal)
Set the current principal information. |
static void |
setServer()
Set the server mode of operation. |
static void |
setSubject(Subject subject)
Set the current Subject information. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SecurityAssociation()
Method Detail |
public static Principal getPrincipal()
checkPermission
method with a RuntimePermission("org.jboss.security.SecurityAssociation.getPrincipalInfo")
permission to ensure it's ok to access principal information. If
not, a SecurityException
will be thrown.
public static Principal getCallerPrincipal()
checkPermission
method with a RuntimePermission("org.jboss.security.SecurityAssociation.getPrincipalInfo")
permission to ensure it's ok to access principal information. If
not, a SecurityException
will be thrown.
public static Object getCredential()
checkPermission
method with a RuntimePermission("org.jboss.security.SecurityAssociation.getPrincipalInfo")
permission to ensure it's ok to access principal information. If
not, a SecurityException
will be thrown.
public static Subject getSubject()
PolicyContext.getContext(String)
public static void setPrincipal(Principal principal)
checkPermission
method with a RuntimePermission("org.jboss.security.SecurityAssociation.setPrincipalInfo")
permission to ensure it's ok to access principal information. If
not, a SecurityException
will be thrown.
principal
- - the current principal identity.public static void setCredential(Object credential)
checkPermission
method with a
RuntimePermission("org.jboss.security.SecurityAssociation.setPrincipalInfo")
permission to ensure it's ok to access principal information. If
not, a SecurityException
will be thrown.
credential
- - the credential that proves the principal identity.public static void setSubject(Subject subject)
checkPermission
method with a RuntimePermission("org.jboss.security.SecurityAssociation.setPrincipalInfo")
permission to ensure it's ok to access principal information. If
not, a SecurityException
will be thrown.
subject
- - the current identity.public static Object getContextInfo(Object key)
checkPermission
method with a RuntimePermission("org.jboss.security.SecurityAssociation.accessContextInfo",
"get")
permission to ensure it's ok to access context information.
If not, a SecurityException
will be thrown.
key
- - the context key
public static Object setContextInfo(Object key, Object value)
checkPermission
method with a RuntimePermission("org.jboss.security.SecurityAssociation.accessContextInfo",
"set")
permission to ensure it's ok to access context information.
If not, a SecurityException
will be thrown.
key
- - the context keyvalue
- - the context value to associate under key
public static void pushSubjectContext(Subject subject, Principal principal, Object credential)
subject
- - the authenticated subjectprincipal
- - the principal that was input into the authenticationcredential
- - the credential that was input into the authenticationpublic static SecurityAssociation.SubjectContext popSubjectContext()
public static void clear()
checkPermission
method with a RuntimePermission("org.jboss.security.SecurityAssociation.setPrincipalInfo")
permission to ensure it's ok to access principal information. If
not, a SecurityException
will be thrown.
public static void pushRunAsIdentity(RunAsIdentity runAs)
public static RunAsIdentity popRunAsIdentity()
public static RunAsIdentity peekRunAsIdentity()
public static RunAsIdentity peekRunAsIdentity(int depth)
public static void setServer()
checkPermission
method with a
RuntimePermission("org.jboss.security.SecurityAssociation.setServer")
permission to ensure it's ok to access principal information. If
not, a SecurityException
will be thrown.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |