gpt4 book ai didi

java - 使用 unboundid 更改 LDAP 中的用户密码

转载 作者:行者123 更新时间:2023-12-02 04:23:51 38 4
gpt4 key购买 nike

我正在尝试使用下面的代码更改 LDAP 中的用户密码,我不是 LDAP 的管理员,因此我与具有 ou=systemusers 的用户建立连接,它可以创建用户,并且将用户添加到组中。我知道用于更改的旧密码

PasswordModifyExtendedRequest passwordModifyRequest =
new PasswordModifyExtendedRequest(
"uid=test.user,ou=People,dc=example,dc=com", // The user to update
(String) null, // The current password for the user.
(String) null); // The new password. null = server will generate

PasswordModifyExtendedResult passwordModifyResult;
try
{
passwordModifyResult = (PasswordModifyExtendedResult)
connection.processExtendedOperation(passwordModifyRequest);
// This doesn't necessarily mean that the operation was successful, since
// some kinds of extended operations return non-success results under
// normal conditions.
}
catch (LDAPException le)
{
// For an extended operation, this generally means that a problem was
// encountered while trying to send the request or read the result.
passwordModifyResult = new PasswordModifyExtendedResult(
new ExtendedResult(le));
}

LDAPTestUtils.assertResultCodeEquals(passwordModifyResult,
ResultCode.SUCCESS);
String serverGeneratedNewPassword =
passwordModifyResult.getGeneratedPassword();

但我总是得到这个结果。

PasswordModifyExtendedResult(resultCode=50 (insufficient access rights), messageID=4, diagnosticMessage='You do not have sufficient privileges to perform password reset operations') 

知道旧密码后如何更改用户密码?

最佳答案

您必须以具有足够权限的用户身份登录才能执行该操作,或者更常见的是,以用户本人身份使用旧密码登录,当然,这是额外的健全性检查。或者 LDAP 服务器配置错误。

关于java - 使用 unboundid 更改 LDAP 中的用户密码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32435841/

38 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com