我正在尝试使用UNBoundID LDAP sdk更改AD密码,如下所示。
try{
LDAPConnection connection=new LDAPConnectionObject().getConnection();
PasswordModifyExtendedRequest passwordModifyRequest =
new PasswordModifyExtendedRequest(
user, // The user to update
oldPass, // The current password for the user.
newPass); // The new password. null = server will generate
PasswordModifyExtendedResult passwordModifyResult;
try
{
passwordModifyResult = (PasswordModifyExtendedResult)
connection.processExtendedOperation(passwordModifyRequest);
System.out.println("passwordModifyResult---"+passwordModifyResult);
}
catch (LDAPException le)
{
le.printStackTrace();
passwordModifyResult = new PasswordModifyExtendedResult(
new ExtendedResult(le));
}
LDAPTestUtils.assertResultCodeEquals(passwordModifyResult,
ResultCode.SUCCESS);
String serverGeneratedNewPassword =
passwordModifyResult.getGeneratedPassword();
}catch(LDAPException e){
e.printStackTrace();
}
}
如下所示抛出错误,
LDAPException(resultCode=2 (protocol error), errorMessage='0000203D: LdapErr: DSID-0C090C7D, comment: Unknown extended request OID, data 0, vece , diagnosticMessage='0000203D: LdapErr: DSID-0C090C7D, comment: Unknown extended request OID, data 0, vece
有谁可以请你纠正我?
提前致谢
答案 0 :(得分:2)
听起来像Active Directory(或者至少是您正在使用的安装)并不支持使用密码修改扩展操作。但是,如果正确构造修改,则可以使用LDAP修改操作更改用户密码。有关要求的说明和代码示例,请参阅http://www.dirmgr.com/blog/2010/8/26/ldap-password-changes-in-active-directory.html。