org.objectweb.security.context
Class SecurityContext

java.lang.Object
  extended byorg.objectweb.security.context.SecurityContext
All Implemented Interfaces:
java.io.Serializable

public class SecurityContext
extends java.lang.Object
implements java.io.Serializable

Implementation of the JOnAS Security Context CAUTION: Don't forget to modify the marshalling and the unmarshalling in the org.objectweb.jonas.security.interceptors.iiop.SecurityInterceptor class when adding attributes in SecurityContext.

Author:
Jeff Mesnil (initial developer), Florent Benoit
See Also:
Serialized Form

Constructor Summary
SecurityContext()
          Constructor SecurityContext use the default principal name
SecurityContext(java.lang.String principalName)
          Constructor SecurityContext
SecurityContext(java.lang.String principalName, java.util.ArrayList arrayRoles)
          Constructor SecurityContext
SecurityContext(java.lang.String principalName, java.util.ArrayList arrayRoles, java.util.ArrayList arrayRunas)
          Constructor SecurityContext
SecurityContext(java.lang.String principalName, java.lang.String[] roles)
          Constructor SecurityContext
 
Method Summary
 java.security.Principal getCallerPrincipal()
          Method getCallerPrincipal
 java.lang.String[] getCallerPrincipalRoles()
          Return the roles of the principal
 java.util.ArrayList getRunAsStack()
          Gets the stack which manage the run-as
 java.lang.String peekRunAs()
          Peek : Looks at the object at the top of this stack without removing it from the stack.
 void popRunAs()
          Pop : Removes the object at the top of the run-as role stack
 void pushRunAs(java.lang.String role)
          Push : Pushes an item onto the top of this stack.
 java.lang.String toString()
          Method toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SecurityContext

public SecurityContext()
Constructor SecurityContext use the default principal name


SecurityContext

public SecurityContext(java.lang.String principalName,
                       java.lang.String[] roles)
Constructor SecurityContext

Parameters:
principalName - principal name
roles - the roles of the principal

SecurityContext

public SecurityContext(java.lang.String principalName,
                       java.util.ArrayList arrayRoles)
Constructor SecurityContext

Parameters:
principalName - principal name
arrayRoles - the list of the roles of the principal

SecurityContext

public SecurityContext(java.lang.String principalName,
                       java.util.ArrayList arrayRoles,
                       java.util.ArrayList arrayRunas)
Constructor SecurityContext

Parameters:
principalName - principal name
arrayRoles - the list of the roles of the principal
arrayRunas - the RunAs stack

SecurityContext

public SecurityContext(java.lang.String principalName)
Constructor SecurityContext

Parameters:
principalName - principal name
Method Detail

getCallerPrincipal

public java.security.Principal getCallerPrincipal()
Method getCallerPrincipal

Returns:
the Principal in the Security Context

getCallerPrincipalRoles

public java.lang.String[] getCallerPrincipalRoles()
Return the roles of the principal

Returns:
roles

pushRunAs

public void pushRunAs(java.lang.String role)
Push : Pushes an item onto the top of this stack.

Parameters:
role - the role to add on top of the stack

popRunAs

public void popRunAs()
Pop : Removes the object at the top of the run-as role stack


peekRunAs

public java.lang.String peekRunAs()
Peek : Looks at the object at the top of this stack without removing it from the stack.

Returns:
the role at the top of the stack

getRunAsStack

public java.util.ArrayList getRunAsStack()
Gets the stack which manage the run-as

Returns:
the stack which manage the run-as

toString

public java.lang.String toString()
Method toString

Returns:
String a string representation of the object