Getting the internal attributes of an LDAP object

I am trying to get the internal attributes of an LDAP user, but could not find a way to retrieve

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 / person. By default, it does not return internal attributes [ex: createTimestamp]

enter image description here

+6
source share
1 answer

You will not receive any operational attributes unless you ask for them. You are not currently requesting any attributes, which is equivalent to constructing SearchControls or calling SearchControls.setReturningAttributes(String[]) after that, using the argument new String[]{"*"}: this gives you all the broken attributes.

To get operational attributes, use the argument new String[]{"*","+"} .

+12
source

Source: https://habr.com/ru/post/953134/


All Articles