Class CachedIdentity

    • Field Detail

      • mechanismName

        private final String mechanismName
      • programmatic

        private final boolean programmatic
      • name

        private final String name
    • Constructor Detail

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