Package org.jboss.security.plugins
Class JBossSecurityContextUtil
- java.lang.Object
-
- org.jboss.security.SecurityContextUtil
-
- org.jboss.security.plugins.JBossSecurityContextUtil
-
public class JBossSecurityContextUtil extends SecurityContextUtil
Utility class for JBossSecurityContext implementation- Since:
- Jan 5, 2007
- Version:
- $Revision$
- Author:
- Anil Saldhana
-
-
Field Summary
-
Fields inherited from class org.jboss.security.SecurityContextUtil
securityContext
-
-
Constructor Summary
Constructors Constructor Description JBossSecurityContextUtil(SecurityContext sc)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> T
get(String key)
Return an object from the Security ContextObject
getCredential()
Get the credentialRoleGroup
getRoles()
Get the Roles associated with the user for the current security contextSecurityIdentity
getSecurityIdentity()
Get a holder of subject, runAs and caller RunAsSubject
getSubject()
Get the subject the security contextString
getUserName()
Get the username from the security contextPrincipal
getUserPrincipal()
Get the user principal the security context<T> T
remove(String key)
Remove an object represented by the key from the security context<T> void
set(String key, T obj)
Set an object on the Security Context The context implementation may place the object in its internal data structures (like the Data Map)void
setRoles(RoleGroup roles)
Set the roles for the user for the current security contextvoid
setSecurityIdentity(SecurityIdentity sidentity)
Inject subject, runAs and callerRunAs into the security context Mainly used by integration code base to cache the security identity and put back to the security context-
Methods inherited from class org.jboss.security.SecurityContextUtil
addIdentity, clearIdentities, createSubjectInfo, createSubjectInfo, getIdentities, setIdentities, setSecurityContext
-
-
-
-
Constructor Detail
-
JBossSecurityContextUtil
public JBossSecurityContextUtil(SecurityContext sc)
-
-
Method Detail
-
get
public <T> T get(String key)
Description copied from class:SecurityContextUtil
Return an object from the Security Context- Specified by:
get
in classSecurityContextUtil
- Parameters:
key
- key identifies the type of object we are requesting- Returns:
-
getUserName
public String getUserName()
Description copied from class:SecurityContextUtil
Get the username from the security context- Specified by:
getUserName
in classSecurityContextUtil
- Returns:
- username
-
getUserPrincipal
public Principal getUserPrincipal()
Description copied from class:SecurityContextUtil
Get the user principal the security context- Specified by:
getUserPrincipal
in classSecurityContextUtil
- Returns:
- user principal
-
getCredential
public Object getCredential()
Description copied from class:SecurityContextUtil
Get the credential- Specified by:
getCredential
in classSecurityContextUtil
- Returns:
-
getSubject
public Subject getSubject()
Description copied from class:SecurityContextUtil
Get the subject the security context- Specified by:
getSubject
in classSecurityContextUtil
- Returns:
-
set
public <T> void set(String key, T obj)
Description copied from class:SecurityContextUtil
Set an object on the Security Context The context implementation may place the object in its internal data structures (like the Data Map)- Specified by:
set
in classSecurityContextUtil
- Type Parameters:
T
- Generic Type- Parameters:
key
- Key representing the object being set
-
remove
public <T> T remove(String key)
Description copied from class:SecurityContextUtil
Remove an object represented by the key from the security context- Specified by:
remove
in classSecurityContextUtil
- Parameters:
key
- key identifies the type of object we are requesting- Returns:
- the removed object
-
setRoles
public void setRoles(RoleGroup roles)
Description copied from class:SecurityContextUtil
Set the roles for the user for the current security context- Specified by:
setRoles
in classSecurityContextUtil
-
setSecurityIdentity
public void setSecurityIdentity(SecurityIdentity sidentity)
Description copied from class:SecurityContextUtil
Inject subject, runAs and callerRunAs into the security context Mainly used by integration code base to cache the security identity and put back to the security context- Specified by:
setSecurityIdentity
in classSecurityContextUtil
- Parameters:
sidentity
- The SecurityIdentity Object
-
getSecurityIdentity
public SecurityIdentity getSecurityIdentity()
Description copied from class:SecurityContextUtil
Get a holder of subject, runAs and caller RunAs- Specified by:
getSecurityIdentity
in classSecurityContextUtil
- Returns:
-
getRoles
public RoleGroup getRoles()
Description copied from class:SecurityContextUtil
Get the Roles associated with the user for the current security context- Specified by:
getRoles
in classSecurityContextUtil
- Returns:
-
-