问题描述
我想创建一个身份验证与Active Directory(LDAP)混合会员,但是授权使用成员资格提供程序和角色。
I am trying to create a hybrid membership which authenticates with active directory (ldap) but authorizes using the membership provider and roles.
我不希望查询Active Directory为每个页面加载,但我想首先验证通过Active Directory用户,然后让成员提供授权用户通过web.config中的授权性访问的每个页面。
I do not want to query active directory for each page load, but I want to initially authenticate the user via active directory, and then allow the membership provider to authorize the users access to each page via the web.config authorization properties.
我是新来的.NET会员制模式以及如何实现这种类型的混合动力解决方案。我发现有很多的例子为实现与Web窗体的Active Directory,但不解决我的需要。
I am new to the .net membership model and how to implement this type of hybrid solution. I have found many examples for implementing Active Directory with Web Forms, but not a solution to my needs.
任何伪code或一般说明对这一解决方案也非常欢迎。
Any pseudocode or general description for this solution is also very welcome.
感谢您!
修订问题:目前正在研究落实的活动目录(AD)的成员/角色的架构之上的身份验证。基本上验证最初与AD,与用户更新会员数据库表/角色可以根据需要,设置作为认证与成员资格的用户,并允许成员来处理所有授权要求。虽然这不是干净,创建自定义成员资格/角色提供者,我想知道如果这个解决方案可以被认为是有效的?
UPDATED Question: Currently looking into implement the active directory (AD) authentication on top of the Membership/Roles schema. Basically authenticating initially with AD, updating the Membership database tables with the user/roles as needed, setting the user as authenticated with the Membership and allowing the membership to handle all authorization requirements. Although this is not as clean as creating Custom Membership/Role providers, I am wondering if this solution can be considered valid?
推荐答案
您可以通过实现自己的层中的成员资格提供上述这样做这样做以下
You can do this by implementing your own layer above the Membership provider by doing the following
- 您需要检查,如果用户在活动目录认证
- 之后,你将需要添加该用户,如果他不存在,您的会员数据库和角色并使用此以后,用于控制使用角色和其他的东西
- 后,可以开始设置的认证的cookie为该用户(如果用户是有效的),并将其添加到响应。
- 在每一次通过身份验证的用户请求一个页面,你就不会需要验证他对活动目录,你需要做的只是让匿名用户。
其大量的工作,但你可以做到这一点,毕竟你只需要阅读更多有关Asp.net会员
its a lot of work but you can do it, after all you just need to read more about Asp.net membership
这篇关于.NET活动目录(LDAP),其成员授权认证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!