org.apache.directory.shared.ldap.message
Class BindRequestImpl

java.lang.Object
  extended by org.apache.directory.shared.ldap.message.internal.InternalAbstractMessage
      extended by org.apache.directory.shared.ldap.message.internal.InternalAbstractRequest
          extended by org.apache.directory.shared.ldap.message.AbstractAbandonableRequest
              extended by org.apache.directory.shared.ldap.message.BindRequestImpl
All Implemented Interfaces:
InternalAbandonableRequest, InternalBindRequest, InternalMessage, InternalRequest, InternalResultResponseRequest, SingleReplyRequest

public class BindRequestImpl
extends AbstractAbandonableRequest
implements InternalBindRequest

Bind protocol operation request which authenticates and begins a client session. Does not yet contain interfaces for SASL authentication mechanisms.

Version:
$Rev: 921600 $
Author:
Apache Directory Project

Field Summary
 InternalBindResponse response
          The associated response
 
Fields inherited from interface org.apache.directory.shared.ldap.message.internal.InternalBindRequest
RESP_TYPE, TYPE
 
Constructor Summary
BindRequestImpl(int id)
          Creates an BindRequest implementation to bind to an LDAP server.
 
Method Summary
 void abandon()
          RFC 2251/4511 [Section 4.11]: Abandon, Bind, Unbind, and StartTLS operations cannot be abandoned.
 boolean equals(java.lang.Object obj)
          Checks to see if two messages are equivalent.
 byte[] getCredentials()
          Gets the simple credentials associated with a simple authentication attempt or null if this request uses SASL authentication mechanisms.
 DN getName()
          Gets the distinguished name of the subject in this authentication request.
 MessageTypeEnum getResponseType()
          Gets the protocol response message type for this request which produces at least one response.
 InternalResultResponse getResultResponse()
          The result containing response for this request.
 java.lang.String getSaslMechanism()
          Gets the mechanism if this request uses SASL authentication mechanisms.
 boolean getSimple()
          Checks to see if the authentication mechanism is simple and not SASL based.
 boolean getVersion3()
          Gets whether or not the Ldap v3 protocol is used.
 int hashCode()
           
 boolean isSimple()
          Checks to see if the authentication mechanism is simple and not SASL based.
 boolean isVersion3()
          Checks to see if the Ldap v3 protocol is used.
 void setCredentials(byte[] credentials)
          Sets the simple credentials associated with a simple authentication attempt ignored if this request uses SASL authentication mechanisms.
 void setName(DN name)
          Sets the distinguished name of the subject in this authentication request.
 void setSaslMechanism(java.lang.String mechanism)
          Sets the mechanism associated with a SASL authentication
 void setSimple(boolean isSimple)
          Sets the authentication mechanism to simple or to SASL based authentication.
 void setVersion3(boolean isVersion3)
          Sets whether or not the LDAP v3 or v2 protocol is used.
 java.lang.String toString()
          Get a String representation of a BindRequest
 
Methods inherited from class org.apache.directory.shared.ldap.message.AbstractAbandonableRequest
addAbandonListener, isAbandoned
 
Methods inherited from class org.apache.directory.shared.ldap.message.internal.InternalAbstractRequest
hasResponse
 
Methods inherited from class org.apache.directory.shared.ldap.message.internal.InternalAbstractMessage
add, addAll, get, getControls, getMessageId, getType, hasControl, put, remove
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.directory.shared.ldap.message.internal.InternalRequest
hasResponse
 
Methods inherited from interface org.apache.directory.shared.ldap.message.internal.InternalMessage
add, addAll, get, getControls, getMessageId, getType, hasControl, put, remove
 
Methods inherited from interface org.apache.directory.shared.ldap.message.internal.InternalAbandonableRequest
addAbandonListener, isAbandoned
 

Field Detail

response

public InternalBindResponse response
The associated response

Constructor Detail

BindRequestImpl

public BindRequestImpl(int id)
Creates an BindRequest implementation to bind to an LDAP server.

Parameters:
id - the sequence identifier of the BindRequest message.
Method Detail

isSimple

public boolean isSimple()
Checks to see if the authentication mechanism is simple and not SASL based.

Specified by:
isSimple in interface InternalBindRequest
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:
getSimple in interface InternalBindRequest
Returns:
true if the mechanism is simple false if it is SASL based.

setSimple

public void setSimple(boolean isSimple)
Sets the authentication mechanism to simple or to SASL based authentication.

Specified by:
setSimple in interface InternalBindRequest
Parameters:
isSimple - true if authentication is simple, false otherwise.

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:
getCredentials in interface InternalBindRequest
Returns:
null if the mechanism is SASL or the credentials if it is simple.

setCredentials

public void setCredentials(byte[] credentials)
Sets the simple credentials associated with a simple authentication attempt ignored if this request uses SASL authentication mechanisms.

Specified by:
setCredentials in interface InternalBindRequest
Parameters:
credentials - the credentials if authentication is simple, null otherwise

getSaslMechanism

public java.lang.String getSaslMechanism()
Gets the mechanism if this request uses SASL authentication mechanisms.

Specified by:
getSaslMechanism in interface InternalBindRequest
Returns:
The mechanism if SASL.

setSaslMechanism

public void setSaslMechanism(java.lang.String mechanism)
Sets the mechanism associated with a SASL authentication

Specified by:
setSaslMechanism in interface InternalBindRequest
Parameters:
mechanism - the mechanism otherwise

getName

public DN getName()
Gets the distinguished 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 DN in the credentials.

Specified by:
getName in interface InternalBindRequest
Returns:
the DN of the authenticating user.

setName

public void setName(DN name)
Sets the distinguished 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 DN in the credentials.

Specified by:
setName in interface InternalBindRequest
Parameters:
name - the DN of the authenticating user - leave null for annonymous user.

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:
isVersion3 in interface InternalBindRequest
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:
getVersion3 in interface InternalBindRequest
Returns:
true if client using version 3 false if it is version 2.

setVersion3

public void setVersion3(boolean isVersion3)
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:
setVersion3 in interface InternalBindRequest
Parameters:
isVersion3 - if true the client will be exhibiting version 3 bind behavoir, if false is used version 2 behavoir will be exhibited.

getResponseType

public MessageTypeEnum getResponseType()
Gets the protocol response message type for this request which produces at least one response.

Specified by:
getResponseType in interface SingleReplyRequest
Returns:
the message type of the response.

getResultResponse

public InternalResultResponse getResultResponse()
The result containing response for this request.

Specified by:
getResultResponse in interface InternalResultResponseRequest
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:
abandon in interface InternalAbandonableRequest
Overrides:
abandon in class AbstractAbandonableRequest

equals

public boolean equals(java.lang.Object obj)
Description copied from class: InternalAbstractMessage
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:
equals in class InternalAbstractMessage
Parameters:
obj - the object to compare this Message to for equality
See Also:
Object.equals(Object)

hashCode

public int hashCode()
Overrides:
hashCode in class InternalAbstractRequest
Returns:
the instance's hash code
See Also:
Object.hashCode()

toString

public java.lang.String toString()
Get a String representation of a BindRequest

Overrides:
toString in class java.lang.Object
Returns:
A BindRequest String


Copyright © 2003-2011 Apache Software Foundation. All Rights Reserved.