org.objectweb.easybeans.security.propagation.jonas
Class JOnASSecurityContext

java.lang.Object
  extended by org.objectweb.easybeans.security.propagation.jonas.JOnASSecurityContext
All Implemented Interfaces:
EZBSecurityContext

public class JOnASSecurityContext
extends java.lang.Object
implements EZBSecurityContext

Wrapper class for the JOnAS security.
It will propagate and read JOnAS security context.

Author:
Florent Benoit

Field Summary
private  java.lang.Object jonasSecurityContext
          Wrapped security context of JOnAS.
 
Constructor Summary
JOnASSecurityContext(java.lang.Object jonasSecurityContext)
          Builds a security context around JOnAS security context.
 
Method Summary
 void endsRunAs(javax.security.auth.Subject oldSubject)
          Ends the run-as mode and then restore the context stored by container.
 javax.security.auth.Subject enterRunAs(javax.security.auth.Subject runAsSubject)
          Enters in run-as mode with the given subject.
The previous subject is stored and will be restored when run-as mode will be ended.
 java.security.Principal getCallerPrincipal(boolean runAsBean)
          Gets the caller's principal.
 java.security.Principal[] getCallerRoles(boolean runAsBean)
          Gets the caller's roles.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jonasSecurityContext

private java.lang.Object jonasSecurityContext
Wrapped security context of JOnAS.

Constructor Detail

JOnASSecurityContext

public JOnASSecurityContext(java.lang.Object jonasSecurityContext)
Builds a security context around JOnAS security context.

Parameters:
jonasSecurityContext - the JOnAS context
Method Detail

getCallerPrincipal

public java.security.Principal getCallerPrincipal(boolean runAsBean)
Gets the caller's principal.

Specified by:
getCallerPrincipal in interface EZBSecurityContext
Parameters:
runAsBean - if true, the bean is a run-as bean.
Returns:
principal of the caller.

getCallerRoles

public java.security.Principal[] getCallerRoles(boolean runAsBean)
Gets the caller's roles.

Specified by:
getCallerRoles in interface EZBSecurityContext
Parameters:
runAsBean - if true, the bean is a run-as bean.
Returns:
array of roles of the caller.

enterRunAs

public javax.security.auth.Subject enterRunAs(javax.security.auth.Subject runAsSubject)
Enters in run-as mode with the given subject.
The previous subject is stored and will be restored when run-as mode will be ended.

Specified by:
enterRunAs in interface EZBSecurityContext
Parameters:
runAsSubject - the subject to used in run-as mode.
Returns:
the previous subject.

endsRunAs

public void endsRunAs(javax.security.auth.Subject oldSubject)
Ends the run-as mode and then restore the context stored by container.

Specified by:
endsRunAs in interface EZBSecurityContext
Parameters:
oldSubject - subject kept by container and restored.