Record Class BindRequest
java.lang.Object
java.lang.Record
org.forgerock.opendj.ldap.messages.BindRequest
- Record Components:
version- the version of the protocol to be used at the LDAP message layer. There is no version negotiation. The client sets this field to the version it desires. If the server does not support the specified version then it will respond with a result whose error code isResultCode.PROTOCOL_ERROR.LDAP version 3 is the most recent LDAP version and the one recommended for all client applications. Furthermore, OpenDJ only has partial support for LDAPv2.
name- the name of the Directory object that the client wishes to bind as. The name may be empty (but nevernull) when used for anonymous binds, or when using SASL authentication. The server shall not dereference any aliases in locating the named object.The LDAP protocol defines the Bind name to be a distinguished name, however some LDAP implementations have relaxed this constraint and allow other identities to be used, such as the user's email address.
authenticationType- the authentication mechanism identifier for this bind request as defined by the LDAP protocol. Note that the valueAUTHENTICATION_TYPE_SIMPLE(0x80) is reserved for simple authentication and the valueAUTHENTICATION_TYPE_SASL(0xA3) is reserved for SASL authentication.authenticationValue- the encoded authentication value for this bind request as defined by the LDAP protocol. For simple authentication the authentication value is the byte representation of the password. For SASL authentication the authentication value is an ASN.1 encoded sequence comprising the SASL mechanism name and the optional SASL mechanism specific credentials.saslMechanism- the name of the SASL mechanism, e.g.SASL_MECHANISM_NAME_PLAIN, ornullif the authentication type is notAUTHENTICATION_TYPE_SASL.saslCredentials- the optional SASL credentials, ornullif the authentication type is notAUTHENTICATION_TYPE_SASLor if the SASL credentials are not present.saslClient- theSaslClientthat will be responsible for continuing the SASL challenge-response sequence, as well as potentially installing a SASL security layer once the bind sequence completes, ornullif none has been provided.A
SaslClientis only required if the application is performing SASL authentication and wishes the network layer to drive the complete challenge-response sequence. An application may choose to drive the SASL bind sequence itself, but the application:- will not be able to control where bind requests are sent if load-balancing is active,
- nor will it be able to install a security layer upon completion of the bind sequence.
controls- theListcontaining the controls.
- All Implemented Interfaces:
ProtocolOp,Request
public record BindRequest(int version, Dn name, byte authenticationType, ByteString authenticationValue, String saslMechanism, ByteString saslCredentials, SaslClient saslClient, List<Control> controls)
extends Record
implements Request
The Bind operation allows authentication information to be exchanged between the client and server. The Bind
operation should be thought of as the "authenticate" operation.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.forgerock.opendj.ldap.messages.Request
Request.RequestType -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final byteThe authentication type value (0xA3) reserved for SASL authentication.static final byteThe authentication type value (0x80) reserved for simple authentication.static final StringThe name of the SASL mechanism that uses anonymous access and having the name "ANONYMOUS".static final StringThe name of the SASL mechanism that uses CRAM-MD5 authentication and having the name "CRAM-MD5".static final StringThe name of the SASL mechanism that uses DIGEST-MD5 authentication and having the name "DIGEST-MD5".static final StringThe name of the SASL mechanism that uses external authentication and having the name "EXTERNAL".static final StringThe name of the SASL mechanism that uses GSS-API authentication and having the name "GSSAPI".static final StringThe name of the SASL mechanism that uses PLAIN authentication and having the name "PLAIN".static final StringThe name of the SASL mechanism that uses SCRAM-SHA-256 authentication and having the name "SCRAM-SHA-256".static final StringThe name of the SASL mechanism that uses SCRAM-SHA-512 authentication and having the name "SCRAM-SHA-512". -
Constructor Summary
ConstructorsConstructorDescriptionBindRequest(int version, Dn name, byte authenticationType, ByteString authenticationValue, String saslMechanism, ByteString saslCredentials, SaslClient saslClient, List<Control> controls) Creates a newBindRequest. -
Method Summary
Modifier and TypeMethodDescription<R,P, E extends Exception>
Raccept(RequestVisitor<R, P, E> v, P p) Applies aRequestVisitorto thisRequest.byteReturns the value of theauthenticationTyperecord component.Returns the value of theauthenticationValuerecord component.controls()Returns the value of thecontrolsrecord component.final booleanIndicates whether some other object is "equal to" this one.evaluateSaslChallenge(ByteString saslServerCredentials) Evaluates the provided SASL credentials (challenge) returned by the server and creates the next SASL bind request that should be sent to the server in order to continue or complete the SASL authentication sequence.getType()Returns the type of this request to avoid expensiveinstanceofchecks.final inthashCode()Returns a hash code value for this object.booleanReturnstrueif the SASL bind sequence has negotiated a SASL security layer using Quality of Protection (QOP).booleanReturntrueif this bind request's authentication type isAUTHENTICATION_TYPE_SASL.booleanReturntrueif this bind request's authentication type isAUTHENTICATION_TYPE_SIMPLE.name()Returns the value of thenamerecord component.Returns the value of thesaslClientrecord component.Returns the value of thesaslCredentialsrecord component.Returns the value of thesaslMechanismrecord component.Returns the simple bind password, ornullif the authentication type is notAUTHENTICATION_TYPE_SIMPLE.toString()Returns a string representation of this record class.intversion()Returns the value of theversionrecord component.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.forgerock.opendj.ldap.messages.ProtocolOp
addControl, addControls, containsControl, getControl, getControl, removeControls
-
Field Details
-
AUTHENTICATION_TYPE_SIMPLE
public static final byte AUTHENTICATION_TYPE_SIMPLEThe authentication type value (0x80) reserved for simple authentication.- See Also:
-
AUTHENTICATION_TYPE_SASL
public static final byte AUTHENTICATION_TYPE_SASLThe authentication type value (0xA3) reserved for SASL authentication.- See Also:
-
SASL_MECHANISM_NAME_ANONYMOUS
The name of the SASL mechanism that uses anonymous access and having the name "ANONYMOUS".- See Also:
-
SASL_MECHANISM_NAME_CRAM_MD5
The name of the SASL mechanism that uses CRAM-MD5 authentication and having the name "CRAM-MD5".- See Also:
-
SASL_MECHANISM_NAME_DIGEST_MD5
The name of the SASL mechanism that uses DIGEST-MD5 authentication and having the name "DIGEST-MD5".- See Also:
-
SASL_MECHANISM_NAME_PLAIN
The name of the SASL mechanism that uses PLAIN authentication and having the name "PLAIN".- See Also:
-
SASL_MECHANISM_NAME_EXTERNAL
The name of the SASL mechanism that uses external authentication and having the name "EXTERNAL".- See Also:
-
SASL_MECHANISM_NAME_GSSAPI
The name of the SASL mechanism that uses GSS-API authentication and having the name "GSSAPI".- See Also:
-
SASL_MECHANISM_NAME_SCRAM_SHA_256
The name of the SASL mechanism that uses SCRAM-SHA-256 authentication and having the name "SCRAM-SHA-256".- See Also:
-
SASL_MECHANISM_NAME_SCRAM_SHA_512
The name of the SASL mechanism that uses SCRAM-SHA-512 authentication and having the name "SCRAM-SHA-512".- See Also:
-
-
Constructor Details
-
BindRequest
public BindRequest(int version, Dn name, byte authenticationType, ByteString authenticationValue, String saslMechanism, ByteString saslCredentials, SaslClient saslClient, List<Control> controls) Creates a newBindRequest.
-
-
Method Details
-
accept
Description copied from interface:RequestApplies aRequestVisitorto thisRequest.- Specified by:
acceptin interfaceRequest- Type Parameters:
R- The return type of the visitor's methods.P- The type of the additional parameters to the visitor's methods.E- The type of the exception thrown by the visitor method if it fails, orNeverThrowsExceptionif the visitor cannot fail.- Parameters:
v- The request visitor.p- Optional additional visitor parameter.- Returns:
- A result as specified by the visitor.
- Throws:
E- If the visitor failed.
-
simplePassword
Returns the simple bind password, ornullif the authentication type is notAUTHENTICATION_TYPE_SIMPLE.- Returns:
- the simple bind password, or
nullif the authentication type is notAUTHENTICATION_TYPE_SIMPLE.
-
isSimpleBindRequest
public boolean isSimpleBindRequest()Returntrueif this bind request's authentication type isAUTHENTICATION_TYPE_SIMPLE.- Returns:
trueif this bind request's authentication type isAUTHENTICATION_TYPE_SIMPLE.
-
isSaslBindRequest
public boolean isSaslBindRequest()Returntrueif this bind request's authentication type isAUTHENTICATION_TYPE_SASL.- Returns:
trueif this bind request's authentication type isAUTHENTICATION_TYPE_SASL.
-
evaluateSaslChallenge
Evaluates the provided SASL credentials (challenge) returned by the server and creates the next SASL bind request that should be sent to the server in order to continue or complete the SASL authentication sequence. This method may only be called if this request has been configured to use aSaslClient.- Parameters:
saslServerCredentials- The non-nullSASL challenge sent from the server, which may be empty.- Returns:
- The next SASL bind request to be sent to the server, or
nullif the SASL bind sequence has completed. - Throws:
SaslException- If an error occurred while evaluating the challenge or generating a response.IllegalStateException- If this bind request has not been configured to use aSaslClient.NullPointerException- IfsaslServerCredentialswasnull.
-
hasNegotiatedSaslQop
public boolean hasNegotiatedSaslQop()Returnstrueif the SASL bind sequence has negotiated a SASL security layer using Quality of Protection (QOP). This method may only be called if this request has been configured to use aSaslClientand the SASL bind sequence has completed (the previous call toevaluateSaslChallenge(ByteString)returnednull).- Returns:
trueif the SASL bind sequence has negotiated a SASL security layer (QOP).- Throws:
IllegalStateException- If this bind request has not been configured to use aSaslClientor the SASL bind sequence has not completed.
-
getType
Description copied from interface:RequestReturns the type of this request to avoid expensiveinstanceofchecks. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
version
public int version()Returns the value of theversionrecord component.- Returns:
- the value of the
versionrecord component
-
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
authenticationType
public byte authenticationType()Returns the value of theauthenticationTyperecord component.- Returns:
- the value of the
authenticationTyperecord component
-
authenticationValue
Returns the value of theauthenticationValuerecord component.- Returns:
- the value of the
authenticationValuerecord component
-
saslMechanism
Returns the value of thesaslMechanismrecord component.- Returns:
- the value of the
saslMechanismrecord component
-
saslCredentials
Returns the value of thesaslCredentialsrecord component.- Returns:
- the value of the
saslCredentialsrecord component
-
saslClient
Returns the value of thesaslClientrecord component.- Returns:
- the value of the
saslClientrecord component
-
controls
Returns the value of thecontrolsrecord component.- Specified by:
controlsin interfaceProtocolOp- Returns:
- the value of the
controlsrecord component
-