Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In our LDAP autenthication routines, we create a <code>jndi</code> user account that the application uses to authenticate itself in the LDAP, once the application stablishes the connection using the distinguished name of the jndi user (example: <code>uid=jndi,ou=branch,dc=com,dc=your,dc=organization</code>) then (provided a branch for the user nodes in the tree) it uses the following code to check if the user <code>uid</code> is in the LDAP tree:</p> <pre><code>public String findUserDnByBranchAndUid(String branchName, String uid) throws NamingException { SearchControls searchControls = new SearchControls(); searchControls.setSearchScope(SearchControls.SUBTREE_SCOPE); searchControls.setCountLimit(1); NamingEnumeration&lt;SearchResult&gt; answer; answer = dirContext.search(branchName, String.format("(uid=%s)", uid), searchControls); if (answer.hasMoreElements()) { SearchResult searchResult = answer.nextElement(); return searchResult.getNameInNamespace(); } else { return null; } } </code></pre> <p>Calling it like this:</p> <pre><code>String userDn = findUserDnByBranchAndUid("ou=users,dc=com,dc=your,dc=organization", "jsmith"); </code></pre> <p>If <code>userDn</code> is not empty, then the user exists in the tree, then we proceed to establish a new conection using that DN (and the user password) instead of the jndi user DN. </p> <p>If everithing goes well, then the user <code>jsmith</code> is logged in with it's credentials with just his/her id, without providing any not user-friendly DN.</p>
    singulars
    1. This table or related slice is empty.
    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. VO
      singulars
      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