@NotMutable @ThreadSafety(level=NOT_THREADSAFE) public final class PLAINBindRequest extends SASLBindRequest
PLAINBindRequest bindRequest = new PLAINBindRequest("u:test.user", "password"); BindResult bindResult; try { bindResult = connection.bind(bindRequest); // If we get here, then the bind was successful. } catch (LDAPException le) { // The bind failed for some reason. bindResult = new BindResult(le.toLDAPResult()); ResultCode resultCode = le.getResultCode(); String errorMessageFromServer = le.getDiagnosticMessage(); }
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
PLAIN_MECHANISM_NAME
The name for the PLAIN SASL mechanism.
|
CRED_TYPE_SASL
VERSION_ELEMENT
Constructor and Description |
---|
PLAINBindRequest(java.lang.String authenticationID,
ASN1OctetString password)
Creates a new SASL PLAIN bind request with the provided authentication ID
and password.
|
PLAINBindRequest(java.lang.String authenticationID,
ASN1OctetString password,
Control... controls)
Creates a new SASL PLAIN bind request with the provided authentication ID,
password, and set of controls.
|
PLAINBindRequest(java.lang.String authenticationID,
byte[] password)
Creates a new SASL PLAIN bind request with the provided authentication ID
and password.
|
PLAINBindRequest(java.lang.String authenticationID,
byte[] password,
Control... controls)
Creates a new SASL PLAIN bind request with the provided authentication ID,
password, and set of controls.
|
PLAINBindRequest(java.lang.String authenticationID,
java.lang.String password)
Creates a new SASL PLAIN bind request with the provided authentication ID
and password.
|
PLAINBindRequest(java.lang.String authenticationID,
java.lang.String authorizationID,
ASN1OctetString password)
Creates a new SASL PLAIN bind request with the provided authentication ID,
authorization ID, and password.
|
PLAINBindRequest(java.lang.String authenticationID,
java.lang.String authorizationID,
ASN1OctetString password,
Control... controls)
Creates a new SASL PLAIN bind request with the provided information.
|
PLAINBindRequest(java.lang.String authenticationID,
java.lang.String authorizationID,
byte[] password)
Creates a new SASL PLAIN bind request with the provided authentication ID,
authorization ID, and password.
|
PLAINBindRequest(java.lang.String authenticationID,
java.lang.String authorizationID,
byte[] password,
Control... controls)
Creates a new SASL PLAIN bind request with the provided information.
|
PLAINBindRequest(java.lang.String authenticationID,
java.lang.String password,
Control... controls)
Creates a new SASL PLAIN bind request with the provided authentication ID,
password, and set of controls.
|
PLAINBindRequest(java.lang.String authenticationID,
java.lang.String authorizationID,
java.lang.String password)
Creates a new SASL PLAIN bind request with the provided authentication ID,
authorization ID, and password.
|
PLAINBindRequest(java.lang.String authenticationID,
java.lang.String authorizationID,
java.lang.String password,
Control... controls)
Creates a new SASL PLAIN bind request with the provided information.
|
Modifier and Type | Method and Description |
---|---|
PLAINBindRequest |
duplicate()
Creates a new instance of this LDAP request that may be modified without
impacting this request.
|
PLAINBindRequest |
duplicate(Control[] controls)
Creates a new instance of this LDAP request that may be modified without
impacting this request.
|
java.lang.String |
getAuthenticationID()
Retrieves the authentication ID for this bind request.
|
java.lang.String |
getAuthorizationID()
Retrieves the authorization ID for this bind request.
|
byte[] |
getPasswordBytes()
Retrieves the bytes that comprise the the password for this bind request.
|
java.lang.String |
getPasswordString()
Retrieves the string representation of the password for this bind request.
|
PLAINBindRequest |
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.
|
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.
|
getBindType, getLastMessageID, responseReceived, sendBindRequest, sendMessage
getOperationType
followReferrals, getControl, getControlList, getControls, getIntermediateResponseListener, getReferralConnector, getResponseTimeoutMillis, hasControl, hasControl, setFollowReferrals, setIntermediateResponseListener, setReferralConnector, setResponseTimeoutMillis, toString
@NotNull public static final java.lang.String PLAIN_MECHANISM_NAME
public PLAINBindRequest(@NotNull java.lang.String authenticationID, @NotNull java.lang.String password)
authenticationID
- The authentication ID for this bind request. It
must not be null
.password
- The password for this bind request. It must not
be null
.public PLAINBindRequest(@NotNull java.lang.String authenticationID, @NotNull byte[] password)
authenticationID
- The authentication ID for this bind request. It
must not be null
.password
- The password for this bind request. It must not
be null
.public PLAINBindRequest(@NotNull java.lang.String authenticationID, @NotNull ASN1OctetString password)
authenticationID
- The authentication ID for this bind request. It
must not be null
.password
- The password for this bind request. It must not
be null
.public PLAINBindRequest(@NotNull java.lang.String authenticationID, @Nullable java.lang.String authorizationID, @NotNull java.lang.String password)
authenticationID
- The authentication ID for this bind request. It
must not be null
.authorizationID
- The authorization ID for this bind request, or
null
if there is to be no authorization
ID.password
- The password for this bind request. It must not
be null
.public PLAINBindRequest(@NotNull java.lang.String authenticationID, @Nullable java.lang.String authorizationID, @NotNull byte[] password)
authenticationID
- The authentication ID for this bind request. It
must not be null
.authorizationID
- The authorization ID for this bind request, or
null
if there is to be no authorization
ID.password
- The password for this bind request. It must not
be null
.public PLAINBindRequest(@NotNull java.lang.String authenticationID, @Nullable java.lang.String authorizationID, @NotNull ASN1OctetString password)
authenticationID
- The authentication ID for this bind request. It
must not be null
.authorizationID
- The authorization ID for this bind request, or
null
if there is to be no authorization
ID.password
- The password for this bind request. It must not
be null
.public PLAINBindRequest(@NotNull java.lang.String authenticationID, @NotNull java.lang.String password, @Nullable Control... controls)
authenticationID
- The authentication ID for this bind request. It
must not be null
.password
- The password for this bind request. It must not
be null
.controls
- The set of controls to includepublic PLAINBindRequest(@NotNull java.lang.String authenticationID, @NotNull byte[] password, @Nullable Control... controls)
authenticationID
- The authentication ID for this bind request. It
must not be null
.password
- The password for this bind request. It must not
be null
.controls
- The set of controls to includepublic PLAINBindRequest(@NotNull java.lang.String authenticationID, @NotNull ASN1OctetString password, @Nullable Control... controls)
authenticationID
- The authentication ID for this bind request. It
must not be null
.password
- The password for this bind request. It must not
be null
.controls
- The set of controls to includepublic PLAINBindRequest(@NotNull java.lang.String authenticationID, @Nullable java.lang.String authorizationID, @NotNull java.lang.String password, @Nullable Control... controls)
authenticationID
- The authentication ID for this bind request. It
must not be null
.authorizationID
- The authorization ID for this bind request, or
null
if there is to be no authorization
ID.password
- The password for this bind request. It must not
be null
.controls
- The set of controls to includepublic PLAINBindRequest(@NotNull java.lang.String authenticationID, @Nullable java.lang.String authorizationID, @NotNull byte[] password, @Nullable Control... controls)
authenticationID
- The authentication ID for this bind request. It
must not be null
.authorizationID
- The authorization ID for this bind request, or
null
if there is to be no authorization
ID.password
- The password for this bind request. It must not
be null
.controls
- The set of controls to includepublic PLAINBindRequest(@NotNull java.lang.String authenticationID, @Nullable java.lang.String authorizationID, @NotNull ASN1OctetString password, @Nullable Control... controls)
authenticationID
- The authentication ID for this bind request. It
must not be null
.authorizationID
- The authorization ID for this bind request, or
null
if there is to be no authorization
ID.password
- The password for this bind request. It must not
be null
.controls
- The set of controls to include@NotNull public java.lang.String getSASLMechanismName()
getSASLMechanismName
in class SASLBindRequest
@NotNull public java.lang.String getAuthenticationID()
@Nullable public java.lang.String getAuthorizationID()
null
if
there is no authorization ID.@NotNull public java.lang.String getPasswordString()
@NotNull public byte[] getPasswordBytes()
@NotNull protected BindResult process(@NotNull LDAPConnection connection, int depth) throws LDAPException
process
in class BindRequest
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.LDAPException
- If a problem occurs while sending the request or
reading the response.@NotNull public PLAINBindRequest getRebindRequest(@NotNull java.lang.String host, int port)
getRebindRequest
in class BindRequest
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.null
to indicate that automatic
re-binding is not supported for this type of bind request.@NotNull public PLAINBindRequest duplicate()
duplicate
in interface ReadOnlyLDAPRequest
duplicate
in class BindRequest
@NotNull public PLAINBindRequest duplicate(@Nullable Control[] controls)
duplicate
in interface ReadOnlyLDAPRequest
duplicate
in class BindRequest
controls
- The set of controls to include in the duplicate request.public void toString(@NotNull java.lang.StringBuilder buffer)
toString
in interface ReadOnlyLDAPRequest
toString
in class LDAPRequest
buffer
- The buffer to which to append a string representation of
this request.public void toCode(@NotNull java.util.List<java.lang.String> lineList, @NotNull java.lang.String requestID, int indentSpaces, boolean includeProcessing)
toCode
in interface ReadOnlyLDAPRequest
toCode
in class SASLBindRequest
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 is null
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 (if true
),
or just to generate the request (if
false
).