About Me

Tuesday, June 30, 2009

C# class to validate User credentials on Active Directory (LDAP)

I have seen a lot of folks trying to build a SSO int(er|ra)net web application, and end up using Windows Authentication because its tough for them to write a AD connector. Trust me guys its not too hard, not with google around :).

Anyway here's yet another SSO implementation (happens to be mine :)).

Its fairly easy to use the class. Just 2 public static routines. One to validate a user's credential, and the other to retrieve all users from the AD. Part one is self explanatory. Part two was important for me because I do roles management (and no I dont use Membership Providers - its either too little or too much).

Here's the full implementation. Let me know if you have trouble using it. btw, a sample usage: