简体   繁体   中英

Not able to reset AD password from Java using LDAP

I'm trying to reset user password from java using LDAP. Code as below :

System.out.println("Inside Password Reset");
//String Password = Long.toHexString(Double.doubleToLongBits(Math.random()));
String Password = "Password5";
ModificationItem[] mods = new ModificationItem[1];
Attribute mod0 = new BasicAttribute("userpassword", Password);
mods[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, mod0);
System.out.println("Updated Password: " + Password);
dctx.modifyAttributes("cn=xxx,ou=xxx,dc=xxx,dc=xxx",mods);
System.out.println("Attributes to be modified are :" + mods);

Doesn't give any error but when I try to login to that user using the new password it doesn't work.

我启用了到AD的SSL连接,并能够重设密码。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM