自定义角色提供程序与ActiveDirectory的认证 [英] Custom Role Provider with ActiveDirectory Authentication

查看:162
本文介绍了自定义角色提供程序与ActiveDirectory的认证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建基于ASP.NET的角色提供自定义角色提供商。我有3个表。一种针对用户,一个角色,一个用于UsersInRoles.The用户表没有密码列,因为用户用的ActiveDirectory验证。这就是我的方法为止。我不能让cusstom角色提供工作,任何人有像我这样的情况相同。你如何自定义角色提供程序与AD的作品?

I'm creating a custom Role provider based on the ASP.NET Role provider. I have 3 tables. One for Users, one for Roles, one for UsersInRoles.The Users table has no password column because the users are authenticated with ActiveDirectory. That's my approach so far. I can't get the cusstom Role Provider to work, anyone has the same situation like me. How do you make a custom Role provider works with AD?

推荐答案

我所做的:创建从 System.Web.Security.RoleProvider 继承的类,并选择单击时实现抽象类,从上下文菜单中:Roleprovider 。我只实现方法 GetRolesForUser (其它方法抛出 NotImplementedException )。

What I did: create a class which inherits from System.Web.Security.RoleProvider, and choose "Implement abstract class" from the context menu when clicking on : Roleprovider. I only implemented the method GetRolesForUser (the other methods throw NotImplementedException).

在某一点上我想我还需要落实的MembershipProvider,但一个简单的除了web.config中固定它(因为大会是不是在GAC,在类型属性,你只需要一提的命名空间+类型名称,而不是程序集名称等参数):

At a certain point I thought I also needed to implement the MembershipProvider, but a simple addition to web.config fixed it (since the assembly is not in the GAC, in the type-attribute, you only need to mention the namespace+type-name; not the assembly name and other parameters):

<configuration>
  <system.web>
    <roleManager enabled="true" defaultProvider="MyRoleProvider">
      <providers>
        <clear />
        <add name="MyRoleProvider" type="Namespace.To.MyRoleProvider" />
      </providers>
    </roleManager>
  </system.web>
</configuration>

有没有必要实施的 ValideUser 方法的的MembershipProvider

There is no need to implement the ValideUser method on a MembershipProvider.

这篇关于自定义角色提供程序与ActiveDirectory的认证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆