org.ow2.jonas.ejb.easybeans
Class JOnASSecurityContextWrapper

java.lang.Object
  extended by org.ow2.jonas.ejb.easybeans.JOnASSecurityContextWrapper
All Implemented Interfaces:
org.ow2.easybeans.security.api.EZBSecurityContext

public class JOnASSecurityContextWrapper
extends Object
implements org.ow2.easybeans.security.api.EZBSecurityContext

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

Author:
Florent Benoit

Constructor Summary
JOnASSecurityContextWrapper(SecurityContext jonasSecurityContext)
          Builds a security context around JOnAS security context.
 
Method Summary
 void endsRunAs(Subject oldSubject)
          Ends the run-as mode and then restore the context stored by container.
 Subject enterRunAs(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.
 Principal getCallerPrincipal(boolean runAsBean)
          Gets the caller's principal.
 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
 

Constructor Detail

JOnASSecurityContextWrapper

public JOnASSecurityContextWrapper(SecurityContext jonasSecurityContext)
Builds a security context around JOnAS security context.

Parameters:
jonasSecurityContext - the JOnAS context
Method Detail

getCallerPrincipal

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

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

getCallerRoles

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

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

enterRunAs

public Subject enterRunAs(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 org.ow2.easybeans.security.api.EZBSecurityContext
Parameters:
runAsSubject - the subject to used in run-as mode.
Returns:
the previous subject.

endsRunAs

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

Specified by:
endsRunAs in interface org.ow2.easybeans.security.api.EZBSecurityContext
Parameters:
oldSubject - subject kept by container and restored.


Copyright © 2010 OW2 Consortium. All Rights Reserved.