Note that there are some explanatory texts on larger screens.

plurals
  1. POAuthentication via LDAP
    primarykey
    data
    text
    <p>I'm interested in how other people code this because I'm either not understanding it properly or I'm missing something or perhaps even I'm doing it right!</p> <p>First of all, this is NOT an Active Directory instance of LDAP its OpenDS which other than some syntactical differences shouldn't much matter. </p> <p>So assume I have my tree structure setup something like this:</p> <pre><code>-dc=somedomain,dc=com -uid=rootuser -ou=Group1 -uid=username1 -uid=username2 -ou=Group2 -uid=username3 -uid=username4 </code></pre> <p>In order to authenticate as the 'rootuser' I would need to pass the fully qualified Username when I create my System.DirectoryServices.DirectoryEntry object, in this case:</p> <p>uid=rootuser,dc=somedomain,dc=com</p> <p>but for any other user in the tree I have to know in advance what LDAP path to append to the username to have them authenticate thru. So for example this will fail:</p> <p>uid=username1,dc=somedomain,dc=com</p> <p>but this will work:</p> <p>uid=username1,dc=somedomain,dc=com,ou=Group1</p> <p>So my question is how do you handle this when you don't know at login time what specific group a user belongs to to build that path? The only way I can figure to do it is to make the initial call as 'rootuser' so I have access to the entire tree then use System.DirectoryServices.DirectorySearcher to scan it for that particular user (i.e. username1)</p> <pre><code>using (DirectorySearcher searcher = GetDirectorySearcher()) { searcher.Filter = "(&amp;(objectClass=person)(uid=" + userName+ "))"; SearchResult result = searcher.FindOne(); return result.GetDirectoryEntry().Path; } </code></pre> <p>at that point I have the path for the user I want to login and I can proceed with the actual auth. Am I way off base here or is this generally how it is done?</p> <p>thanks!</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. 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