【问题标题】:Retrieving password expiry date and remaining days to expiry date检索密码到期日期和剩余天数到到期日期
【发布时间】:2019-12-09 16:42:33
【问题描述】:

我正在尝试检索密码的最长使用期限和特定用户的最后密码设置日期,以计算他/她的剩余天数。

但是我在获取 maxPwdAge 和 maxLastSet 的值时遇到问题,因为 context.getStringAttribute("pwdMaxAge") 和 context.getStringAttribute("pwdLastSet") 返回 null 而我可以取回用户名和显示名。

属性“maxPwdAge”和“maxLastSet”是否适合用于spring ldap?

@Override public LdapUser mapFromContext(Object ctx) {
  DirContextAdapter context = (DirContextAdapter) ctx;
  LdapUser ldapUser = new LdapUser();

  ldapUser.setName(context.getStringAttribute("name"));
  ldapUser.setGivenName(context.getStringAttribute("displayName"));
  ldapUser.setPwdAge(context.getStringAttribute("pwdMaxAge"));
  ldapUser.setPwdLastSet(context.getStringAttribute("pwdLastSet));

  return ldapUser;
}

【问题讨论】:

标签: passwords spring-ldap


【解决方案1】:

maxPwdAge 存储在域控制器基础的对象类“domain”或“domainDns”中。

query().base(DC=test,DC=local).searchScope(SearchScope.OBJECT).where("objectclass").is("domain")

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-20
    相关资源
    最近更新 更多