简体   繁体   中英

Changing LDAP users password

I have established a LDAP Connection using admin credentials like as shown below

LDAPConnection connection;
try {
    connection = new LDAPConnection("example.domain.com", 345);  
    BindResult auth = connection.bind("adminUsername","adminPassword");

} catch (LDAPException e) {
    System.out.println(e);
} 

The connection is successfully.

Now the requirement is admin wants to change the users password.

Can anyone please tell me how we can do that

I am using unboundid-ldap-sdk-for-java

LDAP servers that I have worked with generally have an attribute named userPassword that contains (as you rightly guessed!) the user's password. After you perform a bind using the admin credentials, you will need to lookup the user's profile whose password you want to change and then set the new password to the userPassword attribute. Since you are using the admin ID, you will not need to know the old password.

Hope this helps!

Alex,

Here is an example: https://gist.github.com/bertold/002491a2630a98d80733b8228f75b75c

I hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM