如何在 Java 中读取 LDAP 密码策略

2022-01-17 00:00:00 passwords ldap java policy

我可以从 LDAP 中读取用户密码策略,例如过期时间或密码强度(最小长度等)等更多详细信息吗?我需要这些信息,以便我可以对保存在我的数据库中的用户使用相同的策略.我的 java 应用程序要求数据库中的用户必须与域同​​步.

Can i read user password policy from LDAP, like when it expires or more details like password strength (minimal length etc.) ? I need these information so I can use the same policy for users kept in my database. My java application require that users from the database have to be synchronized with domain.

推荐答案

如果你想通过 LDAP 查询获取密码策略,试试这个

If you want to get the password policy through LDAP queries try this

当前域中没有 PSO 策略

without PSO policy in your current domain

String searchDomain= "DC=company,DC=ORG";
String ldapQuery = "(&(objectClass=domainDNS))";
String ldapAttribute = "maxPwdAge";

如果您使用 PSO 策略,请尝试此代码

If you use a PSO policy try this code

String domainLookupString = "CN=UsersPSO,CN=Password Settings Container,CN=System,DC=company,DC=ORG";
String ldapFilterString = "(&(objectClass=msDS-PasswordSettings))";
String ldapAttribute = "msDS-MaximumPasswordAge"

相关文章