jrun.security
Class JRunSecurityContext

java.lang.Object
  |
  +--jrun.security.JRunSecurityContext
All Implemented Interfaces:
SecurityContext, java.io.Serializable

public final class JRunSecurityContext
extends java.lang.Object
implements SecurityContext

JRunSecurityContext to maintain security information for a client. Tied to the lifetime of a Naming Context. Hence this object gets created and destroyed along with the Naming Context. We use SimplePrincipal throughout because it contains the type value which can be ROLE or USER We need to know the type to authorize a principal wrt a role(s) Maintains a Threadlocal variable containing a stack of runAs identities Maintains a Threadlocal variable containing a stack of Caller identities

Author:
Ramesh Natarajan
See Also:
, Serialized Form

Constructor Summary
JRunSecurityContext(java.lang.Object ctxId, java.security.Principal principal, java.lang.Object credential)
           
 
Method Summary
 void addRunAs(java.lang.String runAsIdentity, SimplePrincipal callingPrincipal)
          Push the RunAs Principal and Caller Principal onto the stack
 java.lang.Object getCallerCredential()
           
 SimplePrincipal getCallerPrincipal()
          Returns the Caller Principal.
 SimplePrincipal getRunAsPrincipal()
          If the current component has run as identity specified in its metadata, this returns the principal associated with that run as identity, else returns null This returns a Simple Principal that has type ROLE.
 javax.security.auth.Subject getSubject()
           
 boolean isRunAs()
          Does this EJBInvocation have a RunAs Identity ?
 void removeRunAs()
          Remove the current RunAs user identity and make the previous one, the active identity for this EJBInvocation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JRunSecurityContext

public JRunSecurityContext(java.lang.Object ctxId,
                           java.security.Principal principal,
                           java.lang.Object credential)
Method Detail

getCallerCredential

public java.lang.Object getCallerCredential()
Specified by:
getCallerCredential in interface SecurityContext

getCallerPrincipal

public SimplePrincipal getCallerPrincipal()
Description copied from interface: SecurityContext
Returns the Caller Principal. This could be a role or a User principal depending on whether the previous invocation in this call chain had a run as identity or caller identity
Specified by:
getCallerPrincipal in interface SecurityContext

getRunAsPrincipal

public SimplePrincipal getRunAsPrincipal()
If the current component has run as identity specified in its metadata, this returns the principal associated with that run as identity, else returns null This returns a Simple Principal that has type ROLE.
Specified by:
getRunAsPrincipal in interface SecurityContext

addRunAs

public void addRunAs(java.lang.String runAsIdentity,
                     SimplePrincipal callingPrincipal)
Push the RunAs Principal and Caller Principal onto the stack
Specified by:
addRunAs in interface SecurityContext

removeRunAs

public void removeRunAs()
Remove the current RunAs user identity and make the previous one, the active identity for this EJBInvocation
Specified by:
removeRunAs in interface SecurityContext

isRunAs

public boolean isRunAs()
Does this EJBInvocation have a RunAs Identity ?
Specified by:
isRunAs in interface SecurityContext

getSubject

public javax.security.auth.Subject getSubject()
Specified by:
getSubject in interface SecurityContext


Copyright � 2002 Macromedia Corporation. All Rights Reserved.