views:

698

answers:

4

Hello,

In my current project, we need to authenticate users of an ASP.NET application against Active Directory. I think it can be achieved using the membership provider without too much problems. but we need also to manage user roles that will be kept in the ASP roles management tool.

Did anyone implement this configuration? Does it look feasible? Any tip for one or the other point?

Thanks. David

+2  A: 

There is an ActiveDirectoryMembershipProvider that can be used to use Active Directory for authenticating users.

Alternatively, you could roll your own MembershipProvider by extending the abstract MembershipProvider class and then use System.DirectoryServices to check against Active Directory when validating a user (ValidateUser method of MembershipProvider). This is pretty straightforward to do and you need only implement the methods that you actually need in the custom provider.

You might consider implementing your own RoleProvider too, depending on whether the default fits your needs.

Russ Cam
+1  A: 

Yes! The ASP.NET role provider is designed to work exactly in that case - the particulars of the authentication provider are irrelevant to the role provider, and it will store the bare essential information to make the two work together - basically the user's AD identity (domain\user) is tracked in the role database and matched up when necessary.

Rex M
A: 

Use it all the time, intranet only of course.

You may be interested in the WindowsTokenCachingRoleProvider. In scenarios where performance is essential, this really shines:

http://lvildosola.blogspot.com/2007/02/improve-performance-when-using.html

Simple and elegant.

Greg Askew
A: 

Please take a look at this question, seems like you're asking for pretty much the same thing, and my answer there should give you what you need.

ASP.NET Membership and Role providers that can be used from ASP.NET and WinForms/WPF clients as needed.

Timothy Walters