Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The server might support either <code>memberOf</code> or <code>isMemberOf</code>. These are attributes (in most servers these attributes are <em>virtual</em>, that is, they do not occupy any storage and are generated upon client request) whose presence in an object indicates the group membership of the object. Here is an example that assumes the server supports the <code>isMemberOf</code> attribute:</p> <pre><code>String[] getGroupMembership() { try { // SSL can be supported by using a SocketFactory SocketFactory socketFactory = createSocketFactory(); LDAPConnectionOptions options = new LDAPConnectionOptions(); options.setConnectTimeoutMillis(connectTimeoutMillis); // Try to connect to a single server. It is also possible to use // a 'ServerSet' for support of multiple servers. LDAPConnection ldapConnection = new LDAPConnection(socketFactory,options,hostname,port, userDN,userPassword); try { // Some broken directory servers, most notably the old Sun // directory servers, do not support the legal filter "(&amp;)". // If this is the case, use the present filter "(objectClass=*)" // instead. SearchRequest searchRequest = new SearchRequest(userDN,SearchScope.BASE,"(&amp;)","isMemberOf"); searchRequest.setResponseTimeoutMillis(responseTimeoutMillis); SearchResult searchResult = ldapConnection.search(searchRequest); if(searchResult.getEntryCount() == 1) { Entry entry = searchResult.getSearchEntry(userDN); return getAttributeValues("isMemberOf"); } } catch(LDAPException ex) { // Handle the exception } finally { ldapConnection.close(); } } catch(LDAPException ldapException) { // Handle the connection exception here } return null; } </code></pre> <h3>see also</h3> <ul> <li><a href="https://web.archive.org/web/20130713161416/http://www.ldapguru.info/ldap/ldap-programming-practices.html" rel="nofollow noreferrer">LDAP: Programming Practices</a></li> <li><a href="https://web.archive.org/web/20130702165700/http://www.ldapguru.info:80/ldap/ldap-search-best-practices.html" rel="nofollow noreferrer">LDAP: Search Best Practices</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload