Package com.unboundid.ldap.sdk
Class BindRequest
- java.lang.Object
-
- com.unboundid.ldap.sdk.LDAPRequest
-
- com.unboundid.ldap.sdk.BindRequest
-
- All Implemented Interfaces:
ReadOnlyLDAPRequest,java.io.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 sameBindRequestobject 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 theSASLBindRequestsubclass is actually intended to be extended by third-party code.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static ASN1IntegerVERSION_ELEMENTThe pre-encoded ASN.1 element used to represent the protocol version.
-
Constructor Summary
Constructors Modifier Constructor Description protectedBindRequest(Control[] controls)Creates a new bind request with the provided set of controls.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract BindRequestduplicate()Creates a new instance of this LDAP request that may be modified without impacting this request.abstract BindRequestduplicate(Control[] controls)Creates a new instance of this LDAP request that may be modified without impacting this request.abstract java.lang.StringgetBindType()Retrieves a human-readable string that describes the type of bind request.OperationTypegetOperationType()Retrieves the type of operation that is represented by this request.BindRequestgetRebindRequest(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.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, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.unboundid.ldap.sdk.ReadOnlyLDAPRequest
toCode
-
-
-
-
Field Detail
-
VERSION_ELEMENT
@NotNull protected static final ASN1Integer VERSION_ELEMENT
The pre-encoded ASN.1 element used to represent the protocol version.
-
-
Constructor Detail
-
BindRequest
protected BindRequest(@Nullable Control[] controls)
Creates a new bind request with the provided set of controls.- Parameters:
controls- The set of controls to include in this bind request.
-
-
Method Detail
-
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
@NotNull public final OperationType 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
@NotNull public abstract java.lang.String 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
@NotNull public abstract BindRequest 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
@NotNull public abstract BindRequest 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.- 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
@Nullable public BindRequest getRebindRequest(@NotNull 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. 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.
-
-