我们的系统需要连接到广告创建用户,更改用户密码。我可以创建用户成功,也可以成功更改其他属性。但是如果我改变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;
}
暂无答案!
目前还没有任何答案,快来回答吧!