Package com.unboundid.ldap.sdk
Class GenericSASLBindRequest
- java.lang.Object
-
- com.unboundid.ldap.sdk.LDAPRequest
-
- com.unboundid.ldap.sdk.BindRequest
-
- com.unboundid.ldap.sdk.SASLBindRequest
-
- com.unboundid.ldap.sdk.GenericSASLBindRequest
-
- All Implemented Interfaces:
ReadOnlyLDAPRequest
,java.io.Serializable
@NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public final class GenericSASLBindRequest extends SASLBindRequest
This class provides a mechanism for performing SASL authentication in a generic manner. The caller is responsible for properly encoding the credentials (if any) and interpreting the result. Further, if the requested SASL mechanism is one that requires multiple stages, then the caller is responsible for all processing in each stage.- See Also:
- Serialized Form
-
-
Field Summary
-
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
Constructors Constructor Description GenericSASLBindRequest(java.lang.String bindDN, java.lang.String mechanism, ASN1OctetString credentials, Control... controls)
Creates a new generic SASL bind request with the provided information.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GenericSASLBindRequest
duplicate()
Creates a new instance of this LDAP request that may be modified without impacting this request.GenericSASLBindRequest
duplicate(Control[] controls)
Creates a new instance of this LDAP request that may be modified without impacting this request.java.lang.String
getBindDN()
Retrieves the bind DN for this SASL bind request, if any.ASN1OctetString
getCredentials()
Retrieves the credentials for the SASL bind request, if any.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
toCode(java.util.List<java.lang.String> lineList, java.lang.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.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, getLastMessageID, 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, getReferralConnector, getResponseTimeoutMillis, hasControl, hasControl, setFollowReferrals, setIntermediateResponseListener, setReferralConnector, setResponseTimeoutMillis, toString
-
-
-
-
Constructor Detail
-
GenericSASLBindRequest
public GenericSASLBindRequest(@Nullable java.lang.String bindDN, @NotNull java.lang.String mechanism, @Nullable ASN1OctetString credentials, @Nullable Control... controls)
Creates a new generic SASL bind request with the provided information.- Parameters:
bindDN
- The bind DN that should be used for the request. It may benull
if the target identity should be derived from the credentials or some other source.mechanism
- The name of the mechanism that should be used for the SASL bind. It must not benull
.credentials
- The credentials that should be used for the SASL bind. It may benull
if no credentials should be used.controls
- The set of controls to include in the SASL bind request. It may benull
or empty if no request controls are needed.
-
-
Method Detail
-
getBindDN
@Nullable public java.lang.String getBindDN()
Retrieves the bind DN for this SASL bind request, if any.- Returns:
- The bind DN for this SASL bind request, or
null
if the target identity should be determined from the credentials or some other mechanism.
-
getSASLMechanismName
@NotNull public java.lang.String getSASLMechanismName()
Retrieves the name of the SASL mechanism used in this SASL bind request.- Specified by:
getSASLMechanismName
in classSASLBindRequest
- Returns:
- The name of the SASL mechanism used in this SASL bind request.
-
getCredentials
@Nullable public ASN1OctetString getCredentials()
Retrieves the credentials for the SASL bind request, if any.- Returns:
- The credentials for the SASL bind request, or
null
if there are none.
-
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:
process
in 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.
-
duplicate
@NotNull public GenericSASLBindRequest duplicate()
Creates a new instance of this LDAP request that may be modified without impacting this request.- Specified by:
duplicate
in interfaceReadOnlyLDAPRequest
- Specified by:
duplicate
in classBindRequest
- Returns:
- A new instance of this LDAP request that may be modified without impacting this request.
-
duplicate
@NotNull public GenericSASLBindRequest duplicate(@Nullable 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 interfaceReadOnlyLDAPRequest
- Specified by:
duplicate
in 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
public void toString(@NotNull java.lang.StringBuilder buffer)
Appends a string representation of this request to the provided buffer.- Specified by:
toString
in interfaceReadOnlyLDAPRequest
- Specified by:
toString
in classLDAPRequest
- Parameters:
buffer
- The buffer to which to append a string representation of this request.
-
toCode
public void toCode(@NotNull java.util.List<java.lang.String> lineList, @NotNull java.lang.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:
toCode
in interfaceReadOnlyLDAPRequest
- Overrides:
toCode
in 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 isnull
or 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
).
-
-