Test if a given username can be found in the LDAP server using the authentication and filter settings provided to Rocket.Chat. Make sure LDAP is enabled in Settings > LDAP > Enable before using this endpoint.
Permission required: test-admin-options.
Changelog
| Version | Description |
|---|---|
| 9.0.0 | Moved to premium plans. Requires a license with the ldap-enterprise module. |
| 9.0.0 | Added the LDAP_Bind_failed, LDAP_User_not_found, and LDAP_Multiple_users_found errors. |
The authenticated user token.
The authenticated user ID.
{
"username": "bob"
}The username that you want to search.
OK
{
"message": "LDAP_User_Found",
"success": true
}Bad Request
Username missing
The request body doesn't include username.
{
"success": false,
"error": "must have required property 'username'",
"errorType": "error-invalid-params"
}LDAP bind failed
Rocket.Chat couldn't bind to the LDAP server with the authentication user DN and password. details.error contains the LDAP server's error.
{
"success": false,
"error": "LDAP_Bind_failed",
"details": {
"error": "Invalid Credentials"
}
}User not found
No LDAP user matches the username. Wildcard characters in username are not expanded, so a search for * also returns this error.
{
"success": false,
"error": "LDAP_User_not_found"
}More than one user found
More than one LDAP user matches the username. details.total contains the number of matches.
{
"success": false,
"error": "LDAP_Multiple_users_found",
"details": {
"total": "2"
}
}Premium license required
The workspace doesn't have a premium license with the ldap-enterprise module.
{
"success": false,
"error": "This is an enterprise feature [error-action-not-allowed]",
"errorType": "error-action-not-allowed"
}Search failed
The search failed for another reason, for example the LDAP server is unreachable, the base DN doesn't exist, the search filter is invalid, or username is empty.
{
"success": false,
"error": "LDAP_search_failed"
}LDAP is disabled
LDAP is not enabled in the workspace (LDAP_Enable is off).
{
"success": false,
"error": "LDAP_disabled"
}The LDAP server's error. Returned with LDAP_Bind_failed.
The number of matching users. Returned with LDAP_Multiple_users_found.
Unauthorized
{
"success": false,
"error": "You must be logged in to do this."
}Forbidden
Missing permission
The user doesn't have the test-admin-options permission.
{
"success": false,
"error": "User does not have the permissions required for this action [error-unauthorized]"
}