开发者

ASP .NET authentication against Active Directory and Roles via ASP.NET role provider

In my current project, we need to authenticate users of an ASP.NET application against Active Direc开发者_如何学Ctory. 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


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.


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.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜