com.unboundid.ldap.sdk.unboundidds
Class UnboundIDDeliveredOTPBindRequest

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.UnboundIDDeliveredOTPBindRequest
All Implemented Interfaces:
ReadOnlyLDAPRequest, java.io.Serializable

@NotMutable
@ThreadSafety(level=NOT_THREADSAFE)
public final class UnboundIDDeliveredOTPBindRequest
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 allows for multifactor authentication using a one-time password that has been delivered to the user via some out-of-band mechanism as triggered by the DeliverOneTimePasswordExtendedRequest (which requires the user to provide an authentication ID and a static password).

The name for this SASL mechanism is "UNBOUNDID-DELIVERED-OTP". An UNBOUNDID-DELIVERED-OTP SASL bind request MUST include SASL credentials with the following ASN.1 encoding:

   UnboundIDDeliveredOTPCredentials ::= SEQUENCE {
        authenticationID     [0] OCTET STRING,
        authorizationID      [1] OCTET STRING OPTIONAL.
        oneTimePassword      [2] OCTET STRING,
        ... }
 

See Also:
Serialized Form

Field Summary
static java.lang.String UNBOUNDID_DELIVERED_OTP_MECHANISM_NAME
          The name for the UnboundID delivered OTP 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
UnboundIDDeliveredOTPBindRequest(java.lang.String authenticationID, java.lang.String authorizationID, java.lang.String oneTimePassword, Control... controls)
          Creates a new delivered one-time password bind request with the provided information.
 
Method Summary
static UnboundIDDeliveredOTPBindRequest decodeSASLCredentials(ASN1OctetString saslCredentials, Control... controls)
          Creates a new delivered one-time password bind request from the information contained in the provided encoded SASL credentials.
 UnboundIDDeliveredOTPBindRequest duplicate()
          Creates a new instance of this LDAP request that may be modified without impacting this request.
 UnboundIDDeliveredOTPBindRequest duplicate(Control[] controls)
          Creates a new instance of this LDAP request that may be modified without impacting this request.
static ASN1OctetString encodeCredentials(java.lang.String authenticationID, java.lang.String authorizationID, java.lang.String oneTimePassword)
          Encodes the provided information into an ASN.1 octet string that may be used as the SASL credentials for an UnboundID delivered one-time password bind request.
 java.lang.String getAuthenticationID()
          Retrieves the authentication identity for the bind request.
 java.lang.String getAuthorizationID()
          Retrieves the authorization identity for the bind request, if available.
 int getLastMessageID()
          Retrieves the message ID for the last LDAP message sent using this request.
 java.lang.String getOneTimePassword()
          Retrieves the one-time password for the bind request.
 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, getRebindRequest
 
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_DELIVERED_OTP_MECHANISM_NAME

public static final java.lang.String UNBOUNDID_DELIVERED_OTP_MECHANISM_NAME
The name for the UnboundID delivered OTP SASL mechanism.

See Also:
Constant Field Values
Constructor Detail

UnboundIDDeliveredOTPBindRequest

public UnboundIDDeliveredOTPBindRequest(java.lang.String authenticationID,
                                        java.lang.String authorizationID,
                                        java.lang.String oneTimePassword,
                                        Control... controls)
Creates a new delivered one-time password bind request with the provided information.

Parameters:
authenticationID - The authentication identity for the bind request. It must not be null and must in the form "u:" followed by a username, or "dn:" followed by a DN.
authorizationID - The authorization identity for the bind request. It may be null if the authorization identity should be the same as the authentication identity. If an authorization identity is specified, it must be in the form "u:" followed by a username, or "dn:" followed by a DN. The value "dn:" may be used to indicate the authorization identity of the anonymous user.
oneTimePassword - The one-time password that has been delivered to the user via the deliver one-time password extended request. It must not be null.
controls - The set of controls to include in the bind request. It may be null or empty if no controls should be included.
Method Detail

decodeSASLCredentials

public static UnboundIDDeliveredOTPBindRequest decodeSASLCredentials(ASN1OctetString saslCredentials,
                                                                     Control... controls)
                                                              throws LDAPException
Creates a new delivered one-time password bind request from the information contained in the provided encoded SASL credentials.

Parameters:
saslCredentials - The encoded SASL credentials to be decoded in order to create this delivered one-time password bind request. It must not be null.
controls - The set of controls to include in the bind request. It may be null or empty if no controls should be included.
Returns:
The delivered one-time password bind request decoded from the provided credentials.
Throws:
LDAPException - If the provided credentials are not valid for an UNBOUNDID-DELIVERED-OTP bind request.

getAuthenticationID

public java.lang.String getAuthenticationID()
Retrieves the authentication identity for the bind request.

Returns:
The authentication identity for the bind request.

getAuthorizationID

public java.lang.String getAuthorizationID()
Retrieves the authorization identity for the bind request, if available.

Returns:
The authorization identity for the bind request, or null if the authorization identity should be the same as the authentication identity.

getOneTimePassword

public java.lang.String getOneTimePassword()
Retrieves the one-time password for the bind request.

Returns:
The one-time password for the 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.

encodeCredentials

public static ASN1OctetString encodeCredentials(java.lang.String authenticationID,
                                                java.lang.String authorizationID,
                                                java.lang.String oneTimePassword)
Encodes the provided information into an ASN.1 octet string that may be used as the SASL credentials for an UnboundID delivered one-time password bind request.

Parameters:
authenticationID - The authentication identity for the bind request. It must not be null and must in the form "u:" followed by a username, or "dn:" followed by a DN.
authorizationID - The authorization identity for the bind request. It may be null if the authorization identity should be the same as the authentication identity. If an authorization identity is specified, it must be in the form "u:" followed by a username, or "dn:" followed by a DN. The value "dn:" may be used to indicate the authorization identity of the anonymous user.
oneTimePassword - The one-time password that has been delivered to the user via the deliver one-time password extended request. It must not be null.
Returns:
An ASN.1 octet string that may be used as the SASL credentials for an UnboundID delivered one-time password bind request.

duplicate

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

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.

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.

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.