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
, ornull
if the authentication type is notAUTHENTICATION_TYPE_SASL
.saslCredentials
- the optional SASL credentials, ornull
if the authentication type is notAUTHENTICATION_TYPE_SASL
or if the SASL credentials are not present.saslClient
- theSaslClient
that will be responsible for continuing the SASL challenge-response sequence, as well as potentially installing a SASL security layer once the bind sequence completes, ornull
if none has been provided.A
SaslClient
is 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
- theList
containing 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 byte
The authentication type value (0xA3) reserved for SASL authentication.static final byte
The authentication type value (0x80) reserved for simple authentication.static final String
The name of the SASL mechanism that uses anonymous access and having the name "ANONYMOUS".static final String
The name of the SASL mechanism that uses CRAM-MD5 authentication and having the name "CRAM-MD5".static final String
The name of the SASL mechanism that uses DIGEST-MD5 authentication and having the name "DIGEST-MD5".static final String
The name of the SASL mechanism that uses external authentication and having the name "EXTERNAL".static final String
The name of the SASL mechanism that uses GSS-API authentication and having the name "GSSAPI".static final String
The name of the SASL mechanism that uses PLAIN authentication and having the name "PLAIN".static final String
The name of the SASL mechanism that uses SCRAM-SHA-256 authentication and having the name "SCRAM-SHA-256".static final String
The 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 aRequestVisitor
to thisRequest
.byte
Returns the value of theauthenticationType
record component.Returns the value of theauthenticationValue
record component.controls()
Returns the value of thecontrols
record component.final boolean
Indicates 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 expensiveinstanceof
checks.final int
hashCode()
Returns a hash code value for this object.boolean
Returnstrue
if the SASL bind sequence has negotiated a SASL security layer using Quality of Protection (QOP).boolean
Returntrue
if this bind request's authentication type isAUTHENTICATION_TYPE_SASL
.boolean
Returntrue
if this bind request's authentication type isAUTHENTICATION_TYPE_SIMPLE
.name()
Returns the value of thename
record component.Returns the value of thesaslClient
record component.Returns the value of thesaslCredentials
record component.Returns the value of thesaslMechanism
record component.Returns the simple bind password, ornull
if the authentication type is notAUTHENTICATION_TYPE_SIMPLE
.toString()
Returns a string representation of this record class.int
version()
Returns the value of theversion
record component.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods 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:Request
Applies aRequestVisitor
to thisRequest
.- Specified by:
accept
in 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, orNeverThrowsException
if 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, ornull
if the authentication type is notAUTHENTICATION_TYPE_SIMPLE
.- Returns:
- the simple bind password, or
null
if the authentication type is notAUTHENTICATION_TYPE_SIMPLE
.
-
isSimpleBindRequest
public boolean isSimpleBindRequest()Returntrue
if this bind request's authentication type isAUTHENTICATION_TYPE_SIMPLE
.- Returns:
true
if this bind request's authentication type isAUTHENTICATION_TYPE_SIMPLE
.
-
isSaslBindRequest
public boolean isSaslBindRequest()Returntrue
if this bind request's authentication type isAUTHENTICATION_TYPE_SASL
.- Returns:
true
if 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-null
SASL challenge sent from the server, which may be empty.- Returns:
- The next SASL bind request to be sent to the server, or
null
if 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
- IfsaslServerCredentials
wasnull
.
-
hasNegotiatedSaslQop
public boolean hasNegotiatedSaslQop()Returnstrue
if 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 aSaslClient
and the SASL bind sequence has completed (the previous call toevaluateSaslChallenge(ByteString)
returnednull
).- Returns:
true
if the SASL bind sequence has negotiated a SASL security layer (QOP).- Throws:
IllegalStateException
- If this bind request has not been configured to use aSaslClient
or the SASL bind sequence has not completed.
-
getType
Description copied from interface:Request
Returns the type of this request to avoid expensiveinstanceof
checks. -
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 theversion
record component.- Returns:
- the value of the
version
record component
-
name
Returns the value of thename
record component.- Returns:
- the value of the
name
record component
-
authenticationType
public byte authenticationType()Returns the value of theauthenticationType
record component.- Returns:
- the value of the
authenticationType
record component
-
authenticationValue
Returns the value of theauthenticationValue
record component.- Returns:
- the value of the
authenticationValue
record component
-
saslMechanism
Returns the value of thesaslMechanism
record component.- Returns:
- the value of the
saslMechanism
record component
-
saslCredentials
Returns the value of thesaslCredentials
record component.- Returns:
- the value of the
saslCredentials
record component
-
saslClient
Returns the value of thesaslClient
record component.- Returns:
- the value of the
saslClient
record component
-
controls
Returns the value of thecontrols
record component.- Specified by:
controls
in interfaceProtocolOp
- Returns:
- the value of the
controls
record component
-