|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.easybeans.security.propagation.context.SecurityContext
public final class SecurityContext
Security Context that is exchanged and propagated from clients to beans.
This is also why it is a serializable object (as it has to be exchanged).
The security contains allow to get the current principal and the roles
associated to this principal.
RunAs mode is managed by keeping the previous security context.
Field Summary | |
---|---|
private static java.lang.String |
ANONYMOUS_ROLE
Anonymous role. |
private static javax.security.auth.Subject |
ANONYMOUS_SUBJECT
Anonymous subject (not authenticated). |
private static java.lang.String |
ANONYMOUS_USER
Anonymous user name. |
private javax.security.auth.Subject |
callerInRunAsModeSubject
caller subject in run-as mode In run-as case, the run-as subject is set as the current subject, and the previous one is kept. This previous subject is used to get the caller on the run-as bean. |
private static JLog |
logger
Logger. |
private static long |
serialVersionUID
UID for serialization. |
private javax.security.auth.Subject |
subject
Current subject (subject that has been authenticated). By default, it is the anonymous subject. |
Constructor Summary | |
---|---|
SecurityContext()
Default private constructor. |
|
SecurityContext(javax.security.auth.Subject subject)
Build a security context with the given subject. |
Method Summary | |
---|---|
private static javax.security.auth.Subject |
buildAnonymousSubject()
Build an anonymous subject when no user is authenticated. This is required as getCallerPrincipal() should never return null. |
static javax.security.auth.Subject |
buildSubject(java.lang.String userName,
java.util.List<java.lang.String> roleList)
Build a subject with the given user name and the list of roles. |
static javax.security.auth.Subject |
buildSubject(java.lang.String userName,
java.lang.String[] roleArray)
Build a subject with the given user name and the list of roles. |
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. |
java.util.List<? extends java.security.Principal> |
getCallerRolesList(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 |
---|
private static final long serialVersionUID
private static JLog logger
private static final java.lang.String ANONYMOUS_USER
private static final java.lang.String ANONYMOUS_ROLE
private static final javax.security.auth.Subject ANONYMOUS_SUBJECT
private javax.security.auth.Subject subject
private javax.security.auth.Subject callerInRunAsModeSubject
Constructor Detail |
---|
public SecurityContext()
public SecurityContext(javax.security.auth.Subject subject)
subject
- the given subject.Method Detail |
---|
public javax.security.auth.Subject enterRunAs(javax.security.auth.Subject runAsSubject)
enterRunAs
in interface EZBSecurityContext
runAsSubject
- the subject to used in run-as mode.
public void endsRunAs(javax.security.auth.Subject oldSubject)
endsRunAs
in interface EZBSecurityContext
oldSubject
- subject kept by container and restored.public java.security.Principal getCallerPrincipal(boolean runAsBean)
getCallerPrincipal
in interface EZBSecurityContext
runAsBean
- if true, the bean is a run-as bean.
public java.util.List<? extends java.security.Principal> getCallerRolesList(boolean runAsBean)
runAsBean
- if true, the bean is a run-as bean.
public java.security.Principal[] getCallerRoles(boolean runAsBean)
getCallerRoles
in interface EZBSecurityContext
runAsBean
- if true, the bean is a run-as bean.
private static javax.security.auth.Subject buildAnonymousSubject()
public static javax.security.auth.Subject buildSubject(java.lang.String userName, java.lang.String[] roleArray)
userName
- given usernameroleArray
- given array of roles.
public static javax.security.auth.Subject buildSubject(java.lang.String userName, java.util.List<java.lang.String> roleList)
userName
- given usernameroleList
- given list of roles.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |