Package org.jboss.as.controller
Class AccessAuditContext
- java.lang.Object
-
- org.jboss.as.controller.AccessAuditContext
-
public class AccessAuditContext extends Object
The context used to store state related to access control and auditing for the current invocation.- Author:
- Darran Lofthouse
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static AccessAuditContextcurrentAccessAuditContext()Deprecated.Internal use, will be changed without warning at any time.static <T> TdoAs(boolean inflowed, org.wildfly.security.auth.server.SecurityIdentity securityIdentity, InetAddress remoteAddress, PrivilegedAction<T> action)Perform work with a newAccessAuditContextas a particularSecurityIdentitystatic <T> TdoAs(boolean inflowed, org.wildfly.security.auth.server.SecurityIdentity securityIdentity, InetAddress remoteAddress, PrivilegedExceptionAction<T> action)Perform work with a newAccessAuditContextas a particularSecurityIdentitystatic <T> TdoAs(org.wildfly.security.auth.server.SecurityIdentity securityIdentity, InetAddress remoteAddress, PrivilegedAction<T> action)Perform work with a newAccessAuditContextas a particularSecurityIdentitystatic <T> TdoAs(org.wildfly.security.auth.server.SecurityIdentity securityIdentity, InetAddress remoteAddress, PrivilegedExceptionAction<T> action)Perform work with a newAccessAuditContextas a particularSecurityIdentityAccessMechanismgetAccessMechanism()Gets the mechanism via which the user initiated the access.StringgetDomainUuid()Gets the unique identifier for a multi-domain-process operation.InetAddressgetRemoteAddress()Get the remote address of the caller.org.wildfly.security.auth.server.SecurityIdentitygetSecurityIdentity()Get theSecurityIdentityassociated with thisAccessAuditContext.booleanisDomainRollout()Gets whether this context relates to a secondary request initiated by a remote Host Controller process as part of its rollout of an operation initiated on that process.booleanisInflowed()Get if the currentSecurityIdentitywas inflowed from another process.voidsetAccessMechanism(AccessMechanism accessMechanism)voidsetDomainRollout(boolean domainRollout)voidsetDomainUuid(String domainUuid)
-
-
-
Method Detail
-
getSecurityIdentity
public org.wildfly.security.auth.server.SecurityIdentity getSecurityIdentity()
Get theSecurityIdentityassociated with thisAccessAuditContext. This provides a way for theSecurityIdentityto be passed without the underlyingSecurityDomainbeing known.- Returns:
- the
SecurityIdentityassociated with thisAccessAuditContext.
-
isInflowed
public boolean isInflowed()
Get if the currentSecurityIdentitywas inflowed from another process. This is a special case where we want to use it without attempting to inflow into a configured security domain.- Returns:
trueif the identity was inflowed,falseotherwise.
-
getRemoteAddress
public InetAddress getRemoteAddress()
Get the remote address of the caller.- Returns:
- the remote address of the caller.
-
getDomainUuid
public String getDomainUuid()
Gets the unique identifier for a multi-domain-process operation.- Returns:
- the identifier, or
nullif this context does not relate to a multi-domain-process operation
-
setDomainUuid
public void setDomainUuid(String domainUuid)
-
getAccessMechanism
public AccessMechanism getAccessMechanism()
Gets the mechanism via which the user initiated the access.- Returns:
- the mechanism, or
nullif the access was initiated internally
-
setAccessMechanism
public void setAccessMechanism(AccessMechanism accessMechanism)
-
isDomainRollout
public boolean isDomainRollout()
Gets whether this context relates to a secondary request initiated by a remote Host Controller process as part of its rollout of an operation initiated on that process.- Returns:
trueif this context relates to a remotely coordinated multi-process domain operation
-
setDomainRollout
public void setDomainRollout(boolean domainRollout)
-
currentAccessAuditContext
@Deprecated public static AccessAuditContext currentAccessAuditContext()
Deprecated.Internal use, will be changed without warning at any time.Obtain the currentAccessAuditContextornullif none currently set.- Returns:
- The current
AccessAuditContext
-
doAs
public static <T> T doAs(org.wildfly.security.auth.server.SecurityIdentity securityIdentity, InetAddress remoteAddress, PrivilegedAction<T> action)Perform work with a newAccessAuditContextas a particularSecurityIdentity- Type Parameters:
T- the type of teh return value- Parameters:
securityIdentity- theSecurityIdentitythat the specifiedactionwill run as. May benullremoteAddress- the remote address of the caller.action- the work to perform. Cannot benull- Returns:
- the value returned by the PrivilegedAction's
runmethod - Throws:
NullPointerException- if the specifiedPrivilegedExceptionActionisnull.SecurityException- if the caller does not have permission to invoke this method.
-
doAs
public static <T> T doAs(boolean inflowed, org.wildfly.security.auth.server.SecurityIdentity securityIdentity, InetAddress remoteAddress, PrivilegedAction<T> action)Perform work with a newAccessAuditContextas a particularSecurityIdentity- Type Parameters:
T- the type of teh return value- Parameters:
inflowed- was the identity inflowed from a remote process?securityIdentity- theSecurityIdentitythat the specifiedactionwill run as. May benullremoteAddress- the remote address of the caller.action- the work to perform. Cannot benull- Returns:
- the value returned by the PrivilegedAction's
runmethod - Throws:
NullPointerException- if the specifiedPrivilegedExceptionActionisnull.SecurityException- if the caller does not have permission to invoke this method.
-
doAs
public static <T> T doAs(org.wildfly.security.auth.server.SecurityIdentity securityIdentity, InetAddress remoteAddress, PrivilegedExceptionAction<T> action) throws PrivilegedActionExceptionPerform work with a newAccessAuditContextas a particularSecurityIdentity- Type Parameters:
T- the type of teh return value- Parameters:
securityIdentity- theSecurityIdentitythat the specifiedactionwill run as. May benullremoteAddress- the remote address of the caller.action- the work to perform. Cannot benull- Returns:
- the value returned by the PrivilegedAction's
runmethod - Throws:
PrivilegedActionException- if thePrivilegedExceptionAction.runmethod throws a checked exception.NullPointerException- if the specifiedPrivilegedExceptionActionisnull.SecurityException- if the caller does not have permission to invoke this method.
-
doAs
public static <T> T doAs(boolean inflowed, org.wildfly.security.auth.server.SecurityIdentity securityIdentity, InetAddress remoteAddress, PrivilegedExceptionAction<T> action) throws PrivilegedActionExceptionPerform work with a newAccessAuditContextas a particularSecurityIdentity- Type Parameters:
T- the type of teh return value- Parameters:
inflowed- was the identity inflowed from a remote process?securityIdentity- theSecurityIdentitythat the specifiedactionwill run as. May benullremoteAddress- the remote address of the caller.action- the work to perform. Cannot benull- Returns:
- the value returned by the PrivilegedAction's
runmethod - Throws:
PrivilegedActionException- if thePrivilegedExceptionAction.runmethod throws a checked exception.NullPointerException- if the specifiedPrivilegedExceptionActionisnull.SecurityException- if the caller does not have permission to invoke this method.
-
-