简体   繁体   English

修改LDAP用户密码

[英]Changing LDAP users password

I have established a LDAP Connection using admin credentials like as shown below 我已经使用管理员凭证建立了LDAP连接,如下所示

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 我正在为Java使用unboundid-ldap-sdk-

LDAP servers that I have worked with generally have an attribute named userPassword that contains (as you rightly guessed!) the user's password. 我使用过的LDAP服务器通常具有一个名为userPassword的属性,该属性包含(正如您正确猜到的那样)用户的密码。 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. 使用管理员凭据执行绑定后,您将需要查找要更改其密码的用户个人资料,然后将新密码设置为userPassword属性。 Since you are using the admin ID, you will not need to know the old password. 由于您使用的是管理员ID,因此您无需知道旧密码。

Hope this helps! 希望这可以帮助!

Alex, 亚历克斯

Here is an example: https://gist.github.com/bertold/002491a2630a98d80733b8228f75b75c 这是一个例子: https : //gist.github.com/bertold/002491a2630a98d80733b8228f75b75c

I hope this helps. 我希望这有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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