com.unboundid.ldap.sdk.unboundidds
Class UnboundIDCertificatePlusPasswordBindRequest

java.lang.Object
  extended by com.unboundid.ldap.sdk.LDAPRequest
      extended by com.unboundid.ldap.sdk.BindRequest
          extended by com.unboundid.ldap.sdk.SASLBindRequest
              extended by com.unboundid.ldap.sdk.unboundidds.UnboundIDCertificatePlusPasswordBindRequest
All Implemented Interfaces:
ReadOnlyLDAPRequest, java.io.Serializable

@ThreadSafety(level=NOT_THREADSAFE)
public final class UnboundIDCertificatePlusPasswordBindRequest
extends SASLBindRequest

NOTE: This class is part of the Commercial Edition of the UnboundID LDAP SDK for Java. It is not available for use in applications that include only the Standard Edition of the LDAP SDK, and is not supported for use in conjunction with non-UnboundID products.
This class provides support for an UnboundID-proprietary SASL mechanism that provides multifactor authentication using the combination of a client certificate (presented during SSL/TLS negotiation) and a static password.

The name for this SASL mechanism is "UNBOUNDID-CERTIFICATE-PLUS-PASSWORD". The SASL credentials consist simply of the static password for the user identified by the certificate, to make the SASL mechanism as easy as possible to use from other client APIs.

See Also:
Serialized Form

Field Summary
static java.lang.String UNBOUNDID_CERT_PLUS_PW_MECHANISM_NAME
          The name for the UnboundID certificate plus password SASL mechanism.
 
Fields inherited from class com.unboundid.ldap.sdk.SASLBindRequest
CRED_TYPE_SASL
 
Fields inherited from class com.unboundid.ldap.sdk.BindRequest
VERSION_ELEMENT
 
Constructor Summary
UnboundIDCertificatePlusPasswordBindRequest(byte[] password, Control... controls)
          Creates a new certificate plus password bind request with the provided information.
UnboundIDCertificatePlusPasswordBindRequest(java.lang.String password, Control... controls)
          Creates a new certificate plus password bind request with the provided information.
 
Method Summary
 UnboundIDCertificatePlusPasswordBindRequest duplicate()
          Creates a new instance of this LDAP request that may be modified without impacting this request.
 UnboundIDCertificatePlusPasswordBindRequest duplicate(Control[] controls)
          Creates a new instance of this LDAP request that may be modified without impacting this request.
 int getLastMessageID()
          Retrieves the message ID for the last LDAP message sent using this request.
 ASN1OctetString getPassword()
          Retrieves the password to use to authenticate as the user identified by the certificate.
 UnboundIDCertificatePlusPasswordBindRequest getRebindRequest(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.
 java.lang.String getSASLMechanismName()
          Retrieves the name of the SASL mechanism used in this SASL bind request.
protected  BindResult process(LDAPConnection connection, int depth)
          Sends this bind request to the target server over the provided connection and returns the corresponding response.
 void toString(java.lang.StringBuilder buffer)
          Appends a string representation of this request to the provided buffer.
 
Methods inherited from class com.unboundid.ldap.sdk.SASLBindRequest
getBindType, responseReceived, sendBindRequest, sendMessage
 
Methods inherited from class com.unboundid.ldap.sdk.BindRequest
getOperationType
 
Methods inherited from class com.unboundid.ldap.sdk.LDAPRequest
followReferrals, getControl, getControlList, getControls, getIntermediateResponseListener, getResponseTimeoutMillis, hasControl, hasControl, setFollowReferrals, setIntermediateResponseListener, setResponseTimeoutMillis, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNBOUNDID_CERT_PLUS_PW_MECHANISM_NAME

public static final java.lang.String UNBOUNDID_CERT_PLUS_PW_MECHANISM_NAME
The name for the UnboundID certificate plus password SASL mechanism.

See Also:
Constant Field Values
Constructor Detail

UnboundIDCertificatePlusPasswordBindRequest

public UnboundIDCertificatePlusPasswordBindRequest(java.lang.String password,
                                                   Control... controls)
Creates a new certificate plus password bind request with the provided information.

Parameters:
password - The password to use to authenticate as user identified by the certificate. It must not be null or empty.
controls - The set of controls to include in the bind request. It may be null or empty if no request controls are needed.

UnboundIDCertificatePlusPasswordBindRequest

public UnboundIDCertificatePlusPasswordBindRequest(byte[] password,
                                                   Control... controls)
Creates a new certificate plus password bind request with the provided information.

Parameters:
password - The password to use to authenticate as user identified by the certificate. It must not be null or empty.
controls - The set of controls to include in the bind request. It may be null or empty if no request controls are needed.
Method Detail

getPassword

public ASN1OctetString getPassword()
Retrieves the password to use to authenticate as the user identified by the certificate.

Returns:
The password to use to authenticate as the user identified by the certificate.

getSASLMechanismName

public java.lang.String getSASLMechanismName()
Retrieves the name of the SASL mechanism used in this SASL bind request.

Specified by:
getSASLMechanismName in class SASLBindRequest
Returns:
The name of the SASL mechanism used in this SASL bind request.

process

protected BindResult process(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.

duplicate

public UnboundIDCertificatePlusPasswordBindRequest duplicate()
Creates a new instance of this LDAP request that may be modified without impacting this request.

Specified by:
duplicate in interface ReadOnlyLDAPRequest
Specified by:
duplicate in class BindRequest
Returns:
A new instance of this LDAP request that may be modified without impacting this request.

duplicate

public UnboundIDCertificatePlusPasswordBindRequest duplicate(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.

Specified by:
duplicate in interface ReadOnlyLDAPRequest
Specified by:
duplicate in class BindRequest
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

public UnboundIDCertificatePlusPasswordBindRequest getRebindRequest(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(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.