Class BindRequest

java.lang.Object
com.unboundid.ldap.sdk.LDAPRequest
com.unboundid.ldap.sdk.BindRequest
All Implemented Interfaces:
ReadOnlyLDAPRequest, Serializable
Direct Known Subclasses:
SASLBindRequest, SimpleBindRequest

This class provides an API that is used to represent an LDAP bind request. It should be extended by subclasses that provide the logic for processing specific types of bind operations (e.g., simple binds, and the various SASL mechanisms).

It is strongly recommended that all bind request types which implement the rebind capability be made 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. Note, however, that it is not threadsafe to use the same BindRequest object to attempt to bind concurrently over multiple connections.

Note that even though this class is marked with the @Extensible annotation type, it should not be directly subclassed by third-party code. Only the SASLBindRequest subclass is actually intended to be extended by third-party code.
See Also:
  • Field Details

  • Constructor Details

    • BindRequest

      protected BindRequest(@Nullable Control[] controls)
      Creates a new bind request with the provided set of controls.
      Parameters:
      controls - The set of controls to include in this bind request.
  • Method Details

    • process

      @NotNull protected abstract 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 LDAPRequest
      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.
    • getOperationType

      Retrieves the type of operation that is represented by this request.
      Specified by:
      getOperationType in class LDAPRequest
      Returns:
      The type of operation that is represented by this request.
    • getBindType

      @NotNull public abstract String getBindType()
      Retrieves a human-readable string that describes the type of bind request.
      Returns:
      A human-readable string that describes the type of bind request.
    • duplicate

      @NotNull public abstract BindRequest duplicate()
      Creates a new instance of this LDAP request that may be modified without impacting this request.
      Returns:
      A new instance of this LDAP request that may be modified without impacting this request.
    • duplicate

      @NotNull public abstract BindRequest duplicate(@Nullable Control[] controls)
      Creates a new instance of this LDAP request that may be modified without impacting this request. The provided controls will be used for the new request instead of duplicating the controls from this request.
      Parameters:
      controls - The set of controls to include in the duplicate request.
      Returns:
      A new instance of this LDAP request that may be modified without impacting this request.
    • getRebindRequest

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