我試圖讓一個DN用戶ID獲取DN在LDAP(可能不止一個)的用戶的時候我唯一的參數是用戶ID如何使用UnboundID LDAP SDK
也我使用UnboundID LDAP SDK,你可以看到:
public String getCustomerAdminDN(String uid)
{
String result =null;
String filter = "uid=" +uid;
try {
SearchResult searchResult = this.ldapConnection.search("",SearchScope.SUB,filter);
result = searchResult.getMatchedDN();
} catch (LDAPSearchException e) {
throw new RuntimeException("Error in the searching query :" + e.getMessage());
}
return result;
}
假設我的UID屬於從頭部