Package com.unboundid.ldap.protocol
Class BindRequestProtocolOp
java.lang.Object
com.unboundid.ldap.protocol.BindRequestProtocolOp
- All Implemented Interfaces:
ProtocolOp,Serializable
@InternalUseOnly
@NotMutable
@ThreadSafety(level=COMPLETELY_THREADSAFE)
public final class BindRequestProtocolOp
extends Object
implements ProtocolOp
This class provides an implementation of an LDAP bind request protocol op.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final byteThe credentials type for SASL bind requests.static final byteThe credentials type for simple bind requests. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new bind request protocol op from the provided bind request object.BindRequestProtocolOp(SimpleBindRequest request) Creates a new bind request protocol op from the provided bind request object.BindRequestProtocolOp(String bindDN, byte[] password) Creates a new bind request protocol op for a simple bind.BindRequestProtocolOp(String bindDN, String password) Creates a new bind request protocol op for a simple bind.BindRequestProtocolOp(String bindDN, String saslMechanism, ASN1OctetString saslCredentials) Creates a new bind request protocol op for a SASL bind. -
Method Summary
Modifier and TypeMethodDescriptionstatic BindRequestProtocolOpdecodeProtocolOp(ASN1Element element) Decodes the provided ASN.1 element as a bind request protocol op.Encodes this protocol op to an ASN.1 element suitable for inclusion in an encoded LDAP message.Retrieves the bind DN for this bind request.byteRetrieves the credentials type for this bind request.byteRetrieves the BER type for this protocol op.Retrieves the credentials to use for SASL authentication, if any.Retrieves the name of the SASL mechanism for this bind request.Retrieves the password to use for simple authentication.intRetrieves the protocol version for this bind request.toBindRequest(Control... controls) Creates a new bind request object from this bind request protocol op.toString()Retrieves a string representation of this protocol op.voidtoString(StringBuilder buffer) Appends a string representation of this LDAP protocol op to the provided buffer.voidwriteTo(ASN1Buffer buffer) Writes an ASN.1-encoded representation of this LDAP protocol op to the provided ASN.1 buffer.
-
Field Details
-
CRED_TYPE_SIMPLE
The credentials type for simple bind requests.- See Also:
-
CRED_TYPE_SASL
The credentials type for SASL bind requests.- See Also:
-
-
Constructor Details
-
BindRequestProtocolOp
Creates a new bind request protocol op for a simple bind.- Parameters:
bindDN- The DN for this bind request.password- The password for this bind request.
-
BindRequestProtocolOp
Creates a new bind request protocol op for a simple bind.- Parameters:
bindDN- The DN for this bind request.password- The password for this bind request.
-
BindRequestProtocolOp
public BindRequestProtocolOp(@Nullable String bindDN, @NotNull String saslMechanism, @Nullable ASN1OctetString saslCredentials) Creates a new bind request protocol op for a SASL bind.- Parameters:
bindDN- The DN for this bind request.saslMechanism- The name of the SASL mechanism for this bind request. It must not benull.saslCredentials- The SASL credentials for this bind request, if any.
-
BindRequestProtocolOp
Creates a new bind request protocol op from the provided bind request object.- Parameters:
request- The simple bind request to use to create this protocol op. It must have been created with a static password rather than using a password provider.- Throws:
LDAPSDKUsageException- If the provided simple bind request is configured to use a password provider rather than a static password.
-
BindRequestProtocolOp
Creates a new bind request protocol op from the provided bind request object.- Parameters:
request- The generic SASL bind request to use to create this protocol op.
-
-
Method Details
-
getVersion
Retrieves the protocol version for this bind request.- Returns:
- The protocol version for this bind request.
-
getBindDN
Retrieves the bind DN for this bind request.- Returns:
- The bind DN for this bind request, or an empty string if none was provided.
-
getCredentialsType
Retrieves the credentials type for this bind request. It will either beCRED_TYPE_SIMPLEorCRED_TYPE_SASL.- Returns:
- The credentials type for this bind request.
-
getSimplePassword
Retrieves the password to use for simple authentication.- Returns:
- The password to use for simple authentication, or
nullif SASL authentication will be used.
-
getSASLMechanism
Retrieves the name of the SASL mechanism for this bind request.- Returns:
- The name of the SASL mechanism for this bind request, or
nullif simple authentication will be used.
-
getSASLCredentials
Retrieves the credentials to use for SASL authentication, if any.- Returns:
- The credentials to use for SASL authentication, or
nullif there are no SASL credentials or if simple authentication will be used.
-
getProtocolOpType
Retrieves the BER type for this protocol op.- Specified by:
getProtocolOpTypein interfaceProtocolOp- Returns:
- The BER type for this protocol op.
-
encodeProtocolOp
Encodes this protocol op to an ASN.1 element suitable for inclusion in an encoded LDAP message.- Specified by:
encodeProtocolOpin interfaceProtocolOp- Returns:
- The ASN.1 element containing the encoded protocol op.
-
decodeProtocolOp
@NotNull public static BindRequestProtocolOp decodeProtocolOp(@NotNull ASN1Element element) throws LDAPException Decodes the provided ASN.1 element as a bind request protocol op.- Parameters:
element- The ASN.1 element to be decoded.- Returns:
- The decoded bind request protocol op.
- Throws:
LDAPException- If the provided ASN.1 element cannot be decoded as a bind request protocol op.
-
writeTo
Writes an ASN.1-encoded representation of this LDAP protocol op to the provided ASN.1 buffer. This method is intended for internal use only and should not be used by third-party code.- Specified by:
writeToin interfaceProtocolOp- Parameters:
buffer- The ASN.1 buffer to which the encoded representation should be written.
-
toBindRequest
Creates a new bind request object from this bind request protocol op.- Parameters:
controls- The set of controls to include in the bind request. It may be empty ornullif no controls should be included.- Returns:
- The bind request that was created.
-
toString
Retrieves a string representation of this protocol op. -
toString
Appends a string representation of this LDAP protocol op to the provided buffer.- Specified by:
toStringin interfaceProtocolOp- Parameters:
buffer- The buffer to which the string representation should be appended.
-