I am trying to write an application which would offer user to manage users on LDAP system. One feature of this is the functionality "Forgot Password".
- User uses my app to Reset his password
- I ask some security questions and if they are correct, I redirect him to new screen - new password screen.
- User provides new password only (as he has forgotten his old one)
- I use admin Context and reset the user password (using
modifyAttributes(..)
). - The LDAP system, set
pwdReset
totrue
indicating that password was changed by admin and must be changed by user.
Now, I do want to set this to false, coz I don't want user to change his password again (as he already did in above steps), so I explicitly modify it to false. But I get error
javax.naming.directory.SchemaViolationException: [LDAP: error code 65 - Object Class Violation]; remaining name 'cn=XXXX,ou=XXXXOU,O=XXXX'
What is the way around ? Is there some other alternative ?
For refernce, the code to reset pwdReset
is as under:
List<ModificationItem> modsList = new ArrayList<ModificationItem>();
BasicAttribute attribute = new BasicAttribute(ATTR_PASSWORDRESET, "false");
modsList.add(new ModificationItem(DirContext.REPLACE_ATTRIBUTE, attribute));
ModificationItem [] modsArr = modsList.toArray(new ModificationItem[modsList.size()]);
modsArr = modsList.toArray(new ModificationItem[modsList.size()]);
this.adminCtx.modifyAttributes(userName, modsArr);
And here is my pwdPolicy