Java – get internal properties of LDAP objects
•
Java
I tried to get LDAP user internal attributes, but I couldn't find how to get them
DirContext ctx = this.getDirContext(); List<Employee> list = new ArrayList<Employee>(); NamingEnumeration<SearchResult> results = null; try { SearchControls controls = new SearchControls(); controls.setSearchScope(SearchControls.SUBTREE_SCOPE); results = ctx.search("","(objectclass=person)",controls); while (results.hasMore()) { SearchResult searchResult = results.next(); Attributes attributes = searchResult.getAttributes(); String fullName = this.getValue(attributes.get("cn")); //so on... } // so on
From LDAP, I also want to get the internal attributes of each employee / individual By default, it does not return the internal attribute [ex: createtimestamp]
Solution
You will not be able to get any action properties unless you request them At the moment, you are not asking for any attributes, which is equivalent to constructing SearchControls, or calling SearchControls. later. Setreturningattributes (string []), use the parameter new string [] {"*"}: this gives you all non operational attributes
To get the operation properties, use the parameters new string [] {"*", ""}
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码