Package org.wildfly.security.cache
Class CachedIdentity
java.lang.Object
org.wildfly.security.cache.CachedIdentity
- All Implemented Interfaces:
Serializable
Represents a cached identity, managed by an
IdentityCache.- Author:
- Pedro Igor, Paul Ferraro, Darran Lofthouse
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCachedIdentity(String mechanismName, boolean programmatic, Principal principal) Creates a new instance based on the givenmechanismNameandprincipal.CachedIdentity(String mechanismName, boolean programmatic, Principal principal, Set<String> roles) Creates a new instance based on the givenmechanismNameandprincipal.CachedIdentity(String mechanismName, boolean programmatic, SecurityIdentity securityIdentity) Creates a new instance based on the givenmechanismNameandsecurityIdentity. -
Method Summary
Modifier and TypeMethodDescriptionReturns the name of the authentication mechanism used to authenticate/authorize the identity.getName()Returns the principal name associated with the cached identity.getRoles()Returns the roles associated with the cached identity.Returns the identity represented by this instance.booleanReturnstrueif this identity was established using programmatic authentication,falseotherwise.toString()
-
Constructor Details
-
CachedIdentity
public CachedIdentity(String mechanismName, boolean programmatic, SecurityIdentity securityIdentity) Creates a new instance based on the givenmechanismNameandsecurityIdentity.- Parameters:
mechanismName- the name of the authentication mechanism used to authenticate/authorize the identityprogrammatic- indicates if this identity was created as a result of programmatic authenticationsecurityIdentity- the identity to cache
-
CachedIdentity
Creates a new instance based on the givenmechanismNameandprincipal.- Parameters:
mechanismName- the name of the authentication mechanism used to authenticate/authorize the identityprogrammatic- indicates if this identity was created as a result of programmatic authenticationprincipal- the principal of this cached identity
-
CachedIdentity
public CachedIdentity(String mechanismName, boolean programmatic, Principal principal, Set<String> roles) Creates a new instance based on the givenmechanismNameandprincipal.- Parameters:
mechanismName- the name of the authentication mechanism used to authenticate/authorize the identityprogrammatic- indicates if this identity was created as a result of programmatic authenticationprincipal- the principal of this cached identityroles- the roles assigned to this cached identity
-
-
Method Details
-
getMechanismName
Returns the name of the authentication mechanism used to authenticate/authorize the identity.- Returns:
- the name of the authentication mechanism used to authenticate/authorize the identity
-
getName
Returns the principal name associated with the cached identity.- Returns:
- the principal name associated with the cached identity. The name should never be null, as it will be used to re-create the identity when necessary (not
null)
-
getSecurityIdentity
Returns the identity represented by this instance.- Returns:
- the identity represented by this instance. This method may return
nullin case the cache is holding the principal name only
-
isProgrammatic
public boolean isProgrammatic()Returnstrueif this identity was established using programmatic authentication,falseotherwise.- Returns:
trueif this identity was established using programmatic authentication,falseotherwise.
-
getRoles
Returns the roles associated with the cached identity.- Returns:
- the roles associated with the cached identity.
-
toString
-