Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Easy way to test an LDAP User's Credentials

Is there an easy way to test the credentials of a user against an LDAP instance? I know how to write a Java program that would take the 'User DN' and password, and check it against the LDAP instance. However is there any easier way? Specially a method that not only authenticates the user, but also lists all the user's roles.

like image 295
user1888243 Avatar asked Apr 27 '13 02:04

user1888243


People also ask

How do I authenticate someone using LDAP?

In order to authenticate a user with an LDAP directory you first need to obtain their DN as well as their password. With a login form, people typically enter a simple identifier such as their username or email address. You don't expect them to memorise the DN of their directory entry.

How does LDAP validate username and password?

Steps. Go to the System → Password Credential Validators screen, and then click Create New Instance. On the Type screen, select LDAP Username Password Credential Validator from the list and provide a name and an ID for it.


1 Answers

ldapwhoami -vvv -h <hostname> -p <port> -D <binddn> -x -w <passwd>, where binddn is the DN of the person whose credentials you are authenticating.

On success (i.e., valid credentials), you get Result: Success (0). On failure, you get ldap_bind: Invalid credentials (49).

like image 50
Yuvika Avatar answered Sep 20 '22 23:09

Yuvika