Interface PlainSASLBindRequest
-
- All Superinterfaces:
BindRequest,Request,SASLBindRequest
public interface PlainSASLBindRequest extends SASLBindRequest
The Plain SASL bind request as defined in RFC 4616. This SASL mechanism allows a client to authenticate to the server with an authentication ID and password. This mechanism does not provide a security layer.The authentication and optional authorization identity is specified using an authorization ID, or
authzId, as defined in RFC 4513 section 5.2.1.8.String authcid = ...; // Authentication ID, e.g. dn:<dn>, u:<uid> String authzid = ...; // Authorization ID, e.g. dn:<dn>, u:<uid> char[] password = ...; Connection connection = ...; // Use StartTLS to protect the request PlainSASLBindRequest request = Requests.newPlainSASLBindRequest(authcid, password) .setAuthorizationID(authzid); connection.bind(request); // Authenticated if the connection succeeds
-
-
Field Summary
Fields Modifier and Type Field Description static StringSASL_MECHANISM_NAMEThe name of the SASL mechanism based on PLAIN authentication.-
Fields inherited from interface org.forgerock.opendj.ldap.requests.BindRequest
AUTHENTICATION_TYPE_SASL, AUTHENTICATION_TYPE_SIMPLE
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description PlainSASLBindRequestaddControl(Control control)Adds the provided control to this request.BindClientcreateBindClient(String serverName)Creates a new bind client which can be used to perform the authentication process.StringgetAuthenticationID()Returns the authentication ID of the user.bytegetAuthenticationType()Returns the authentication mechanism identifier for this SASL bind request as defined by the LDAP protocol, which is always0xA3.StringgetAuthorizationID()Returns the optional authorization ID of the user which represents an alternate authorization identity which should be used for subsequent operations performed on the connection.<C extends Control>
CgetControl(ControlDecoder<C> decoder, DecodeOptions options)Decodes and returns the first control in this request having an OID corresponding to the provided control decoder.List<Control>getControls()Returns aListcontaining the controls included with this request.StringgetName()Returns the name of the Directory object that the client wishes to bind as, which is always the empty string for SASL authentication.byte[]getPassword()Returns the password of the user that the client wishes to bind as.StringgetSASLMechanism()Returns the SASL mechanism for this SASL bind request.PlainSASLBindRequestsetAuthenticationID(String authenticationID)Sets the authentication ID of the user.PlainSASLBindRequestsetAuthorizationID(String authorizationID)Sets the optional authorization ID of the user which represents an alternate authorization identity which should be used for subsequent operations performed on the connection.PlainSASLBindRequestsetPassword(byte[] password)Sets the password of the user that the client wishes to bind as.PlainSASLBindRequestsetPassword(char[] password)Sets the password of the user that the client wishes to bind as.-
Methods inherited from interface org.forgerock.opendj.ldap.requests.Request
containsControl
-
-
-
-
Field Detail
-
SASL_MECHANISM_NAME
static final String SASL_MECHANISM_NAME
The name of the SASL mechanism based on PLAIN authentication.- See Also:
- Constant Field Values
-
-
Method Detail
-
addControl
PlainSASLBindRequest addControl(Control control)
Description copied from interface:RequestAdds the provided control to this request.- Specified by:
addControlin interfaceBindRequest- Specified by:
addControlin interfaceRequest- Specified by:
addControlin interfaceSASLBindRequest- Parameters:
control- The control to be added to this request.- Returns:
- This request.
-
createBindClient
BindClient createBindClient(String serverName) throws LdapException
Description copied from interface:BindRequestCreates a new bind client which can be used to perform the authentication process. This method is called by protocol implementations and is not intended for use by applications.- Specified by:
createBindClientin interfaceBindRequest- Specified by:
createBindClientin interfaceSASLBindRequest- Parameters:
serverName- The non-null fully-qualified host name of the server to authenticate to.- Returns:
- The new bind client.
- Throws:
LdapException- If an error occurred while creating the bind client context.
-
getAuthenticationID
String getAuthenticationID()
Returns the authentication ID of the user. The authentication ID usually has the form "dn:" immediately followed by the distinguished name of the user, or "u:" followed by a user ID string, but other forms are permitted.- Returns:
- The authentication ID of the user.
-
getAuthenticationType
byte getAuthenticationType()
Returns the authentication mechanism identifier for this SASL bind request as defined by the LDAP protocol, which is always0xA3.- Specified by:
getAuthenticationTypein interfaceBindRequest- Specified by:
getAuthenticationTypein interfaceSASLBindRequest- Returns:
- The authentication mechanism identifier.
-
getAuthorizationID
String getAuthorizationID()
Returns the optional authorization ID of the user which represents an alternate authorization identity which should be used for subsequent operations performed on the connection. The authorization ID usually has the form "dn:" immediately followed by the distinguished name of the user, or "u:" followed by a user ID string, but other forms are permitted.- Returns:
- The authorization ID of the user, which may be
null.
-
getControl
<C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) throws DecodeException
Description copied from interface:RequestDecodes and returns the first control in this request having an OID corresponding to the provided control decoder.- Specified by:
getControlin interfaceBindRequest- Specified by:
getControlin interfaceRequest- Specified by:
getControlin interfaceSASLBindRequest- Type Parameters:
C- The type of control to be decoded and returned.- Parameters:
decoder- The control decoder.options- The set of decode options which should be used when decoding the control.- Returns:
- The decoded control, or
nullif the control is not included with this request. - Throws:
DecodeException- If the control could not be decoded because it was malformed in some way (e.g. the control value was missing, or its content could not be decoded).
-
getControls
List<Control> getControls()
Description copied from interface:RequestReturns aListcontaining the controls included with this request. The returnedListmay be modified if permitted by this request.- Specified by:
getControlsin interfaceBindRequest- Specified by:
getControlsin interfaceRequest- Specified by:
getControlsin interfaceSASLBindRequest- Returns:
- A
Listcontaining the controls.
-
getName
String getName()
Returns the name of the Directory object that the client wishes to bind as, which is always the empty string for SASL authentication.- Specified by:
getNamein interfaceBindRequest- Specified by:
getNamein interfaceSASLBindRequest- Returns:
- The name of the Directory object that the client wishes to bind as.
-
getPassword
byte[] getPassword()
Returns the password of the user that the client wishes to bind as.Unless otherwise indicated, implementations will store a reference to the returned password byte array, allowing applications to overwrite the password after it has been used.
- Returns:
- The password of the user that the client wishes to bind as.
-
getSASLMechanism
String getSASLMechanism()
Description copied from interface:SASLBindRequestReturns the SASL mechanism for this SASL bind request.- Specified by:
getSASLMechanismin interfaceSASLBindRequest- Returns:
- The SASL mechanism for this bind request.
-
setAuthenticationID
PlainSASLBindRequest setAuthenticationID(String authenticationID)
Sets the authentication ID of the user. The authentication ID usually has the form "dn:" immediately followed by the distinguished name of the user, or "u:" followed by a user ID string, but other forms are permitted.- Parameters:
authenticationID- The authentication ID of the user.- Returns:
- This bind request.
- Throws:
UnsupportedOperationException- If this bind request does not permit the authentication ID to be set.org.forgerock.i18n.LocalizedIllegalArgumentException- IfauthenticationIDwas non-empty and did not contain a valid authorization ID type.NullPointerException- IfauthenticationIDwasnull.
-
setAuthorizationID
PlainSASLBindRequest setAuthorizationID(String authorizationID)
Sets the optional authorization ID of the user which represents an alternate authorization identity which should be used for subsequent operations performed on the connection. The authorization ID usually has the form "dn:" immediately followed by the distinguished name of the user, or "u:" followed by a user ID string, but other forms are permitted.- Parameters:
authorizationID- The authorization ID of the user, which may benull.- Returns:
- This bind request.
- Throws:
UnsupportedOperationException- If this bind request does not permit the authorization ID to be set.org.forgerock.i18n.LocalizedIllegalArgumentException- IfauthorizationIDwas non-empty and did not contain a valid authorization ID type.
-
setPassword
PlainSASLBindRequest setPassword(byte[] password)
Sets the password of the user that the client wishes to bind as.Unless otherwise indicated, implementations will store a reference to the provided password byte array, allowing applications to overwrite the password after it has been used.
- Parameters:
password- The password of the user that the client wishes to bind as, which may be empty.- Returns:
- This bind request.
- Throws:
UnsupportedOperationException- If this bind request does not permit the password to be set.NullPointerException- Ifpasswordwasnull.
-
setPassword
PlainSASLBindRequest setPassword(char[] password)
Sets the password of the user that the client wishes to bind as. The password will be converted to a UTF-8 octet string.- Parameters:
password- The password of the user that the client wishes to bind as.- Returns:
- This bind request.
- Throws:
UnsupportedOperationException- If this bind request does not permit the password to be set.NullPointerException- Ifpasswordwasnull.
-
-