Record Class AuthenticationInfo

java.lang.Object
java.lang.Record
org.opends.server.types.AuthenticationInfo
Record Components:
authenticationEntry - The entry of the user that is currently authenticated, or null if the client is unauthenticated.
authorizationEntry - The entry of the user that will be used as the default authorization identity, or null if the authorization identity should be the unauthenticated user
authenticationType - The type of authentication performed on this connection
saslMechanism - The uppercased SASL mechanism used to authenticate.

public record AuthenticationInfo(Entry authenticationEntry, Entry authorizationEntry, AuthenticationType authenticationType, String saslMechanism) extends Record
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.
  • Constructor Details

    • AuthenticationInfo

      public AuthenticationInfo(Entry authenticationEntry, Entry authorizationEntry, AuthenticationType authenticationType, String saslMechanism)
      Builds an AuthenticationInfo object.
  • Method Details

    • 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.
    • 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.
    • 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.
    • toString

      public String toString()
      Retrieves a string representation of this authentication info structure.
      Specified by:
      toString in class Record
      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.
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • authenticationEntry

      public Entry authenticationEntry()
      Returns the value of the authenticationEntry record component.
      Returns:
      the value of the authenticationEntry record component
    • authorizationEntry

      public Entry authorizationEntry()
      Returns the value of the authorizationEntry record component.
      Returns:
      the value of the authorizationEntry record component
    • authenticationType

      public AuthenticationType authenticationType()
      Returns the value of the authenticationType record component.
      Returns:
      the value of the authenticationType record component
    • saslMechanism

      public String saslMechanism()
      Returns the value of the saslMechanism record component.
      Returns:
      the value of the saslMechanism record component