如何使用 LDAP 和 C# 将密码更改为任意字符串并重新应用密码策略?
您好,我正在尝试将用户的密码重置为“重置”,然后让用户在登录后更改密码。由于我们的密码策略中有一些规则不允许使用如此简单的密码,因此我们首先删除该策略,然后设置密码然后重新应用该策略。然而,当他们登录并尝试更改密码时,使用旧密码之一仍然有效。我们将 pwdInHistory 值设置为 5。代码如下:
de.Properties["pwdPolicySubentry"].Value = "";
de.CommitChanges();
changePassword(uid, "", "reset");
de.Properties["pwdPolicySubentry"].Value = POLICY;
de.CommitChanges();
Hi I am trying to reset a user's password to 'reset' then for the user to change it once they log in. Since we have some rules in our password policy to disallow such a simple password, we first remove the policy then set the password then reapply the policy. However when they login and try to change their password, using one of the old passwords still works. We have pwdInHistory value set to 5. Here is the code:
de.Properties["pwdPolicySubentry"].Value = "";
de.CommitChanges();
changePassword(uid, "", "reset");
de.Properties["pwdPolicySubentry"].Value = POLICY;
de.CommitChanges();
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的 LDAP 可能支持 RFC3062,即它可以为您生成新的符合策略的密码。消除了整个问题。
Your LDAP may support RFC3062, i.e. it can generate a new policy-compliant password for you. Eliminates the entire problem.