public class BindRequestDecorator extends SingleReplyRequestDecorator<BindRequest,BindResponse> implements BindRequest
messageLength
RESP_TYPE, TYPE
Constructor and Description |
---|
BindRequestDecorator(LdapApiService codec,
BindRequest decoratedMessage)
Makes a BindRequest a MessageDecorator.
|
Modifier and Type | Method and Description |
---|---|
BindRequest |
addAllControls(Control[] controls)
Adds an array of controls to this Message.
|
BindRequest |
addControl(Control control)
Adds a control to this Message.
|
int |
computeLength()
Compute the BindRequest length
BindRequest :
|
ByteBuffer |
encode(ByteBuffer buffer)
Encode the BindRequest message to a PDU.
|
int |
getBindRequestLength() |
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.
|
int |
getSaslCredentialsLength() |
String |
getSaslMechanism()
Gets the SASL mechanism String associated with this BindRequest if the
bind operation is using SASL.
|
int |
getSaslMechanismLength() |
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.
|
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.
|
BindRequest |
removeControl(Control control)
Deletes a control removing it from this Message.
|
void |
setBindRequestLength(int bindRequestLength)
Stores the encoded length for the BindRequest
|
BindRequest |
setCredentials(byte[] credentials)
Sets the simple credentials associated with a simple authentication
attempt.
|
BindRequest |
setCredentials(String credentials)
Sets the simple credentials associated with a simple authentication
attempt.
|
BindRequest |
setMessageId(int messageId)
Sets the Message ID for this request
|
BindRequest |
setName(Dn name)
Sets the distinguished name of the subject in this authentication
request.
|
void |
setSaslCredentialsLength(int saslCredentialsLength)
Stores the encoded length for the SaslCredentials
|
BindRequest |
setSaslMechanism(String saslMechanism)
Sets the SASL mechanism String associated with this BindRequest if the
bind operation is using SASL.
|
void |
setSaslMechanismLength(int saslMechanismLength)
Stores the encoded length for the Mechanism
|
BindRequest |
setSimple(boolean isSimple)
Sets the authentication mechanism to simple or to SASL based
authentication.
|
BindRequest |
setVersion3(boolean isVersion3)
Sets whether or not the LDAP v3 or v2 protocol is used.
|
abandon, addAbandonListener, getResponseType, isAbandoned
getResultResponse, hasResponse
get, getCodecService, getControl, getControls, getControlsLength, getCurrentControl, getDecorated, getDecorator, getMessageId, getMessageLength, getType, hasControl, put, setControlsLength, setMessageLength, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getResponseType
getResultResponse
hasResponse
get, getControl, getControls, getMessageId, getType, hasControl, put
abandon, addAbandonListener, isAbandoned
public BindRequestDecorator(LdapApiService codec, BindRequest decoratedMessage)
decoratedMessage
- the decorated BindRequests.public void setBindRequestLength(int bindRequestLength)
bindRequestLength
- The encoded lengthpublic int getBindRequestLength()
public void setSaslCredentialsLength(int saslCredentialsLength)
saslCredentialsLength
- The encoded lengthpublic int getSaslCredentialsLength()
public void setSaslMechanismLength(int saslMechanismLength)
saslMechanismLength
- The encoded lengthpublic int getSaslMechanismLength()
public BindRequest setMessageId(int messageId)
setMessageId
in interface BindRequest
setMessageId
in interface Message
setMessageId
in class MessageDecorator<BindRequest>
messageId
- The message Idpublic BindRequest addControl(Control control) throws MessageException
addControl
in interface BindRequest
addControl
in interface Message
addControl
in class MessageDecorator<BindRequest>
control
- the control to add.MessageException
- if controls cannot be added to this Message or the control is
not known etc.public BindRequest addAllControls(Control[] controls) throws MessageException
addAllControls
in interface BindRequest
addAllControls
in interface Message
addAllControls
in class MessageDecorator<BindRequest>
controls
- the controls to add.MessageException
- if controls cannot be added to this Message or they are not known etc.public BindRequest removeControl(Control control) throws MessageException
removeControl
in interface BindRequest
removeControl
in interface Message
removeControl
in class MessageDecorator<BindRequest>
control
- the control to remove.MessageException
- if controls cannot be added to this Message or the control is
not known etc.public boolean isSimple()
isSimple
in interface BindRequest
public boolean getSimple()
getSimple
in interface BindRequest
public BindRequest setSimple(boolean isSimple)
setSimple
in interface BindRequest
isSimple
- true if authentication is simple, false otherwise.public byte[] getCredentials()
getCredentials
in interface BindRequest
public BindRequest setCredentials(String credentials)
setCredentials
in interface BindRequest
credentials
- the credentials if authentication is simplepublic BindRequest setCredentials(byte[] credentials)
setCredentials
in interface BindRequest
credentials
- the credentials if authentication is simplepublic Dn getName()
getName
in interface BindRequest
public BindRequest setName(Dn name)
setName
in interface BindRequest
name
- the Dn of the authenticating user - leave null for annonymous user.public boolean isVersion3()
isVersion3
in interface BindRequest
public boolean getVersion3()
getVersion3
in interface BindRequest
public BindRequest setVersion3(boolean isVersion3)
setVersion3
in interface BindRequest
isVersion3
- if true the client will be exhibiting version 3 bind behavior,
If false is used version 2 behavior will be exhibited.public String getSaslMechanism()
getSaslMechanism
in interface BindRequest
public BindRequest setSaslMechanism(String saslMechanism)
setSaslMechanism
in interface BindRequest
saslMechanism
- the SASL mechanismpublic int computeLength()
0x60 L1 | +--> 0x02 0x01 (1..127) version +--> 0x04 L2 name +--> authentication L2 = Length(name) L3/4 = Length(authentication) Length(BindRequest) = Length(0x60) + Length(L1) + L1 + Length(0x02) + 1 + 1 + Length(0x04) + Length(L2) + L2 + Length(authentication)
computeLength
in interface Decorator<BindRequest>
public ByteBuffer encode(ByteBuffer buffer) throws EncoderException
0x60 LL 0x02 LL version 0x80 LL simple 0x04 LL name / authentication.encode() \ 0x83 LL mechanism [0x04 LL credential]
encode
in interface Decorator<BindRequest>
buffer
- The buffer where to put the PDUEncoderException
- if the buffer can't be encodedCopyright © 2003-2014 The Apache Software Foundation. All Rights Reserved.