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 an IdentityCache.
Author:
Pedro Igor, Paul Ferraro, Darran Lofthouse
See Also:
  • Constructor Details

    • CachedIdentity

      public CachedIdentity(String mechanismName, boolean programmatic, SecurityIdentity securityIdentity)
      Creates a new instance based on the given mechanismName and securityIdentity.
      Parameters:
      mechanismName - the name of the authentication mechanism used to authenticate/authorize the identity
      programmatic - indicates if this identity was created as a result of programmatic authentication
      securityIdentity - the identity to cache
    • CachedIdentity

      public CachedIdentity(String mechanismName, boolean programmatic, Principal principal)
      Creates a new instance based on the given mechanismName and principal.
      Parameters:
      mechanismName - the name of the authentication mechanism used to authenticate/authorize the identity
      programmatic - indicates if this identity was created as a result of programmatic authentication
      principal - 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 given mechanismName and principal.
      Parameters:
      mechanismName - the name of the authentication mechanism used to authenticate/authorize the identity
      programmatic - indicates if this identity was created as a result of programmatic authentication
      principal - the principal of this cached identity
      roles - the roles assigned to this cached identity
  • Method Details

    • 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()
      Returns true 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.
    • toString

      public String toString()
      Overrides:
      toString in class Object