Search code examples
javaldapunboundid-ldap-sdkopendj

OpenDJ with UnboundId LDAP SDK for Java


I got the following problem. There is working OpenDJ server, connection using UnboundID LDAP SKD for Java. I learned how to search for particular entries, but what is the way to obtain value of "entryUUID" attribute for a given entry? OpenDJ says that is one of "non-editable attributes" and I can't see any of those in SearchResultEntry object using getAttributes() method.

I mean something like:

public String getUserUUID(String cn) {
   SearchResult sr = connection.search(dn, SearchScope.SUB, Filter.createEqualityFilter("cn",          cn));
   if (sr.getEntryCount() > 0){     
       return sr.getSearchEntries().get(0).getAttributeValue("entryUUID");
   }
}

But in attributes map in SearchResultEntry there is no parameters "non-editable parameters"


Solution

  • EntryUUID is a non-editable OPERATIONAL attribute. With LDAP, the operational attributes are only returned when searching, if you have specifically requested them. In your case, the search request doesn't specify the requested attributes, and thus implies to return all user attributes. I'm pretty sure UnboundID SDK has a search method which accepts a list of attributes to return.

    Regards, Ludovic