Class ReusableTOTPBindRequest
java.lang.Object
com.unboundid.ldap.sdk.LDAPRequest
com.unboundid.ldap.sdk.BindRequest
com.unboundid.ldap.sdk.SASLBindRequest
com.unboundid.ldap.sdk.unboundidds.UnboundIDTOTPBindRequest
com.unboundid.ldap.sdk.unboundidds.ReusableTOTPBindRequest
- All Implemented Interfaces:
ReadOnlyLDAPRequest,Serializable
@NotMutable
@ThreadSafety(level=NOT_THREADSAFE)
public final class ReusableTOTPBindRequest
extends UnboundIDTOTPBindRequest
This class provides an implementation of the UNBOUNDID-TOTP SASL bind request
that may be used to repeatedly generate one-time password values. Because it
is configured with the shared secret rather than a point-in-time version of
the password, it can be used 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). If the shared
secret is not known and the one-time password will be provided from an
external source (e.g., entered by a user), then the
SingleUseTOTPBindRequest variant should be used instead.
NOTE: This class, and other classes within the
com.unboundid.ldap.sdk.unboundidds package structure, are only
supported for use against Ping Identity, UnboundID, and
Nokia/Alcatel-Lucent 8661 server products. These classes provide support
for proprietary functionality or for external specifications that are not
considered stable or mature enough to be guaranteed to work in an
interoperable way with other types of LDAP servers.
- See Also:
-
Field Summary
Fields inherited from class com.unboundid.ldap.sdk.unboundidds.UnboundIDTOTPBindRequest
UNBOUNDID_TOTP_MECHANISM_NAMEFields inherited from class com.unboundid.ldap.sdk.SASLBindRequest
CRED_TYPE_SASLFields inherited from class com.unboundid.ldap.sdk.BindRequest
VERSION_ELEMENT -
Constructor Summary
ConstructorsConstructorDescriptionReusableTOTPBindRequest(String authenticationID, String authorizationID, byte[] sharedSecret, byte[] staticPassword, int totpIntervalDurationSeconds, int totpNumDigits, Control... controls) Creates a new SASL TOTP bind request with the provided information.ReusableTOTPBindRequest(String authenticationID, String authorizationID, byte[] sharedSecret, byte[] staticPassword, Control... controls) Creates a new SASL TOTP bind request with the provided information.ReusableTOTPBindRequest(String authenticationID, String authorizationID, byte[] sharedSecret, String staticPassword, int totpIntervalDurationSeconds, int totpNumDigits, Control... controls) Creates a new SASL TOTP bind request with the provided information.ReusableTOTPBindRequest(String authenticationID, String authorizationID, byte[] sharedSecret, String staticPassword, Control... controls) Creates a new SASL TOTP bind request with the provided information. -
Method Summary
Modifier and TypeMethodDescriptionCreates a new instance of this LDAP request that may be modified without impacting this request.Creates a new instance of this LDAP request that may be modified without impacting this request.getRebindRequest(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 ASN1OctetStringRetrieves the encoded SASL credentials that may be included in an UNBOUNDID-TOTP SASL bind request.byte[]Retrieves the shared secret key to use when generating the TOTP password.intRetrieves the duration (in seconds) of the time interval to use when generating the TOTP password.intRetrieves the number of digits to include in the generated TOTP password.voidAppends a number of lines comprising the Java source code that can be used to recreate this request to the given list.Methods inherited from class com.unboundid.ldap.sdk.unboundidds.UnboundIDTOTPBindRequest
encodeCredentials, getAuthenticationID, getAuthorizationID, getLastMessageID, getSASLMechanismName, getStaticPassword, process, toStringMethods inherited from class com.unboundid.ldap.sdk.SASLBindRequest
getBindType, responseReceived, sendBindRequest, sendMessageMethods inherited from class com.unboundid.ldap.sdk.BindRequest
getOperationTypeMethods inherited from class com.unboundid.ldap.sdk.LDAPRequest
followReferrals, getControl, getControlList, getControls, getIntermediateResponseListener, getReferralConnector, getReferralConnectorInternal, getReferralDepth, getResponseTimeoutMillis, hasControl, hasControl, setFollowReferrals, setIntermediateResponseListener, setReferralConnector, setReferralDepth, setResponseTimeoutMillis, toString
-
Constructor Details
-
ReusableTOTPBindRequest
public ReusableTOTPBindRequest(@NotNull String authenticationID, @Nullable String authorizationID, @NotNull byte[] sharedSecret, @Nullable String staticPassword, @Nullable 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 benull, 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 benullif 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.sharedSecret- The shared secret key to use when generating the TOTP password.staticPassword- The static password for the target user. It may benullif 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.
-
ReusableTOTPBindRequest
public ReusableTOTPBindRequest(@NotNull String authenticationID, @Nullable String authorizationID, @NotNull byte[] sharedSecret, @Nullable byte[] staticPassword, @Nullable 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 benull, 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 benullif 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.sharedSecret- The shared secret key to use when generating the TOTP password.staticPassword- The static password for the target user. It may benullif 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.
-
ReusableTOTPBindRequest
public ReusableTOTPBindRequest(@NotNull String authenticationID, @Nullable String authorizationID, @NotNull byte[] sharedSecret, @Nullable String staticPassword, int totpIntervalDurationSeconds, int totpNumDigits, @Nullable 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 benull, 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 benullif 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.sharedSecret- The shared secret key to use when generating the TOTP password.staticPassword- The static password for the target user. It may benullif only the one-time password is to be used for authentication (which may or may not be allowed by the server).totpIntervalDurationSeconds- The duration (in seconds) of the time interval to use for TOTP processing. It must be greater than zero.totpNumDigits- The number of digits to include in the generated TOTP password. It must be greater than or equal to six and less than or equal to eight.controls- The set of controls to include in the bind request.
-
ReusableTOTPBindRequest
public ReusableTOTPBindRequest(@NotNull String authenticationID, @Nullable String authorizationID, @NotNull byte[] sharedSecret, @Nullable byte[] staticPassword, int totpIntervalDurationSeconds, int totpNumDigits, @Nullable 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 benull, 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 benullif 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.sharedSecret- The shared secret key to use when generating the TOTP password.staticPassword- The static password for the target user. It may benullif only the one-time password is to be used for authentication (which may or may not be allowed by the server).totpIntervalDurationSeconds- The duration (in seconds) of the time interval to use for TOTP processing. It must be greater than zero.totpNumDigits- The number of digits to include in the generated TOTP password. It must be greater than or equal to six and less than or equal to eight.controls- The set of controls to include in the bind request.
-
-
Method Details
-
getTOTPIntervalDurationSeconds
Retrieves the duration (in seconds) of the time interval to use when generating the TOTP password.- Returns:
- The duration (in seconds) of the time interval to use when generating the TOTP password.
-
getTOTPNumDigits
Retrieves the number of digits to include in the generated TOTP password.- Returns:
- The number of digits to include in the generated TOTP password.
-
getSASLCredentials
Retrieves the encoded SASL credentials that may be included in an UNBOUNDID-TOTP SASL bind request.- Specified by:
getSASLCredentialsin classUnboundIDTOTPBindRequest- Returns:
- The encoded SASL credentials that may be included in an UNBOUNDID-TOTP SASL bind request.
- Throws:
LDAPException- If a problem is encountered while attempting to obtain the encoded credentials.
-
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.- Overrides:
getRebindRequestin classBindRequest- 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
nullto indicate that automatic re-binding is not supported for this type of bind request.
-
duplicate
Creates a new instance of this LDAP request that may be modified without impacting this request.- Specified by:
duplicatein interfaceReadOnlyLDAPRequest- Specified by:
duplicatein classBindRequest- Returns:
- A new instance of this LDAP request that may be modified without impacting this request.
-
duplicate
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:
duplicatein interfaceReadOnlyLDAPRequest- Specified by:
duplicatein classBindRequest- 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.
-
toCode
public void toCode(@NotNull List<String> lineList, @NotNull String requestID, int indentSpaces, boolean includeProcessing) Appends a number of lines comprising the Java source code that can be used to recreate this request to the given list.- Specified by:
toCodein interfaceReadOnlyLDAPRequest- Overrides:
toCodein classSASLBindRequest- Parameters:
lineList- The list to which the source code lines should be added.requestID- The name that should be used as an identifier for the request. If this isnullor empty, then a generic ID will be used.indentSpaces- The number of spaces that should be used to indent the generated code. It must not be negative.includeProcessing- Indicates whether the generated code should include code required to actually process the request and handle the result (iftrue), or just to generate the request (iffalse).