Class UnboundIDExternallyProcessedAuthenticationBindRequest

  • All Implemented Interfaces:
    ReadOnlyLDAPRequest, java.io.Serializable

    @ThreadSafety(level=NOT_THREADSAFE)
    public final class UnboundIDExternallyProcessedAuthenticationBindRequest
    extends SASLBindRequest
    This class provides support for an UnboundID-proprietary SASL mechanism that may be used to indicate that a user has attempted authentication, whether successfully or not, through some mechanism that is external to the Directory Server. If this mechanism is supported in the server, then attempting to authenticate with it will not change the identity of the client connection, but will perform additional processing that would normally be completed during a more traditional authentication attempt.
    NOTE: This class, and other classes within the com.unboundid.ldap.sdk.unboundidds package structure, are only supported for use against Ping Identity, UnboundID, and Nokia/Alcatel-Lucent 8661 server products. These classes provide support for proprietary functionality or for external specifications that are not considered stable or mature enough to be guaranteed to work in an interoperable way with other types of LDAP servers.

    This SASL bind request has a mechanism of "UNBOUNDID-EXTERNALLY-PROCESSED-AUTHENTICATION" and must include SASL credentials with the following encoding:
       ExternallyProcessedAuthenticationCredentials ::= SEQUENCE {
            authenticationID                          [0] OCTET STRING,
            externalMechanismName                     [1] OCTET STRING,
            externalAuthenticationWasSuccessful       [2] BOOLEAN,
            externalAuthenticationFailureReason       [3] OCTET STRING OPTIONAL,
            externalAuthenticationWasPasswordBased    [4] BOOLEAN DEFAULT TRUE,
            externalAuthenticationWasSecure           [5] BOOLEAN DEFAULT FALSE,
            endClientIPAddress                        [6] OCTET STRING OPTIONAL,
            additionalAccessLogProperties             [7] SEQUENCE OF SEQUENCE {
                 propertyName      OCTET STRING,
                 propertyValue     OCTET STRING } OPTIONAL,
            ... }
     


    In the event that the external authentication was considered successful, the server will ensure that the target user's account is in a usable state and, if not, will return a failure response. If the external authentication was successful and the user's account is usable, then the server will make any appropriate password policy state updates (e.g., clearing previous authentication failures, updating the user's last login time and IP address, etc.) and return a success result.

    In the event that the external authentication was not considered successful, the server may also make corresponding password policy state updates (e.g., incrementing the number of authentication failures and locking the account if appropriate) before returning a failure result.
    See Also:
    Serialized Form
    • Constructor Detail

      • UnboundIDExternallyProcessedAuthenticationBindRequest

        public UnboundIDExternallyProcessedAuthenticationBindRequest​(@NotNull
                                                                     java.lang.String authenticationID,
                                                                     @NotNull
                                                                     java.lang.String externalMechanismName,
                                                                     boolean externalAuthWasSuccessful,
                                                                     @Nullable
                                                                     java.lang.String externalAuthFailureReason,
                                                                     boolean externalAuthWasPasswordBased,
                                                                     boolean externalAuthWasSecure,
                                                                     @Nullable
                                                                     java.lang.String endClientIPAddress,
                                                                     @Nullable
                                                                     java.util.Map<java.lang.String,​java.lang.String> additionalAccessLogProperties,
                                                                     @Nullable
                                                                     Control... controls)
        Creates a new UNBOUNDID-EXTERNALLY-PROCESSED-AUTHENTICATION bind request with the provided information.
        Parameters:
        authenticationID - The authentication ID that identifies the user for whom the external authentication processing was performed. This should be either "dn:" followed by the DN of the target user's entry, or "u:" followed by a username. This must not be null.
        externalMechanismName - The name of the mechanism used for the external authentication attempt. This must not be null.
        externalAuthWasSuccessful - Indicates whether the external authentication attempt is considered to have been successful.
        externalAuthFailureReason - The reason that the external authentication attempt was considered a failure. This should be null if the external authentication attempt succeeded, and may be null if the external authentication attempt failed but no failure reason is available.
        externalAuthWasPasswordBased - Indicates whether the external authentication processing involved a password.
        externalAuthWasSecure - Indicates whether the external authentication processing was considered secure. A mechanism should only be considered secure if all credentials were protected in all communication.
        endClientIPAddress - The IPv4 or IPv6 address of the end client involved in the external authentication processing. This may be null if the end client address is not available.
        additionalAccessLogProperties - A map of additional properties that should be recorded in the server's access log for the external authentication attempt. This may be null or empty if no additional access log properties are required.
        controls - The set of controls to include in the request. It may be null or empty if no request controls are needed.
    • Method Detail

      • decodeSASLCredentials

        @NotNull
        public static UnboundIDExternallyProcessedAuthenticationBindRequest decodeSASLCredentials​(@NotNull
                                                                                                  ASN1OctetString saslCredentials,
                                                                                                  @Nullable
                                                                                                  Control... controls)
                                                                                           throws LDAPException
        Creates a new UNBOUNDID-EXTERNALLY-PROCESSED-AUTHENTICATION bind request decoded from the provided information.
        Parameters:
        saslCredentials - The encoded SASL credentials to be decoded. It must not be null.
        controls - The set of controls to include in the request. It may be null or empty if no request controls are needed.
        Returns:
        The decoded UNBOUNDID-EXTERNALLY-PROCESSED-AUTHENTICATION bind request.
        Throws:
        LDAPException - If the provided SASL credentials are not valid for am UNBOUNDID-EXTERNALLY-PROCESSED-AUTHENTICATION bind request
      • getAuthenticationID

        @NotNull
        public java.lang.String getAuthenticationID()
        Retrieves the authentication ID that identifies the user for whom the external authentication processing was performed.
        Returns:
        The authentication ID that identifies the user for whom the external authentication processing was performed.
      • getExternalMechanismName

        @NotNull
        public java.lang.String getExternalMechanismName()
        Retrieves the name of the mechanism used for the external authentication attempt.
        Returns:
        The name of the mechanism used for the external authentication attempt.
      • externalAuthenticationWasSuccessful

        public boolean externalAuthenticationWasSuccessful()
        Indicates whether the external authentication attempt is considered to have been successful.
        Returns:
        true if the external authentication attempt was considered successful, or false if not.
      • getExternalAuthenticationFailureReason

        @Nullable
        public java.lang.String getExternalAuthenticationFailureReason()
        Retrieves the reason that the external authentication attempt was considered a failure, if available.
        Returns:
        The reason that the external authentication attempt was considered a failure, or null if no failure reason is available.
      • externalAuthenticationWasPasswordBased

        public boolean externalAuthenticationWasPasswordBased()
        Indicates whether the external authentication processing involved a password.
        Returns:
        true if the external authentication processing involved a password, or false if not.
      • externalAuthenticationWasSecure

        public boolean externalAuthenticationWasSecure()
        Indicates whether the external authentication processing is considered to have been secure.
        Returns:
        true if the external authentication processing was considered secure, or false if not.
      • getEndClientIPAddress

        @Nullable
        public java.lang.String getEndClientIPAddress()
        Retrieves the IPv4 or IPv6 address of the end client involved in the external authentication processing, if available.
        Returns:
        The IPv4 or IPv6 address of the end client involved in the external authentication processing, or null if this is not available.
      • getAdditionalAccessLogProperties

        @NotNull
        public java.util.Map<java.lang.String,​java.lang.String> getAdditionalAccessLogProperties()
        Retrieves a map of additional properties that should be recorded in the server's access log for the external authentication attempt.
        Returns:
        A map of additional properties that should be recorded in the server's access log for the external authentication attempt, or an empty map if there are no additional log properties.
      • getEncodedCredentials

        @NotNull
        public ASN1OctetString getEncodedCredentials()
        Retrieves an encoded representation of the SASL credentials for this bind request.
        Returns:
        An encoded representation of the SASL credentials for this bind request.
      • process

        @NotNull
        protected BindResult process​(@NotNull
                                     LDAPConnection connection,
                                     int depth)
                              throws LDAPException
        Sends this bind request to the target server over the provided connection and returns the corresponding response.
        Specified by:
        process in class BindRequest
        Parameters:
        connection - The connection to use to send this bind request to the server and read the associated response.
        depth - The current referral depth for this request. It should always be one for the initial request, and should only be incremented when following referrals.
        Returns:
        The bind response read from the server.
        Throws:
        LDAPException - If a problem occurs while sending the request or reading the response.
      • getLastMessageID

        public int getLastMessageID()
        Retrieves the message ID for the last LDAP message sent using this request.
        Overrides:
        getLastMessageID in class SASLBindRequest
        Returns:
        The message ID for the last LDAP message sent using this request, or -1 if it no LDAP messages have yet been sent using this request.
      • getRebindRequest

        @NotNull
        public UnboundIDExternallyProcessedAuthenticationBindRequest getRebindRequest​(@NotNull
                                                                                      java.lang.String host,
                                                                                      int port)
        Retrieves a bind request that may be used to re-bind using the same credentials authentication type and credentials as previously used to perform the initial bind. This may be used in an attempt to automatically re-establish a connection that is lost, or potentially when following a referral to another directory instance.

        It is recommended that all bind request types which implement this capability be implemented so that the elements needed to create a new request are immutable. If this is not done, then changes made to a bind request object may alter the authentication/authorization identity and/or credentials associated with that request so that a rebind request created from it will not match the original request used to authenticate on a connection.
        Overrides:
        getRebindRequest in class BindRequest
        Parameters:
        host - The address of the directory server to which the connection is established.
        port - The port of the directory server to which the connection is established.
        Returns:
        A bind request that may be used to re-bind using the same authentication type and credentials as previously used to perform the initial bind, or null to indicate that automatic re-binding is not supported for this type of bind request.
      • toString

        public void toString​(@NotNull
                             java.lang.StringBuilder buffer)
        Appends a string representation of this request to the provided buffer.
        Specified by:
        toString in interface ReadOnlyLDAPRequest
        Specified by:
        toString in class LDAPRequest
        Parameters:
        buffer - The buffer to which to append a string representation of this request.
      • toCode

        public void toCode​(@NotNull
                           java.util.List<java.lang.String> lineList,
                           @NotNull
                           java.lang.String requestID,
                           int indentSpaces,
                           boolean includeProcessing)
        Appends a number of lines comprising the Java source code that can be used to recreate this request to the given list.
        Specified by:
        toCode in interface ReadOnlyLDAPRequest
        Overrides:
        toCode in class SASLBindRequest
        Parameters:
        lineList - The list to which the source code lines should be added.
        requestID - The name that should be used as an identifier for the request. If this is null or empty, then a generic ID will be used.
        indentSpaces - The number of spaces that should be used to indent the generated code. It must not be negative.
        includeProcessing - Indicates whether the generated code should include code required to actually process the request and handle the result (if true), or just to generate the request (if false).