org.jboss.security
Class SecurityAssociation

java.lang.Object
  |
  +--org.jboss.security.SecurityAssociation

public final class SecurityAssociation
extends java.lang.Object

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.

Version:
$Revision: 1.4.2.2 $
Author:
Daniel O'Connor (docodan@nycap.rr.com), Scott.Stark@jboss.org

Constructor Summary
SecurityAssociation()
           
 
Method Summary
static java.lang.Object getCredential()
          Get the current principal credential information.
static java.security.Principal getPrincipal()
          Get the current principal information.
static java.security.Principal peekRunAsRole()
           
static java.security.Principal popRunAsRole()
           
static void pushRunAsRole(java.security.Principal runAsRole)
           
static void setCredential(java.lang.Object credential)
          Set the current principal credential information.
static void setPrincipal(java.security.Principal principal)
          Set the current principal information.
static void setServer()
          Set the server mode of operation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SecurityAssociation

public SecurityAssociation()
Method Detail

getPrincipal

public static java.security.Principal getPrincipal()
Get the current principal information.
Returns:
Principal, the current principal identity.

getCredential

public static java.lang.Object getCredential()
Get the current principal credential information. This can be of any type including: a String password, a char[] password, an X509 cert, etc.
Returns:
Object, the credential that proves the principal identity.

setPrincipal

public static void setPrincipal(java.security.Principal principal)
Set the current principal information.
Parameters:
principal, - the current principal identity.

setCredential

public static void setCredential(java.lang.Object credential)
Set the current principal credential information. This can be of any type including: a String password, a char[] password, an X509 cert, etc.
Parameters:
credential, - the credential that proves the principal identity.

pushRunAsRole

public static void pushRunAsRole(java.security.Principal runAsRole)

popRunAsRole

public static java.security.Principal popRunAsRole()

peekRunAsRole

public static java.security.Principal peekRunAsRole()

setServer

public static void setServer()
Set the server mode of operation. When the server property has been set to true, the security information is maintained in thread local storage. This should be called to enable property security semantics in any multi-threaded environment where more than one thread requires that security information be restricted to the thread's flow of control.


Copyright © 2000 The JBoss Organization. All Rights Reserved.