【问题标题】:Is Active Directory authentication used?是否使用了 Active Directory 身份验证?
【发布时间】:2017-03-13 19:07:41
【问题描述】:

我继承了 MVC4 应用程序。看起来使用了 Windows 身份验证,但我也被告知“Active Directory 身份验证”用于某些权限。我在 web.config 中没有看到任何关于 Active Directory 的内容。 在 web.config 中:

<authentication mode="Windows" />
   <roleManager defaultProvider="DefaultRoleProvider">
      <providers>
         <add name="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=21bf1234ad634e53" connectionStringName="DefaultConnection" applicationName="/" />
       </providers>
   </roleManager>

在控制器中:

[Authorize(Roles = @"ABCD\EFG"), HandleError(ExceptionType = typeof(UnauthorizedAccessException), View = "UnauthorizedUser", Order = 1)]
public class HomeController : Controller
{ .............

}

public ActionResult MyAction()
{

    if (!User.IsInRole(@"ABCD\EFG"))
    {
        // some code
    }

    //.............

}

此应用程序中是否使用了“Active Directory 身份验证”?

谢谢

【问题讨论】:

    标签: asp.net-mvc-4 active-directory windows-authentication


    【解决方案1】:

    只要应用程序服务器在您的用户注册的域中,Windows 身份验证确实会与 Active Directory 集成。

    您的配置文件中的以下行启用了此类功能。

    <authentication mode="Windows" />
    

    这篇文章可能会帮助您进一步了解: Configure ASP.NET MVC for authentication against AD

    【讨论】:

    • 谢谢 StfBln,我看到了你推荐的帖子,让我感到困惑的是,在我的情况下,“匿名身份验证”与 WA 一起启用,并且没有“..deny..”声明用过的。使用 WA 似乎比那篇文章中的要简单得多?
    • 我的意思是 WA 和 AD
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-12
    • 2018-11-10
    相关资源
    最近更新 更多