Class UnboundIDYubiKeyOTPBindRequest
java.lang.Object
com.unboundid.ldap.sdk.LDAPRequest
com.unboundid.ldap.sdk.BindRequest
com.unboundid.ldap.sdk.SASLBindRequest
com.unboundid.ldap.sdk.unboundidds.UnboundIDYubiKeyOTPBindRequest
- All Implemented Interfaces:
ReadOnlyLDAPRequest,Serializable
@NotMutable
@ThreadSafety(level=COMPLETELY_THREADSAFE)
public final class UnboundIDYubiKeyOTPBindRequest
extends SASLBindRequest
This class provides an implementation of a SASL bind request that may be used
to authenticate to a Directory Server using the UNBOUNDID-YUBIKEY-OTP
mechanism. The credentials include at least an authentication ID and a
one-time password generated by a YubiKey device. The request may also
include a static password (which may or may not be required by the server)
and an optional authorization ID.
The UNBOUNDID-YUBIKEY-OTP bind request MUST include SASL credentials with the following ASN.1 encoding:
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.
The UNBOUNDID-YUBIKEY-OTP bind request MUST include SASL credentials with the following ASN.1 encoding:
UnboundIDYubiKeyCredentials ::= SEQUENCE {
authenticationID [0] OCTET STRING,
authorizationID [1] OCTET STRING OPTIONAL,
staticPassword [2] OCTET STRING OPTIONAL,
yubiKeyOTP [3] OCTET STRING,
... }
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe name for the UnboundID YubiKey SASL mechanism.Fields inherited from class com.unboundid.ldap.sdk.SASLBindRequest
CRED_TYPE_SASLFields inherited from class com.unboundid.ldap.sdk.BindRequest
VERSION_ELEMENT -
Constructor Summary
ConstructorsConstructorDescriptionUnboundIDYubiKeyOTPBindRequest(String authenticationID, String authorizationID, byte[] staticPassword, String yubiKeyOTP, Control... controls) Creates a new UNBOUNDID-YUBIKEY-OTP bind request with the provided information.UnboundIDYubiKeyOTPBindRequest(String authenticationID, String authorizationID, String staticPassword, String yubiKeyOTP, Control... controls) Creates a new UNBOUNDID-YUBIKEY-OTP bind request with the provided information. -
Method Summary
Modifier and TypeMethodDescriptiondecodeCredentials(ASN1OctetString saslCredentials, Control... controls) Creates a new UNBOUNDID-YUBIKEY-OTP SASL bind request decoded from the provided SASL credentials.Creates 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.Retrieves an ASN.1 octet string containing the encoded credentials for this bind request.static ASN1OctetStringencodeCredentials(String authenticationID, String authorizationID, ASN1OctetString staticPassword, String yubiKeyOTP) Encodes the provided information into an ASN.1 octet string suitable for use as the SASL credentials for an UNBOUNDID-YUBIKEY-OTP bind request.Retrieves the authentication ID for the bind request.Retrieves the authorization ID for the bind request, if any.intRetrieves the message ID for the last LDAP message sent using this request.Retrieves the name of the SASL mechanism used in this SASL bind request.byte[]Retrieves the bytes that comprise the static password for the bind request, if any.Retrieves the string representation of the static password for the bind request, if any.Retrieves the YubiKey-generated one-time password to include in the bind request.protected BindResultprocess(LDAPConnection connection, int depth) Sends this bind request to the target server over the provided connection and returns the corresponding response.voidAppends a number of lines comprising the Java source code that can be used to recreate this request to the given list.voidtoString(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, sendMessageMethods inherited from class com.unboundid.ldap.sdk.BindRequest
getOperationType, getRebindRequestMethods 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
-
Field Details
-
UNBOUNDID_YUBIKEY_OTP_MECHANISM_NAME
The name for the UnboundID YubiKey SASL mechanism.- See Also:
-
-
Constructor Details
-
UnboundIDYubiKeyOTPBindRequest
public UnboundIDYubiKeyOTPBindRequest(@NotNull String authenticationID, @Nullable String authorizationID, @Nullable String staticPassword, @NotNull String yubiKeyOTP, @Nullable Control... controls) Creates a new UNBOUNDID-YUBIKEY-OTP bind request with the provided information.- Parameters:
authenticationID- The authentication ID for the bind request. It must not benull, and must have the form "dn:" followed by the DN of the target user or "u:" followed by the the username of the target user.authorizationID- The authorization ID for the bind request. It may benullif the authorization identity should be the same as the authentication identity.staticPassword- The static password for the user specified as the authentication identity. It may benullif authentication should be performed using only the YubiKey OTP.yubiKeyOTP- The one-time password generated by the YubiKey device. It must not benull.controls- The set of controls to include in the bind request. It may benullor empty if there should not be any request controls.
-
UnboundIDYubiKeyOTPBindRequest
public UnboundIDYubiKeyOTPBindRequest(@NotNull String authenticationID, @Nullable String authorizationID, @Nullable byte[] staticPassword, @NotNull String yubiKeyOTP, @Nullable Control... controls) Creates a new UNBOUNDID-YUBIKEY-OTP bind request with the provided information.- Parameters:
authenticationID- The authentication ID for the bind request. It must not benull, and must have the form "dn:" followed by the DN of the target user or "u:" followed by the the username of the target user.authorizationID- The authorization ID for the bind request. It may benullif the authorization identity should be the same as the authentication identity.staticPassword- The static password for the user specified as the authentication identity. It may benullif authentication should be performed using only the YubiKey OTP.yubiKeyOTP- The one-time password generated by the YubiKey device. It must not benull.controls- The set of controls to include in the bind request. It may benullor empty if there should not be any request controls.
-
-
Method Details
-
decodeCredentials
@NotNull public static UnboundIDYubiKeyOTPBindRequest decodeCredentials(@NotNull ASN1OctetString saslCredentials, @Nullable Control... controls) throws LDAPException Creates a new UNBOUNDID-YUBIKEY-OTP SASL bind request decoded from the provided SASL credentials.- Parameters:
saslCredentials- The SASL credentials to decode in order to create the UNBOUNDID-YUBIKEY-OTP SASL bind request. It must not benull.controls- The set of controls to include in the bind request. This may benullor empty if no controls should be included in the request.- Returns:
- The UNBOUNDID-YUBIKEY-OTP SASL bind request decoded from the provided credentials.
- Throws:
LDAPException- If the provided credentials cannot be decoded to a valid UNBOUNDID-YUBIKEY-OTP bind request.
-
getAuthenticationID
Retrieves the authentication ID for the bind request.- Returns:
- The authentication ID for the bind request.
-
getAuthorizationID
Retrieves the authorization ID for the bind request, if any.- Returns:
- The authorization ID for the bind request, or
nullif the authorization identity should match the authentication identity.
-
getStaticPasswordString
Retrieves the string representation of the static password for the bind request, if any.- Returns:
- The string representation of the static password for the bind
request, or
nullif there is no static password.
-
getStaticPasswordBytes
Retrieves the bytes that comprise the static password for the bind request, if any.- Returns:
- The bytes that comprise the static password for the bind request,
or
nullif there is no static password.
-
getYubiKeyOTP
Retrieves the YubiKey-generated one-time password to include in the bind request.- Returns:
- The YubiKey-generated one-time password to include in the bind request.
-
process
@NotNull protected BindResult process(@NotNull 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:
processin classBindRequest- 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
Retrieves an ASN.1 octet string containing the encoded credentials for this bind request.- Returns:
- An ASN.1 octet string containing the encoded credentials for this bind request.
-
encodeCredentials
@NotNull public static ASN1OctetString encodeCredentials(@NotNull String authenticationID, @Nullable String authorizationID, @Nullable ASN1OctetString staticPassword, @NotNull String yubiKeyOTP) Encodes the provided information into an ASN.1 octet string suitable for use as the SASL credentials for an UNBOUNDID-YUBIKEY-OTP bind request.- Parameters:
authenticationID- The authentication ID for the bind request. It must not benull, and must have the form "dn:" followed by the DN of the target user or "u:" followed by the the username of the target user.authorizationID- The authorization ID for the bind request. It may benullif the authorization identity should be the same as the authentication identity.staticPassword- The static password for the user specified as the authentication identity. It may benullif authentication should be performed using only the YubiKey OTP.yubiKeyOTP- The one-time password generated by the YubiKey device. It must not benull.- Returns:
- An ASN.1 octet string suitable for use as the SASL credentials for an UNBOUNDID-YUBIKEY-OTP 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.
-
getSASLMechanismName
Retrieves the name of the SASL mechanism used in this SASL bind request.- Specified by:
getSASLMechanismNamein classSASLBindRequest- Returns:
- The name of the SASL mechanism used in this SASL bind request.
-
getLastMessageID
Retrieves the message ID for the last LDAP message sent using this request.- Overrides:
getLastMessageIDin classSASLBindRequest- 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
Appends a string representation of this request to the provided buffer.- Specified by:
toStringin interfaceReadOnlyLDAPRequest- Specified by:
toStringin classLDAPRequest- Parameters:
buffer- The buffer to which to append a string representation of 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).
-