com.unboundid.ldap.sdk.unboundidds
Class SingleUseTOTPBindRequest

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.UnboundIDTOTPBindRequest
                  extended by com.unboundid.ldap.sdk.unboundidds.SingleUseTOTPBindRequest
All Implemented Interfaces:
ReadOnlyLDAPRequest, java.io.Serializable

@NotMutable
@ThreadSafety(level=NOT_THREADSAFE)
public final class SingleUseTOTPBindRequest
extends UnboundIDTOTPBindRequest

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 an implementation of the UNBOUNDID-TOTP SASL bind request that contains a point-in-time version of the one-time password and can be used for a single bind but is not suitable for repeated use. This version of the bind request should be used for authentication in which the one-time password is provided by an external source rather than being generated by the LDAP SDK.

Because the one-time password is provided rather than generated, this version of the bind request is not suitable for cases in which the authentication process may need to be repeated (e.g., for use in a connection pool, following referrals, or if the auto-reconnect feature is enabled), then the reusable variant (supported by the ReusableTOTPBindRequest class) which generates the one-time password should be used instead.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.unboundid.ldap.sdk.unboundidds.UnboundIDTOTPBindRequest
UNBOUNDID_TOTP_MECHANISM_NAME
 
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
SingleUseTOTPBindRequest(java.lang.String authenticationID, java.lang.String authorizationID, java.lang.String totpPassword, byte[] staticPassword, Control... controls)
          Creates a new SASL TOTP bind request with the provided information.
SingleUseTOTPBindRequest(java.lang.String authenticationID, java.lang.String authorizationID, java.lang.String totpPassword, java.lang.String staticPassword, Control... controls)
          Creates a new SASL TOTP bind request with the provided information.
 
Method Summary
static SingleUseTOTPBindRequest decodeSASLCredentials(ASN1OctetString saslCredentials, Control... controls)
          Creates a new single-use TOTP bind request from the information contained in the provided encoded SASL credentials.
 SingleUseTOTPBindRequest duplicate()
          Creates a new instance of this LDAP request that may be modified without impacting this request.
 SingleUseTOTPBindRequest duplicate(Control[] controls)
          Creates a new instance of this LDAP request that may be modified without impacting this request.
 SingleUseTOTPBindRequest 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.
protected  ASN1OctetString getSASLCredentials()
          Retrieves the encoded SASL credentials that may be included in an UNBOUNDID-TOTP SASL bind request.
 java.lang.String getTOTPPassword()
          Retrieves the hard-coded TOTP password to include in the bind request.
 
Methods inherited from class com.unboundid.ldap.sdk.unboundidds.UnboundIDTOTPBindRequest
encodeCredentials, getAuthenticationID, getAuthorizationID, getLastMessageID, getSASLMechanismName, getStaticPassword, process, toString
 
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
 

Constructor Detail

SingleUseTOTPBindRequest

public SingleUseTOTPBindRequest(java.lang.String authenticationID,
                                java.lang.String authorizationID,
                                java.lang.String totpPassword,
                                java.lang.String staticPassword,
                                Control... controls)
Creates a new SASL TOTP bind request with the provided information.

Parameters:
authenticationID - The authentication identity for the bind request. It must not be null, and must be 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 indicate an authorization identity of the anonymous user.
totpPassword - The hard-coded TOTP password to include in the bind request. It must not be null.
staticPassword - The static password for the target user. It may be null if only the one-time password is to be used for authentication (which may or may not be allowed by the server).
controls - The set of controls to include in the bind request.

SingleUseTOTPBindRequest

public SingleUseTOTPBindRequest(java.lang.String authenticationID,
                                java.lang.String authorizationID,
                                java.lang.String totpPassword,
                                byte[] staticPassword,
                                Control... controls)
Creates a new SASL TOTP bind request with the provided information.

Parameters:
authenticationID - The authentication identity for the bind request. It must not be null, and must be 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 indicate an authorization identity of the anonymous user.
totpPassword - The hard-coded TOTP password to include in the bind request. It must not be null.
staticPassword - The static password for the target user. It may be null if only the one-time password is to be used for authentication (which may or may not be allowed by the server).
controls - The set of controls to include in the bind request.
Method Detail

decodeSASLCredentials

public static SingleUseTOTPBindRequest decodeSASLCredentials(ASN1OctetString saslCredentials,
                                                             Control... controls)
                                                      throws LDAPException
Creates a new single-use TOTP 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 single-use TOTP bind request. It must not be null.
controls - The set of controls to include in the bind request.
Returns:
The single-use TOTP bind request decoded from the provided credentials.
Throws:
LDAPException - If the provided credentials are not valid for an UNBOUNDID-TOTP bind request.

getTOTPPassword

public java.lang.String getTOTPPassword()
Retrieves the hard-coded TOTP password to include in the bind request.

Returns:
The hard-coded TOTP password to include in the bind request.

getSASLCredentials

protected ASN1OctetString getSASLCredentials()
Retrieves the encoded SASL credentials that may be included in an UNBOUNDID-TOTP SASL bind request.

Specified by:
getSASLCredentials in class UnboundIDTOTPBindRequest
Returns:
The encoded SASL credentials that may be included in an UNBOUNDID-TOTP SASL bind request.

getRebindRequest

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

duplicate

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