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 String
mechanismName
private String
name
private boolean
programmatic
private Set<String>
roles
private SecurityIdentity
securityIdentity
private static long
serialVersionUID
-
Constructor Summary
Constructors Modifier Constructor Description CachedIdentity(String mechanismName, boolean programmatic, Principal principal)
Creates a new instance based on the givenmechanismName
andprincipal
.CachedIdentity(String mechanismName, boolean programmatic, Principal principal, Set<String> roles)
Creates a new instance based on the givenmechanismName
andprincipal
.CachedIdentity(String mechanismName, boolean programmatic, SecurityIdentity securityIdentity)
Creates a new instance based on the givenmechanismName
andsecurityIdentity
.private
CachedIdentity(String mechanismName, boolean programmatic, SecurityIdentity securityIdentity, Principal principal)
private
CachedIdentity(String mechanismName, boolean programmatic, SecurityIdentity securityIdentity, Principal principal, Set<String> roles)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getMechanismName()
Returns the name of the authentication mechanism used to authenticate/authorize the identity.String
getName()
Returns the principal name associated with the cached identity.Set<String>
getRoles()
Returns the roles associated with the cached identity.SecurityIdentity
getSecurityIdentity()
Returns the identity represented by this instance.boolean
isProgrammatic()
Returnstrue
if this identity was established using programmatic authentication,false
otherwise.String
toString()
-
-
-
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 givenmechanismName
andsecurityIdentity
.- 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 givenmechanismName
andprincipal
.- 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 givenmechanismName
andprincipal
.- 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
null
in case the cache is holding the principal name only
-
isProgrammatic
public boolean isProgrammatic()
Returnstrue
if this identity was established using programmatic authentication,false
otherwise.- Returns:
true
if this identity was established using programmatic authentication,false
otherwise.
-
getRoles
public Set<String> getRoles()
Returns the roles associated with the cached identity.- Returns:
- the roles associated with the cached identity.
-
-