public class CachedIdentityAuthorizeCallback extends Object implements ExtendedCallback
A callback that is capable of perform authorization based on the identities managed by an IdentityCache
.
This callback can be used in two ways:
AuthorizeCallback
. As a result, the identity (if successfully authorized) will be cachedConstructor and Description |
---|
CachedIdentityAuthorizeCallback(Function<SecurityDomain,org.wildfly.security.cache.IdentityCache> identityCache,
boolean localCache)
Creates a new instance in order to authorize identities managed by the given
identityCache . |
CachedIdentityAuthorizeCallback(org.wildfly.security.cache.IdentityCache identityCache)
Creates a new instance in order to authorize identities managed by the given
identityCache . |
CachedIdentityAuthorizeCallback(org.wildfly.security.cache.IdentityCache identityCache,
boolean localCache)
Creates a new instance in order to authorize identities managed by the given
identityCache . |
CachedIdentityAuthorizeCallback(Principal principal,
Function<SecurityDomain,org.wildfly.security.cache.IdentityCache> identityCache,
boolean localCache)
Creates a new instance to authenticate, authorize and cache the identity associated with the given
principal . |
CachedIdentityAuthorizeCallback(Principal principal,
org.wildfly.security.cache.IdentityCache identityCache)
Creates a new instance to authenticate, authorize and cache the identity associated with the given
principal . |
CachedIdentityAuthorizeCallback(Principal principal,
org.wildfly.security.cache.IdentityCache identityCache,
boolean localCache)
Creates a new instance to authenticate, authorize and cache the identity associated with the given
principal . |
CachedIdentityAuthorizeCallback(String name,
org.wildfly.security.cache.IdentityCache identityCache)
Creates a new instance to authenticate, authorize and cache the identity associated with the given
name . |
Modifier and Type | Method and Description |
---|---|
Principal |
getAuthorizationPrincipal()
Returns the authorization
Principal . |
SecurityIdentity |
getIdentity()
Returns a cached
SecurityIdentity , if present in the cache. |
Principal |
getPrincipal()
Returns the
Principal representing the cached identity. |
boolean |
isAuthorized()
Indicates if a cached identity was successfully authorized.
|
boolean |
isLocalCache()
Indicates if authorization decisions should be performed based on the given
IdentityCache only. |
boolean |
isOptional()
Determine if this callback is optional.
|
boolean |
needsInformation()
Determine if this callback is requesting information.
|
void |
setAuthorized(SecurityIdentity securityIdentity)
Authorizes and caches the given
securityIdentity . |
void |
setSecurityDomain(SecurityDomain securityDomain)
Set the current
SecurityDomain in order to obtain identities from the cache |
public CachedIdentityAuthorizeCallback(org.wildfly.security.cache.IdentityCache identityCache)
identityCache
.identityCache
- the identity cachepublic CachedIdentityAuthorizeCallback(org.wildfly.security.cache.IdentityCache identityCache, boolean localCache)
identityCache
.identityCache
- the identity cachelocalCache
- if true, indicates that authorization should be based on the given identityCache
only. In case the mechanism
performing the authorization is wrapped by another one that provides a top-level cache (eg.: SSO), only the given
identityCache
will be considered.public CachedIdentityAuthorizeCallback(Function<SecurityDomain,org.wildfly.security.cache.IdentityCache> identityCache, boolean localCache)
Creates a new instance in order to authorize identities managed by the given identityCache
.
This constructor can be used to perform caching operations (e.g.: put, get and remove) in the context of a SecurityDomain
.
identityCache
- a function that creates an IdentityCache
given a SecurityDomain
localCache
- if true, indicates that authorization should be based on the given identityCache
only. In case the mechanism
performing the authorization is wrapped by another one that provides a top-level cache (eg.: SSO), only the given
identityCache
will be considered.public CachedIdentityAuthorizeCallback(String name, org.wildfly.security.cache.IdentityCache identityCache)
name
.name
- the name associated with the identityidentityCache
- the identity cachepublic CachedIdentityAuthorizeCallback(Principal principal, org.wildfly.security.cache.IdentityCache identityCache, boolean localCache)
principal
.principal
- the principal associated with the identityidentityCache
- the identity cachelocalCache
- if true, indicates that authorization should be based on the given identityCache
only. In case the mechanism
performing the authorization is wrapped by another one that provides a top-level cache (eg.: SSO), only the given
identityCache
will be considered.public CachedIdentityAuthorizeCallback(Principal principal, org.wildfly.security.cache.IdentityCache identityCache)
principal
.principal
- the principal associated with the identityidentityCache
- the identity cachepublic CachedIdentityAuthorizeCallback(Principal principal, Function<SecurityDomain,org.wildfly.security.cache.IdentityCache> identityCache, boolean localCache)
Creates a new instance to authenticate, authorize and cache the identity associated with the given principal
.
This constructor can be used to perform caching operations (e.g.: put, get and remove) in the context of a SecurityDomain
.
principal
- the principal associated with the identityidentityCache
- a function that creates an IdentityCache
given a SecurityDomain
localCache
- if true, indicates that authorization should be based on the given identityCache
only. In case the mechanism
performing the authorization is wrapped by another one that provides a top-level cache (eg.: SSO), only the given
identityCache
will be considered.public boolean isAuthorized()
public void setAuthorized(SecurityIdentity securityIdentity)
securityIdentity
.securityIdentity
- the identity to authorize and cache. If null, the corresponding identity will be removed from the cachepublic Principal getPrincipal()
Principal
representing the cached identity.null
)public Principal getAuthorizationPrincipal()
Principal
.null
)public SecurityIdentity getIdentity()
SecurityIdentity
, if present in the cache.public boolean isLocalCache()
IdentityCache
only.IdentityCache
only. Otherwise, falsepublic void setSecurityDomain(SecurityDomain securityDomain)
SecurityDomain
in order to obtain identities from the cachesecurityDomain
- the current security domainpublic boolean isOptional()
ExtendedCallback
isOptional
in interface ExtendedCallback
true
if the callback is optional, false
if it is mandatorypublic boolean needsInformation()
ExtendedCallback
needsInformation
in interface ExtendedCallback
true
if the callback is requesting information, false
if it is only providing informationCopyright © 2020 JBoss by Red Hat. All rights reserved.