简体   繁体   中英

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:

I currently use LdapConnection to search for usernames like this:

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?

Thanks

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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