Package com.unboundid.ldap.sdk
Class BindRequest
java.lang.Object
com.unboundid.ldap.sdk.LDAPRequest
com.unboundid.ldap.sdk.BindRequest
- All Implemented Interfaces:
ReadOnlyLDAPRequest,Serializable
- Direct Known Subclasses:
SASLBindRequest,SimpleBindRequest
@Extensible
@ThreadSafety(level=NOT_THREADSAFE)
public abstract class BindRequest
extends LDAPRequest
This class provides an API that is used to represent an LDAP bind request.
It should be extended by subclasses that provide the logic for processing
specific types of bind operations (e.g., simple binds, and the various SASL
mechanisms).
It is strongly recommended that all bind request types which implement the rebind capability be made 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. Note, however, that it is not threadsafe to use the same
Note that even though this class is marked with the @Extensible annotation type, it should not be directly subclassed by third-party code. Only the
It is strongly recommended that all bind request types which implement the rebind capability be made 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. Note, however, that it is not threadsafe to use the same
BindRequest object to attempt to bind concurrently over multiple
connections.
Note that even though this class is marked with the @Extensible annotation type, it should not be directly subclassed by third-party code. Only the
SASLBindRequest subclass is actually intended to be extended by
third-party code.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final ASN1IntegerThe pre-encoded ASN.1 element used to represent the protocol version. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBindRequest(Control[] controls) Creates a new bind request with the provided set of controls. -
Method Summary
Modifier and TypeMethodDescriptionabstract BindRequestCreates a new instance of this LDAP request that may be modified without impacting this request.abstract BindRequestCreates a new instance of this LDAP request that may be modified without impacting this request.abstract StringRetrieves a human-readable string that describes the type of bind request.final OperationTypeRetrieves the type of operation that is represented by 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 abstract BindResultprocess(LDAPConnection connection, int depth) Sends this bind request to the target server over the provided connection and returns the corresponding response.Methods inherited from class com.unboundid.ldap.sdk.LDAPRequest
followReferrals, getControl, getControlList, getControls, getIntermediateResponseListener, getLastMessageID, getReferralConnector, getReferralConnectorInternal, getReferralDepth, getResponseTimeoutMillis, hasControl, hasControl, setFollowReferrals, setIntermediateResponseListener, setReferralConnector, setReferralDepth, setResponseTimeoutMillis, toString, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.unboundid.ldap.sdk.ReadOnlyLDAPRequest
toCode
-
Field Details
-
VERSION_ELEMENT
The pre-encoded ASN.1 element used to represent the protocol version.
-
-
Constructor Details
-
BindRequest
Creates a new bind request with the provided set of controls.- Parameters:
controls- The set of controls to include in this bind request.
-
-
Method Details
-
process
@NotNull protected abstract 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 classLDAPRequest- 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.
-
getOperationType
Retrieves the type of operation that is represented by this request.- Specified by:
getOperationTypein classLDAPRequest- Returns:
- The type of operation that is represented by this request.
-
getBindType
Retrieves a human-readable string that describes the type of bind request.- Returns:
- A human-readable string that describes the type of bind request.
-
duplicate
Creates a new instance of this LDAP request that may be modified without impacting this request.- 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.- 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.
-
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.- 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.
-