Package com.unboundid.ldap.sdk
Class SCRAMBindRequest
java.lang.Object
com.unboundid.ldap.sdk.LDAPRequest
com.unboundid.ldap.sdk.BindRequest
com.unboundid.ldap.sdk.SASLBindRequest
com.unboundid.ldap.sdk.SCRAMBindRequest
- All Implemented Interfaces:
ReadOnlyLDAPRequest,Serializable
- Direct Known Subclasses:
SCRAMSHA1BindRequest,SCRAMSHA256BindRequest,SCRAMSHA512BindRequest
@Extensible
@ThreadSafety(level=INTERFACE_NOT_THREADSAFE)
public abstract class SCRAMBindRequest
extends SASLBindRequest
This class provides the basis for bind requests that use the salted
challenge-response authentication mechanism (SCRAM) described in
RFC 5802 and updated in
RFC 7677. Subclasses
should extend this class to provide support for specific algorithms.
Note that this implementation does not support the PLUS variants of these algorithms, which requires channel binding support.
Note that this implementation does not support the PLUS variants of these algorithms, which requires channel binding support.
- See Also:
-
Field Summary
Fields inherited from class com.unboundid.ldap.sdk.SASLBindRequest
CRED_TYPE_SASLFields inherited from class com.unboundid.ldap.sdk.BindRequest
VERSION_ELEMENT -
Constructor Summary
ConstructorsConstructorDescriptionSCRAMBindRequest(String username, ASN1OctetString password, Control... controls) Creates a new SCRAM bind request with the provided information. -
Method Summary
Modifier and TypeMethodDescriptionabstract SCRAMBindRequestCreates a new instance of this LDAP request that may be modified without impacting this request.abstract SCRAMBindRequestCreates a new instance of this LDAP request that may be modified without impacting this request.protected abstract StringRetrieves the name of the digest algorithm that will be used in the authentication processing.protected abstract StringRetrieves the name of the MAC algorithm that will be used in the authentication processing.final byte[]Retrieves the bytes that comprise the password for this bind request.final StringRetrieves the password for this bind request, as a string.abstract SCRAMBindRequestgetRebindRequest(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.final StringRetrieves the username for this bind request.protected final BindResultprocess(LDAPConnection connection, int depth) Sends this bind request to the target server over the provided connection and returns the corresponding response.abstract voidAppends a number of lines comprising the Java source code that can be used to recreate this request to the given list.abstract voidtoString(StringBuilder buffer) Appends a string representation of this request to the provided buffer.Methods inherited from class com.unboundid.ldap.sdk.SASLBindRequest
getBindType, getLastMessageID, getSASLMechanismName, 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
-
SCRAMBindRequest
public SCRAMBindRequest(@NotNull String username, @NotNull ASN1OctetString password, @Nullable Control... controls) Creates a new SCRAM bind request with the provided information.- Parameters:
username- The username for this bind request. It must not benullor empty.password- The password for this bind request. It must not benullor empty.controls- The set of controls to include in the bind request. It may benullor empty if no controls are needed.
-
-
Method Details
-
getUsername
Retrieves the username for this bind request.- Returns:
- The password for this bind request.
-
getPasswordString
Retrieves the password for this bind request, as a string.- Returns:
- The password for this bind request, as a string.
-
getPasswordBytes
Retrieves the bytes that comprise the password for this bind request.- Returns:
- The bytes that comprise the password for this bind request.
-
getDigestAlgorithmName
Retrieves the name of the digest algorithm that will be used in the authentication processing.- Returns:
- The name of the digest algorithm that will be used in the authentication processing.
-
getMACAlgorithmName
Retrieves the name of the MAC algorithm that will be used in the authentication processing.- Returns:
- The name of the MAC algorithm that will be used in the authentication processing.
-
process
@NotNull protected final 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.
-
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.
-
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 abstract 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).
-