public class SecurityContextAssociation extends Object
Modifier and Type | Field and Description |
---|---|
static String |
SECURITYCONTEXT_THREADLOCAL
Flag to indicate whether threads that are spawned inherit the security context from parent
Set this to false if you do not want inheritance.
|
Constructor and Description |
---|
SecurityContextAssociation() |
Modifier and Type | Method and Description |
---|---|
static void |
clearSecurityContext()
Clear the current security context
|
static Object |
getContextInfo(String key)
Get the current thread context info.
|
static Object |
getCredential() |
static Principal |
getPrincipal() |
static SecurityContext |
getSecurityContext()
Get a security context
|
static Subject |
getSubject() |
static boolean |
isClient()
Indicates whether we are on the client side
|
static RunAs |
peekRunAsIdentity()
Look at the current thread of control's run-as identity
|
static RunAs |
popRunAsIdentity()
Pops a RunAs identity
|
static void |
pushRunAsIdentity(RunAs runAs)
Pushes a RunAs identity
|
static void |
setClient()
Set the VM-wide client side usage
|
static Object |
setContextInfo(String key,
Object value)
Set the current thread context info.
|
static void |
setCredential(Object credential) |
static void |
setPrincipal(Principal principal) |
static void |
setSecurityContext(SecurityContext sc)
Set a security context
|
public static final String SECURITYCONTEXT_THREADLOCAL
public static boolean isClient()
public static void setClient()
public static void setSecurityContext(SecurityContext sc)
sc
- public static SecurityContext getSecurityContext()
public static void clearSecurityContext()
public static void pushRunAsIdentity(RunAs runAs)
runAs
- public static RunAs popRunAsIdentity()
public static RunAs peekRunAsIdentity()
public static Object getContextInfo(String key)
checkPermission
method with a RuntimePermission("org.jboss.security.accessContextInfo:get")
permission to ensure it's ok to access context information.
If not, a SecurityException
will be thrown.key
- - the context keypublic static Object setContextInfo(String key, Object value)
checkPermission
method with a RuntimePermission("org.jboss.security.accessContextInfo:set")
permission to ensure it's ok to access context information.
If not, a SecurityException
will be thrown.key
- - the context keyvalue
- - the conSetContextInfotext value to associate under keypublic static Subject getSubject()
public static Principal getPrincipal()
public static void setPrincipal(Principal principal)
public static Object getCredential()
public static void setCredential(Object credential)
Copyright © 2018 JBoss by Red Hat. All rights reserved.