1
Answer

Username authentication via Active Directory

tywin

tywin

15y
4.7k
1

Hello,

this is what i want to do: Check if a user is in a specific directory. Which means he or a group he belongs to can be in this specific directory so that the user gets access.

First of all i try to define the root directory for the search:

DirectoryEntry rootDirectory = new DirectoryEntry(LDAP://OU=c,OU=b,OU=a,DC=business,DC=ad,DC=company);

Is an OU unique? I thought not so the root to the desired directory is a->b->c therefore i am using all three OU's to define the root. The search should only happen in this rootDirectory!

So the questions: Is an OU unique? If not can i use multiple OU to define the root?

Ok after i define the root i create a DirectorySearcher Object

with filter format (SAMAccountName={0}) and memberof property to search for the current user.

If the group of a user is in the rootDirectory (which means he is authenticated) does this search find this user?

Thanks for your answers!

 

Answers (1)