Class AuthenticationInfo


  • @PublicAPI(stability=UNCOMMITTED,
               mayInstantiate=true,
               mayInvoke=true)
    public final class AuthenticationInfo
    extends Object
    This class defines a data structure that may be used to store information about an authenticated user. Note that structures in this class allow for multiple authentication types for the same user, which is not currently supported by LDAP but may be offered through some type of extension.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static AuthenticationInfo anonymous()
      Creates a new set of authentication information to be used for unauthenticated clients.
      AuthenticationInfo duplicate​(Entry newAuthenticationEntry, Entry newAuthorizationEntry)
      Creates a duplicate of this AuthenticationInfo object with the new authentication and authorization entries.
      Dn getAuthenticationDN()
      Retrieves the DN of the user as whom the client is authenticated.
      Entry getAuthenticationEntry()
      Retrieves the entry for the user as whom the client is authenticated.
      Dn getAuthorizationDN()
      Retrieves the DN for the user that should be used as the default authorization identity.
      Entry getAuthorizationEntry()
      Retrieves the entry for the user that should be used as the default authorization identity.
      boolean hasAuthenticationType​(AuthenticationType authenticationType)
      Indicates whether this client has authenticated using the specified authentication type.
      boolean hasSASLMechanism​(String saslMechanism)
      Indicates whether the client is currently authenticated using the specified SASL mechanism.
      static AuthenticationInfo internal​(Entry authenticationEntry)
      Creates a new set of authentication information to be used for clients that are authenticated internally.
      boolean isAuthenticated()
      Indicates whether this client has successfully authenticated to the server.
      boolean mustChangePassword()
      Indicates whether the authenticated user must change his/her password before any other operation will be allowed.
      static AuthenticationInfo sasl​(Entry authenticationEntry, String saslMechanism)
      Creates a new set of authentication information to be used for clients that have authenticated using a SASL mechanism.
      static AuthenticationInfo sasl​(Entry authenticationEntry, Entry authorizationEntry, String saslMechanism)
      Creates a new set of authentication information to be used for clients that have authenticated using a SASL mechanism.
      void setAuthenticationDN​(Dn dn)
      Sets the DN of the user as whom the client is authenticated, does nothing if the client is unauthenticated.
      void setAuthorizationDN​(Dn dn)
      Sets the DN for the user that should be used as the default authorization identity, does nothing if the client is unauthorized.
      void setMustChangePassword​(boolean mustChangePassword)
      Specifies whether the authenticated user must change his/her password before any other operation will be allowed.
      static AuthenticationInfo simple​(Entry authenticationEntry)
      Creates a new set of authentication information to be used for clients that have successfully performed simple authentication.
      String toString()
      Retrieves a string representation of this authentication info structure.
    • Method Detail

      • anonymous

        public static AuthenticationInfo anonymous()
        Creates a new set of authentication information to be used for unauthenticated clients.
        Returns:
        The new authentication information.
      • internal

        public static AuthenticationInfo internal​(Entry authenticationEntry)
        Creates a new set of authentication information to be used for clients that are authenticated internally.
        Parameters:
        authenticationEntry - The entry of the user that has authenticated, or null to indicate an unauthenticated user.
        Returns:
        The new authentication information.
      • simple

        public static AuthenticationInfo simple​(Entry authenticationEntry)
        Creates a new set of authentication information to be used for clients that have successfully performed simple authentication.
        Parameters:
        authenticationEntry - The entry of the user that has authenticated. It must not be null.
        Returns:
        The new authentication information.
      • sasl

        public static AuthenticationInfo sasl​(Entry authenticationEntry,
                                              String saslMechanism)
        Creates a new set of authentication information to be used for clients that have authenticated using a SASL mechanism.
        Parameters:
        authenticationEntry - The entry of the user that has authenticated. It must not be null.
        saslMechanism - The SASL mechanism used to authenticate. This must be provided in all-uppercase characters and must not be null.
        Returns:
        The new authentication information.
      • sasl

        public static AuthenticationInfo sasl​(Entry authenticationEntry,
                                              Entry authorizationEntry,
                                              String saslMechanism)
        Creates a new set of authentication information to be used for clients that have authenticated using a SASL mechanism.
        Parameters:
        authenticationEntry - The entry of the user that has authenticated. It must not be null.
        authorizationEntry - The entry of the user that will be used as the default authorization identity, or null to indicate that the authorization identity should be the unauthenticated user.
        saslMechanism - The SASL mechanism used to authenticate. This must be provided in all-uppercase characters and must not be null.
        Returns:
        The new authentication information.
      • isAuthenticated

        public boolean isAuthenticated()
        Indicates whether this client has successfully authenticated to the server.
        Returns:
        true if this client has successfully authenticated to the server, or false if not.
      • mustChangePassword

        public boolean mustChangePassword()
        Indicates whether the authenticated user must change his/her password before any other operation will be allowed.
        Returns:
        true if the user must change his/her password before any other operation will be allowed, or false if not.
      • setMustChangePassword

        public void setMustChangePassword​(boolean mustChangePassword)
        Specifies whether the authenticated user must change his/her password before any other operation will be allowed.
        Parameters:
        mustChangePassword - Specifies whether the authenticated user must change his/her password before any other operation will be allowed.
      • hasAuthenticationType

        public boolean hasAuthenticationType​(AuthenticationType authenticationType)
        Indicates whether this client has authenticated using the specified authentication type.
        Parameters:
        authenticationType - The authentication type for which to make the determination.
        Returns:
        true if the client has authenticated using the specified authentication type, or false if not.
      • getAuthenticationEntry

        public Entry getAuthenticationEntry()
        Retrieves the entry for the user as whom the client is authenticated.
        Returns:
        The entry for the user as whom the client is authenticated, or null if the client is unauthenticated.
      • getAuthenticationDN

        public Dn getAuthenticationDN()
        Retrieves the DN of the user as whom the client is authenticated.
        Returns:
        The DN of the user as whom the client is authenticated, or null if the client is unauthenticated.
      • setAuthenticationDN

        public void setAuthenticationDN​(Dn dn)
        Sets the DN of the user as whom the client is authenticated, does nothing if the client is unauthenticated.
        Parameters:
        dn - authentication identity DN.
      • getAuthorizationEntry

        public Entry getAuthorizationEntry()
        Retrieves the entry for the user that should be used as the default authorization identity.
        Returns:
        The entry for the user that should be used as the default authorization identity, or null if the authorization identity should be the unauthenticated user.
      • getAuthorizationDN

        public Dn getAuthorizationDN()
        Retrieves the DN for the user that should be used as the default authorization identity.
        Returns:
        The DN for the user that should be used as the default authorization identity, or null if the authorization identity should be the unauthenticated user.
      • setAuthorizationDN

        public void setAuthorizationDN​(Dn dn)
        Sets the DN for the user that should be used as the default authorization identity, does nothing if the client is unauthorized.
        Parameters:
        dn - authorization identity DN.
      • hasSASLMechanism

        public boolean hasSASLMechanism​(String saslMechanism)
        Indicates whether the client is currently authenticated using the specified SASL mechanism.
        Parameters:
        saslMechanism - The SASL mechanism for which to make the determination. Note that this must be provided in all uppercase characters.
        Returns:
        true if the client is authenticated using the specified SASL mechanism, or false if not.
      • toString

        public String toString()
        Retrieves a string representation of this authentication info structure.
        Overrides:
        toString in class Object
        Returns:
        A string representation of this authentication info structure.
      • duplicate

        public AuthenticationInfo duplicate​(Entry newAuthenticationEntry,
                                            Entry newAuthorizationEntry)
        Creates a duplicate of this AuthenticationInfo object with the new authentication and authorization entries.
        Parameters:
        newAuthenticationEntry - The updated entry for the user as whom the associated client connection is authenticated.
        newAuthorizationEntry - The updated entry for the default authorization identity for the associated client connection.
        Returns:
        The duplicate of this AuthenticationInfo object with the specified authentication and authorization entries.