0

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

Alex Man
  • 4,746
  • 17
  • 93
  • 178
  • 1
    Possible duplicate of http://stackoverflow.com/questions/32435841/change-user-password-in-ldap-using-unboundid – Nurjan Dec 21 '16 at 07:02
  • @Nurzhan but there we need to pass the old password, my requirement is that admin should be able to change the users password without knowing their current password – Alex Man Dec 21 '16 at 07:05

2 Answers2

2

Alex,

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

I hope this helps.

Bertold Kolics
  • 892
  • 6
  • 11
1

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!

anacron
  • 6,443
  • 2
  • 26
  • 31