Interface SimpleBindRequest

All Superinterfaces:
BindRequest, Request

public interface SimpleBindRequest extends BindRequest
The simple authentication method of the Bind Operation provides three authentication mechanisms:
  • An anonymous authentication mechanism, in which both the name and password are zero length.
  • An unauthenticated authentication mechanism using credentials consisting of a name and a zero length password.
  • A name/password authentication mechanism using credentials consisting of a name and a password.
Requests has methods to create a SimpleBindRequest.
 String bindDN = ...;
 char[] bindPassword = ...;

 SimpleBindRequest sbr = Requests.newSimpleBindRequest(bindDN, bindPassword);
 
Alternatively, use Connection.bind.
 Connection connection;
 String bindDN = ...;
 char[] bindPassword = ...;

 connection.bind(bindDN, bindPassword);
 
  • Method Details

    • addControl

      Description copied from interface: Request
      Adds the provided control to this request.
      Specified by:
      addControl in interface BindRequest
      Specified by:
      addControl in interface Request
      Parameters:
      control - The control to be added to this request.
      Returns:
      This request.
    • createBindClient

      Description copied from interface: BindRequest
      Creates a new bind client which can be used to perform the authentication process. This method is called by protocol implementations and is not intended for use by applications.
      Specified by:
      createBindClient in interface BindRequest
      Parameters:
      serverName - The non-null fully-qualified host name of the server to authenticate to.
      Returns:
      The new bind client.
      Throws:
      LdapException - If an error occurred while creating the bind client context.
    • getAuthenticationType

      Returns the authentication mechanism identifier for this simple bind request as defined by the LDAP protocol, which is always 0x80.
      Specified by:
      getAuthenticationType in interface BindRequest
      Returns:
      The authentication mechanism identifier.
    • getControl

      <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) throws DecodeException
      Description copied from interface: Request
      Decodes and returns the first control in this request having an OID corresponding to the provided control decoder.
      Specified by:
      getControl in interface BindRequest
      Specified by:
      getControl in interface Request
      Type Parameters:
      C - The type of control to be decoded and returned.
      Parameters:
      decoder - The control decoder.
      options - The set of decode options which should be used when decoding the control.
      Returns:
      The decoded control, or null if the control is not included with this request.
      Throws:
      DecodeException - If the control could not be decoded because it was malformed in some way (e.g. the control value was missing, or its content could not be decoded).
    • getControls

      Description copied from interface: Request
      Returns a List containing the controls included with this request. The returned List may be modified if permitted by this request.
      Specified by:
      getControls in interface BindRequest
      Specified by:
      getControls in interface Request
      Returns:
      A List containing the controls.
    • getName

      Description copied from interface: BindRequest
      Returns the name of the Directory object that the client wishes to bind as. The name may be empty (but never null) when used for anonymous binds, or when using SASL authentication. The server shall not dereference any aliases in locating the named object.

      The LDAP protocol defines the Bind name to be a distinguished name, however some LDAP implementations have relaxed this constraint and allow other identities to be used, such as the user's email address.

      Specified by:
      getName in interface BindRequest
      Returns:
      The name of the Directory object that the client wishes to bind as.
    • getPassword

      byte[] getPassword()
      Returns the password of the Directory object that the client wishes to bind as. The password may be empty (but never null) when used for of anonymous or unauthenticated binds.

      Unless otherwise indicated, implementations will store a reference to the returned password byte array, allowing applications to overwrite the password after it has been used.

      Returns:
      The password of the Directory object that the client wishes to bind as.
    • setName

      Sets the name of the Directory object that the client wishes to bind as. The name may be empty (but never null when used for of anonymous binds, or when using SASL authentication. The server shall not dereference any aliases in locating the named object.

      The LDAP protocol defines the Bind name to be a distinguished name, however some LDAP implementations have relaxed this constraint and allow other identities to be used, such as the user's email address.

      Parameters:
      name - The name of the Directory object that the client wishes to bind as.
      Returns:
      This bind request.
      Throws:
      UnsupportedOperationException - If this bind request does not permit the distinguished name to be set.
      NullPointerException - If name was null.
    • setPassword

      SimpleBindRequest setPassword(byte[] password)
      Sets the password of the Directory object that the client wishes to bind as. The password may be empty (but never null) when used for of anonymous or unauthenticated binds.

      Unless otherwise indicated, implementations will store a reference to the provided password byte array, allowing applications to overwrite the password after it has been used.

      Parameters:
      password - The password of the Directory object that the client wishes to bind as, which may be empty.
      Returns:
      This simple bind request.
      Throws:
      UnsupportedOperationException - If this simple bind request does not permit the password to be set.
      NullPointerException - If password was null.
    • setPassword

      SimpleBindRequest setPassword(char[] password)
      Sets the password of the Directory object that the client wishes to bind as. The password will be converted to a UTF-8 octet string. The password may be empty (but never null) when used for of anonymous or unauthenticated binds. Subsequent modifications to the password array will not alter this bind request.
      Parameters:
      password - The password of the Directory object that the client wishes to bind as, which may be empty.
      Returns:
      This simple bind request.
      Throws:
      UnsupportedOperationException - If this simple bind request does not permit the password to be set.
      NullPointerException - If password was null.