允许备份AD登录Windows身份验证ASP.NET MVC应用程序

时间:2014-10-10 13:38:26

标签: asp.net asp.net-mvc authentication iis windows-authentication

我为一家为所有计算机使用活动目录的公司工作。每个人都有一个AD用户帐户,但这并不意味着他们一直使用它。有些用户仅将它们用于某些应用程序。在大多数情况下,所有普通用户只需在工作区域中使用通用登录。

我是MVC的新手,我正在努力学会以正确的方式做所有事情。我目前有一个用JAVA编写的应用程序,我需要转换为asp.net mvc。我想这样做是为了让以共享用户名登录的用户需要使用他们自己的AD凭据进行登录,以便在应用程序中进行身份验证并强制执行。

根据我在谷歌上的意义,我需要制作一个自定义身份验证方法。如果是这样,也许有人可以慷慨地指出我正确的方向。

非常感谢任何帮助。谢谢大家。

1 个答案:

答案 0 :(得分:1)

假设你在IIS7上,以前的IIS团队成员写了一个very useful blog on combining windows and forms authenticatio n。

我已经和我目前在生产内部网系统中使用它,以下是我对如何设置的评论

  1. 解锁和配置部分,然后才能在web.config中使用它们:
  2.   

    %windir%\ system32 \ inetsrv \ appcmd解锁配置/部分:anonymousAuthentication   %windir%\ system32 \ inetsrv \ appcmd解锁配置/部分:windowsAuthentication

    1. 在web.config中注册表单身份验证包装器配置部分:
    2.   

      section name =“formsAuthenticationWrapper”type =“Mvolo.Modules.FormsAuthConfigurationSection”

      1. 使用包装器替换内置的Forms身份验证模块:
      2.   

        <remove name="FormsAuthentication" />
        
        <add name="FormsAuthentication" type="Mvolo.Modules.FormsAuthModule" />
        

        1. 设置网关页面所需的设置:
        2.   

          <security>
          
            <!-- Enable IIS Windows authentication for the login page -->
          
            <authentication>
          
              <windowsAuthentication enabled="true" />
          
              <anonymousAuthentication enabled="false" />
          
            </authentication>
          
          </security>
          

          应该这样做。

相关问题