通过 ASP.NET 角色提供程序针对 Active Directory 和角色进行 ASP .NET 身份验证
在我当前的项目中,我们需要根据 Active Directory 对 ASP.NET 应用程序的用户进行身份验证。我认为使用会员提供商可以实现这一点,不会有太多问题。但我们还需要管理将保留在 ASP 角色管理工具中的用户角色。
有人实现过这个配置吗?看起来可行吗? 对于这一点或另一点有什么建议吗?
谢谢。 大卫
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
是的! ASP.NET 角色提供程序被设计为在这种情况下准确工作 - 身份验证提供程序的详细信息与角色提供程序无关,它将存储使两者协同工作的基本信息 - 基本上是用户的 AD 身份(域\user) 在角色数据库中进行跟踪并在必要时进行匹配。
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.
有一个可以使用的 ActiveDirectoryMembershipProvider使用 Active Directory 来验证用户身份。
或者,您可以通过扩展抽象 MembershipProvider 类来滚动您自己的 MembershipProvider然后在验证用户时使用 System.DirectoryServices 检查 Active Directory (MembershipProvider 的 ValidateUser 方法)。这非常简单,您只需要在自定义提供程序中实现您实际需要的方法。
您也可以考虑实现自己的 RoleProvider,具体取决于默认值是否满足您的需求。
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.
一直使用它,当然仅限于内部网。
您可能对 WindowsTokenCachingRoleProvider 感兴趣。在性能至关重要的场景中,这确实很重要:
http:// /lvildosola.blogspot.com/2007/02/improve-performance-when-using.html
简单而优雅。
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.
请看一下这个问题,看来您要求的东西几乎相同,我的回答应该可以满足您的需求。
可以根据需要从 ASP.NET 和 WinForms/WPF 客户端使用的 ASP.NET 成员资格和角色提供程序。
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.