Package org.wildfly.security.cache
Class CachedIdentity
- java.lang.Object
-
- org.wildfly.security.cache.CachedIdentity
-
- All Implemented Interfaces:
Serializable
public final class CachedIdentity extends Object implements Serializable
Represents a cached identity, managed by anIdentityCache.- Author:
- Pedro Igor, Paul Ferraro, Darran Lofthouse
- See Also:
IdentityCache, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private StringmechanismNameprivate Stringnameprivate booleanprogrammaticprivate Set<String>rolesprivate SecurityIdentitysecurityIdentityprivate static longserialVersionUID
-
Constructor Summary
Constructors Modifier Constructor Description CachedIdentity(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.privateCachedIdentity(String mechanismName, boolean programmatic, SecurityIdentity securityIdentity, Principal principal)privateCachedIdentity(String mechanismName, boolean programmatic, SecurityIdentity securityIdentity, Principal principal, Set<String> roles)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetMechanismName()Returns the name of the authentication mechanism used to authenticate/authorize the identity.StringgetName()Returns the principal name associated with the cached identity.Set<String>getRoles()Returns the roles associated with the cached identity.SecurityIdentitygetSecurityIdentity()Returns the identity represented by this instance.booleanisProgrammatic()Returnstrueif this identity was established using programmatic authentication,falseotherwise.StringtoString()
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
mechanismName
private final String mechanismName
-
programmatic
private final boolean programmatic
-
name
private final String name
-
securityIdentity
private final transient SecurityIdentity securityIdentity
-
-
Constructor Detail
-
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
public CachedIdentity(String mechanismName, boolean programmatic, Principal principal)
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
-
CachedIdentity
private CachedIdentity(String mechanismName, boolean programmatic, SecurityIdentity securityIdentity, Principal principal)
-
CachedIdentity
private CachedIdentity(String mechanismName, boolean programmatic, SecurityIdentity securityIdentity, Principal principal, Set<String> roles)
-
-
Method Detail
-
getMechanismName
public String 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
public String 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
public SecurityIdentity 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
public Set<String> getRoles()
Returns the roles associated with the cached identity.- Returns:
- the roles associated with the cached identity.
-
-