Interface Authentication

  • All Superinterfaces:
    java.io.Serializable

    public interface Authentication
    extends java.io.Serializable

    The Authentication object represents a successful authentication request. It contains the principal that the authentication request was made for as well as the additional meta information such as the authenticated date and a map of attributes.

    An Authentication object must be serializable to permit persistence and clustering.

    Implementing classes must take care to ensure that the Map returned by getAttributes is serializable by using a Serializable map such as HashMap.

    Since:
    3.0.0
    • Method Detail

      • getPrincipal

        Principal getPrincipal()
        Method to obtain the Principal.
        Returns:
        a Principal implementation
      • getAuthenticationDate

        java.time.ZonedDateTime getAuthenticationDate()
        Method to retrieve the timestamp of when this Authentication object was created.
        Returns:
        the date/time the authentication occurred.
      • getAttributes

        java.util.Map<java.lang.String,​java.lang.Object> getAttributes()
        Attributes of the authentication (not the Principal).
        Returns:
        the map of attributes.
      • addAttribute

        void addAttribute​(java.lang.String name,
                          java.lang.Object value)
        Add attribute to the authentication object and update the instance.
        Parameters:
        name - the name
        value - the value
      • getCredentials

        java.util.List<CredentialMetaData> getCredentials()
        Gets a list of metadata about the credentials supplied at authentication time.
        Returns:
        Non -null list of supplied credentials represented as metadata that should be considered safe for long-term storage (e.g. serializable and secure with respect to credential disclosure). The order of items in the returned list SHOULD be the same as the order in which the source credentials were presented and subsequently processed.
      • getSuccesses

        java.util.Map<java.lang.String,​AuthenticationHandlerExecutionResult> getSuccesses()
        Gets a map describing successful authentications produced by AuthenticationHandler components.
        Returns:
        Map of handler names to successful authentication result produced by that handler.
      • getFailures

        java.util.Map<java.lang.String,​java.lang.Throwable> getFailures()
        Gets a map describing failed authentications. By definition the failures here were not sufficient to prevent authentication.
        Returns:
        Map of authentication handler names to the authentication errors produced on attempted authentication.
      • update

        void update​(Authentication authn)
        Updates the authentication object with what's passed. Does not override current keys if there are clashes
        Parameters:
        authn - the authn object
      • updateAll

        void updateAll​(Authentication authn)
        Updates the authentication object with what's passed. Does override current keys if there are clashes. Clears the existing attributes and starts over.
        Parameters:
        authn - the authn object