Class DefaultAuthentication

java.lang.Object
org.tentackle.session.auth.DefaultAuthentication
All Implemented Interfaces:
Serializable, Authentication

@TripReferencable("NEVER") public class DefaultAuthentication extends Object implements Authentication
The default implementation of an Authentication.
Author:
harald
See Also:
  • Constructor Details

    • DefaultAuthentication

      public DefaultAuthentication(String name, Credentials credentials)
      Creates an authentication.
      Parameters:
      name - the principal's name, null if unknown
      credentials - the verified credentials
    • DefaultAuthentication

      public DefaultAuthentication()
      Creates an empty authentication.
      Required by TRIP, should an application send an authentication to a client.
  • Method Details

    • getName

      public String getName()
      Description copied from interface: Authentication
      Gets the name of the authenticated principal.

      The username for a password login, the token's subject, or preferred username for a token login. It is copied to the session info after a successful login, so it is the name the application and its audit trail will see.

      Specified by:
      getName in interface Authentication
      Returns:
      the principal's name, null if unknown
    • getCredentials

      public Credentials getCredentials()
      Description copied from interface: Authentication
      Gets the credentials that were verified.
      Specified by:
      getCredentials in interface Authentication
      Returns:
      the credentials, never null
    • getProviderName

      public String getProviderName()
      Description copied from interface: Authentication
      Gets the name of the provider that authenticated the credentials.
      Specified by:
      getProviderName in interface Authentication
      Returns:
      the provider name, null if unknown
    • setProviderName

      public void setProviderName(String providerName)
      Sets the name of the provider that authenticated the credentials.
      Parameters:
      providerName - the provider name
    • getAttributes

      public Map<String,Object> getAttributes()
      Description copied from interface: Authentication
      Gets the attributes describing the principal.

      For a token login these are typically the verified claims. The map is a convenient place for a UserResolver to look up the application's user, and for the application's SecurityManager to derive additional grantees.

      Specified by:
      getAttributes in interface Authentication
      Returns:
      the attributes, never null
    • getRoles

      public Set<String> getRoles()
      Description copied from interface: Authentication
      Gets the roles or groups asserted by the identity provider.

      These are the external roles, not Tentackle's security rules. It is up to the application to map them onto its own grantees.

      Specified by:
      getRoles in interface Authentication
      Returns:
      the roles, never null
    • getExpiresAt

      public long getExpiresAt()
      Description copied from interface: Authentication
      Gets the epochal time this authentication expires.
      Specified by:
      getExpiresAt in interface Authentication
      Returns:
      the expiry in epochal millis, 0 if it does not expire
    • setExpiresAt

      public void setExpiresAt(long expiresAt)
      Sets the epochal time this authentication expires.
      Parameters:
      expiresAt - the expiry in epochal millis, 0 if it does not expire
    • getUserId

      public long getUserId()
      Description copied from interface: Authentication
      Gets the object id of the authenticated user.
      Specified by:
      getUserId in interface Authentication
      Returns:
      the user id, 0 if not resolved yet
    • setUserId

      public void setUserId(long userId)
      Description copied from interface: Authentication
      Sets the object id of the authenticated user.
      Specified by:
      setUserId in interface Authentication
      Parameters:
      userId - the user id
    • getUserClassId

      public int getUserClassId()
      Description copied from interface: Authentication
      Gets the class id of the authenticated user.
      Specified by:
      getUserClassId in interface Authentication
      Returns:
      the user class id, 0 if not resolved yet
    • setUserClassId

      public void setUserClassId(int userClassId)
      Description copied from interface: Authentication
      Sets the class id of the authenticated user.
      Specified by:
      setUserClassId in interface Authentication
      Parameters:
      userClassId - the user class id
    • toString

      public String toString()
      Overrides:
      toString in class Object