Class BindRequestImpl
java.lang.Object
org.apache.directory.api.ldap.model.message.AbstractMessage
org.apache.directory.api.ldap.model.message.AbstractRequest
org.apache.directory.api.ldap.model.message.AbstractAbandonableRequest
org.apache.directory.api.ldap.model.message.BindRequestImpl
- All Implemented Interfaces:
AbandonableRequest, BindRequest, Message, Request, ResultResponseRequest, SingleReplyRequest
Bind protocol operation request which authenticates and begins a client
session. Does not yet contain interfaces for SASL authentication mechanisms.
- Author:
- Apache Directory Project
-
Field Summary
Fields inherited from class AbstractMessage
controls -
Constructor Summary
ConstructorsConstructorDescriptionCreates an BindRequest implementation to bind to an LDAP server. -
Method Summary
Modifier and TypeMethodDescriptionvoidabandon()RFC 2251/4511 [Section 4.11]: Abandon, Bind, Unbind, and StartTLS operations cannot be abandoned.addAllControls(Control[] controls) Adds an array of controls to this Message.addControl(Control control) Adds a control to this Message.booleanChecks to see if two messages are equivalent.byte[]Gets the simple credentials associated with a simple authentication attempt or null if this request uses SASL authentication mechanisms.getDn()Gets the DN of the subject in this authentication request.getName()Gets the name of the subject in this authentication request.Gets the protocol response message type for this request which produces at least one response.The result containing response for this request.Gets the SASL mechanism String associated with this BindRequest if the bind operation is using SASL.booleanChecks to see if the authentication mechanism is simple and not SASL based.booleanGets whether or not the Ldap v3 protocol is used.inthashCode()booleanisSimple()Checks to see if the authentication mechanism is simple and not SASL based.booleanChecks to see if the Ldap v3 protocol is used.removeControl(Control control) Deletes a control removing it from this Message.setCredentials(byte[] credentials) Sets the simple credentials associated with a simple authentication attempt.setCredentials(String credentials) Sets the simple credentials associated with a simple authentication attempt.Sets the DN of the subject in this authentication request.setMessageId(int messageId) Sets the Message ID for this requestSets the name of the subject in this authentication request.setSaslMechanism(String saslMechanism) Sets the SASL mechanism String associated with this BindRequest if the bind operation is using SASL.setSimple(boolean simple) Sets the authentication mechanism to simple or to SASL based authentication.setVersion3(boolean version3) Sets whether or not the LDAP v3 or v2 protocol is used.toString()Get a String representation of a BindRequestMethods inherited from class AbstractAbandonableRequest
addAbandonListener, isAbandonedMethods inherited from class AbstractRequest
hasResponseMethods inherited from class AbstractMessage
get, getControl, getControls, getMessageId, getType, hasControl, put, toStringMethods inherited from interface AbandonableRequest
addAbandonListener, isAbandonedMethods inherited from interface Message
get, getControl, getControls, getMessageId, getType, hasControl, putMethods inherited from interface Request
hasResponse
-
Constructor Details
-
BindRequestImpl
public BindRequestImpl()Creates an BindRequest implementation to bind to an LDAP server.
-
-
Method Details
-
isSimple
public boolean isSimple()Checks to see if the authentication mechanism is simple and not SASL based.- Specified by:
isSimplein interfaceBindRequest- Returns:
- true if the mechanism is simple false if it is SASL based.
-
getSimple
public boolean getSimple()Checks to see if the authentication mechanism is simple and not SASL based.- Specified by:
getSimplein interfaceBindRequest- Returns:
- true if the mechanism is simple false if it is SASL based.
-
setSimple
Sets the authentication mechanism to simple or to SASL based authentication.- Specified by:
setSimplein interfaceBindRequest- Parameters:
simple- true if authentication is simple, false otherwise.- Returns:
- The BindRequest instance
-
getCredentials
public byte[] getCredentials()Gets the simple credentials associated with a simple authentication attempt or null if this request uses SASL authentication mechanisms.- Specified by:
getCredentialsin interfaceBindRequest- Returns:
- null if the mechanism is SASL, or the credentials if it is simple.
-
setCredentials
Sets the simple credentials associated with a simple authentication attempt. Ignored if this request uses SASL authentication mechanisms.- Specified by:
setCredentialsin interfaceBindRequest- Parameters:
credentials- the credentials if authentication is simple- Returns:
- The BindRequest instance
-
setCredentials
Sets the simple credentials associated with a simple authentication attempt. Ignored if this request uses SASL authentication mechanisms.- Specified by:
setCredentialsin interfaceBindRequest- Parameters:
credentials- the credentials if authentication is simple- Returns:
- The BindRequest instance
-
getSaslMechanism
Gets the SASL mechanism String associated with this BindRequest if the bind operation is using SASL.- Specified by:
getSaslMechanismin interfaceBindRequest- Returns:
- the SASL mechanism or null if the bind operation is simple
-
setSaslMechanism
Sets the SASL mechanism String associated with this BindRequest if the bind operation is using SASL.- Specified by:
setSaslMechanismin interfaceBindRequest- Parameters:
saslMechanism- the SASL mechanism- Returns:
- The BindRequest instance
-
getName
Gets the name of the subject in this authentication request. This field may take on a null value (a zero length string) for the purposes of anonymous binds, when authentication has been performed at a lower layer, or when using SASL credentials with a mechanism that includes the name in the credentials.- Specified by:
getNamein interfaceBindRequest- Returns:
- the name of the authenticating user.
-
setName
Sets the name of the subject in this authentication request. This field may take on a null value (or a zero length string) for the purposes of anonymous binds, when authentication has been performed at a lower layer, or when using SASL credentials with a mechanism that includes the name in the credentials.- Specified by:
setNamein interfaceBindRequest- Parameters:
name- the name of the authenticating user - leave null for anonymous user.- Returns:
- The BindRequest instance
-
getDn
Gets the DN of the subject in this authentication request. This field may take on a null value (a zero length string) for the purposes of anonymous binds, when authentication has been performed at a lower layer, or when using SASL credentials with a mechanism that includes the DN in the credentials.- Specified by:
getDnin interfaceBindRequest- Returns:
- the DN of the authenticating user.
-
setDn
Sets the DN of the subject in this authentication request. This field may take on a null value (or a zero length string) for the purposes of anonymous binds, when authentication has been performed at a lower layer, or when using SASL credentials with a mechanism that includes the DN in the credentials.- Specified by:
setDnin interfaceBindRequest- Parameters:
dn- the DN of the authenticating user - leave null for anonymous user.- Returns:
- The BindRequest instance
-
isVersion3
public boolean isVersion3()Checks to see if the Ldap v3 protocol is used. Normally this would extract a version number from the bind request sent by the client indicating the version of the protocol to be used in this protocol session. The integer is either a 2 or a 3 at the moment. We thought it was better to just check if the protocol used is 3 or not rather than use an type-safe enumeration type for a binary value. If an LDAPv4 comes out then we shall convert the return type to a type safe enumeration.- Specified by:
isVersion3in interfaceBindRequest- Returns:
- true if client using version 3 false if it is version 2.
-
getVersion3
public boolean getVersion3()Gets whether or not the Ldap v3 protocol is used. Normally this would extract a version number from the bind request sent by the client indicating the version of the protocol to be used in this protocol session. The integer is either a 2 or a 3 at the moment. We thought it was better to just check if the protocol used is 3 or not rather than use an type-safe enumeration type for a binary value. If an LDAPv4 comes out then we shall convert the return type to a type safe enumeration.- Specified by:
getVersion3in interfaceBindRequest- Returns:
- true if client using version 3 false if it is version 2.
-
setVersion3
Sets whether or not the LDAP v3 or v2 protocol is used. Normally this would extract a version number from the bind request sent by the client indicating the version of the protocol to be used in this protocol session. The integer is either a 2 or a 3 at the moment. We thought it was better to just check if the protocol used is 3 or not rather than use an type-safe enumeration type for a binary value. If an LDAPv4 comes out then we shall convert the return type to a type safe enumeration.- Specified by:
setVersion3in interfaceBindRequest- Parameters:
version3- if true the client will be exhibiting version 3 bind behavior, If false is used version 2 behavior will be exhibited.- Returns:
- The BindRequest instance
-
setMessageId
Sets the Message ID for this request- Specified by:
setMessageIdin interfaceBindRequest- Specified by:
setMessageIdin interfaceMessage- Overrides:
setMessageIdin classAbstractMessage- Parameters:
messageId- The message Id- Returns:
- A Message reference
-
addControl
Adds a control to this Message.- Specified by:
addControlin interfaceBindRequest- Specified by:
addControlin interfaceMessage- Overrides:
addControlin classAbstractMessage- Parameters:
control- the control to add.- Returns:
- A Message reference
-
addAllControls
Adds an array of controls to this Message.- Specified by:
addAllControlsin interfaceBindRequest- Specified by:
addAllControlsin interfaceMessage- Overrides:
addAllControlsin classAbstractMessage- Parameters:
controls- the controls to add.- Returns:
- A Message reference
-
removeControl
Deletes a control removing it from this Message.- Specified by:
removeControlin interfaceBindRequest- Specified by:
removeControlin interfaceMessage- Overrides:
removeControlin classAbstractMessage- Parameters:
control- the control to remove.- Returns:
- A Message reference
-
getResponseType
Gets the protocol response message type for this request which produces at least one response.- Specified by:
getResponseTypein interfaceSingleReplyRequest- Returns:
- the message type of the response.
-
getResultResponse
The result containing response for this request.- Specified by:
getResultResponsein interfaceResultResponseRequest- Returns:
- the result containing response for this request
-
abandon
public void abandon()RFC 2251/4511 [Section 4.11]: Abandon, Bind, Unbind, and StartTLS operations cannot be abandoned.- Specified by:
abandonin interfaceAbandonableRequest- Overrides:
abandonin classAbstractAbandonableRequest
-
equals
Checks to see if two messages are equivalent. Messages equivalence does not factor in parameters accessible through the get() and put() operations, nor do they factor in the Lockable properties of the Message. Only the type, controls, and the messageId are evaluated for equality.- Overrides:
equalsin classAbstractRequest- Parameters:
obj- the object to compare this Message to for equality
-
hashCode
public int hashCode()- Overrides:
hashCodein classAbstractRequest- Returns:
- the instance's hash code
- See Also:
-
toString
-