Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/389.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何更改;“用户密码”;active directory的属性使用java jndi?;_Java_Active Directory_Jndi - Fatal编程技术网

如何更改;“用户密码”;active directory的属性使用java jndi?;

如何更改;“用户密码”;active directory的属性使用java jndi?;,java,active-directory,jndi,Java,Active Directory,Jndi,我们的系统需要连接到广告创建用户,更改用户密码。我可以创建用户成功,也可以成功更改其他属性。但是如果我更改javax.naming.NoPermissionException的错误 更新pwd功能: public boolean updateAdPasswordForStudent(Student student) { if (!studentExistOnAD(student)) { return createAdAccountForStudent(st

我们的系统需要连接到广告创建用户,更改用户密码。我可以创建用户成功,也可以成功更改其他属性。但是如果我更改javax.naming.NoPermissionException的错误

更新pwd功能:

public boolean updateAdPasswordForStudent(Student student) {
        if (!studentExistOnAD(student)) {
            return createAdAccountForStudent(student);
        }

        try {

            ModificationItem[] mods = new ModificationItem[1];
            mods[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, new BasicAttribute("userPassword", student.getPassword()));


            ldapConnection.modifyAttributes("cn=" + student.getStudentNum() + baseDirectoryOfStudent, mods);
        } catch (Exception e) {
            e.printStackTrace();
            log.error("Failed update AD password for student {}.", student.getStudentNum());
        }

        return false;
    }

如果更改“userPassword”属性,则会出现错误javax.naming.nopermissionexception您没有更改用户密码的权限。这不是编程问题。您需要以具有该权限的用户身份绑定到AD。如果更改“userPassword”属性,则会出现错误javax.naming.NoPermissionException您没有更改用户密码的权限。这不是编程问题。您需要以具有该权限的用户身份绑定到AD。