0

I need to set the attribute pwdReset to false through Java. My code works for all the other attributes, but this attribute's value remains false even if I set it to false. I don't get any error while modifying the attribute either. (I know this is an operational attribute and should not be changed explicitly but I do not have a choice as its value doesn't change to false even after the password is changed after reset.) Following is the code -

BasicAttribute attr = new BasicAttribute("pwdReset","FALSE");
modsList.add(new ModificationItem(DirContext.REPLACE_ATTRIBUTE, attr));
ModificationItem [] modsArr = modsList.toArray(new ModificationItem[modsList.size()]);
ctx.modifyAttributes(username, modsArr);

I have even tried Integer.toString(0), false etc. as values for the attribute but none worked. Could anybody please help?

Sayali
  • 356
  • 1
  • 2
  • 13
  • Why? The normal way this gets reset is by the user changing his password. The real issue here is why that isn't happening, and it will be because you're changing the password via code similar to the above, when you should be using the extended password-change operation. I've posted code for it here recently. – user207421 Jun 03 '15 at 08:41
  • No, even if I change the password by setting the userPassword attribute, it sets the pwdReset to null. However, a user login is required to do this. Since the reset has been performed by the Admin, the user will not know the password and hence cannot login. So, I need to set the pwdReset to false explicitly. – Sayali Jun 03 '15 at 08:59
  • That's what I'm trying tell you. Setting the password via a simple attribute modification isn't valid when you're using the ppolicy overlay. You have to use the extended operation. You're not. – user207421 Jun 03 '15 at 09:51

0 Answers0