简体   繁体   English

如何使用 UnboundID LDAP SDK 在 Java 中检查 LDAP 用户帐户是否已过期

[英]How to check if LDAP user account is expired in Java using UnboundID LDAP SDK

I have a working LdapConnection object that I can use to bind and search with, but I am quite new to UnboundID LDAP SDK and was wondering if there is a way for me to find information about the users account from an LDAP search:我有一个可用的 LdapConnection 对象,可用于绑定和搜索,但我对 UnboundID LDAP SDK 还很陌生,想知道是否有办法从 LDAP 搜索中查找有关用户帐户的信息:

I currently use LdapConnection to search for usernames like this:我目前使用 LdapConnection 来搜索这样的用户名:

SearchResult searchResult = ldapConnection.search(configuration.sBase, scope, filter)

Is there a way I can use this connection to find expired/disabled accounts?有没有办法可以使用此连接查找过期/禁用的帐户?

So it looks like expired users are found with this:所以看起来过期的用户是这样发现的:

(&(objectCategory=Person)(objectClass=User)(!accountExpires=0)(!accountExpires=9223372036854775807)) 

can I make a filter with this string to search ldap and return all users with the LdapConnection object from unboundID Ldap?我可以用这个字符串做一个过滤器来搜索 ldap 并从 unboundID Ldap 返回所有带有 LdapConnection 对象的用户吗?

Thanks谢谢

在 Active Directory 中,您可以使用属性:UserStatus,它是一个布尔值,如果为 true,则帐户已启用,否则为禁用,您还可以在创建新用户时设置 AccountExpires 属性,默认情况下为 0,因此帐户永不过期,您如果您想要临时帐户,可以更改它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM