2

我正在尝试使用 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

有人可以纠正我吗?

提前致谢

4

1 回答 1

3

听起来 Active Directory(或至少您正在使用的安装)不支持使用密码修改扩展操作。但是,如果您正确构建修改,则可以使用 LDAP 修改操作更改用户密码。有关要求的描述和代码示例,请参见http://www.dirmgr.com/blog/2010/8/26/ldap-password-changes-in-active-directory.html 。

于 2014-06-05T16:43:05.393 回答