【问题标题】:ASP.Net Core: IIS Active Directory Authentication - Not using Pool IdentityASP.Net Core:IIS Active Directory 身份验证 - 不使用池标识
【发布时间】:2019-01-26 05:48:49
【问题描述】:

我们的 ASP.NET Core 应用与 Windows 身份验证配合良好,通过以下方式正确保护应用:

[Authorize(Roles = "ABC\\MyGroup")]

但是,当我们将应用程序移至另一台服务器时,运行应用程序的池无权访问 Active Directory。在 Setup.cs 中,我如何告诉 ASP.Net Core 使用特定帐户来访问 Active Directory 以验证请求。

我不是在询问应用程序中的模拟,应用程序需要简单访问 AD 以便它可以确定用户是否可以访问控制器

        services.AddAuthentication(IISDefaults.AuthenticationScheme);

        services.Configure<IISOptions>(options => {
            options.AutomaticAuthentication = true;
            options.ForwardClientCertificate = true;
            options.AuthenticationDisplayName = "EnterAccount";
        });

【问题讨论】:

  • 不确定我是否理解。 ASP.NET Core 本身没有任何 AD / Windows Auth 支持。 IIS 是通过 IIS 集成中间件将身份传递给应用程序的一种。将 windows auth 与 ASP.NET Core 一起使用的唯一其他方法是使用 http.sys(以前称为 WebListener)作为平台(而不是 kestrel)。但是您不能在 IIS 中托管它,而必须自行托管它。您的问题与 ASP.NET Core 无关,您必须查看您的 IIS 是否具有执行此操作的必要权限。 ASP.NET Core 不参与
  • 不是 IIS 专家,但恕我直言,唯一的方法是允许应用程序池访问 AD 或创建新的应用程序池(如果您不希望该池中的其他应用程序获得这种许可)

标签: c# asp.net asp.net-core asp.net-core-mvc


【解决方案1】:

解决方案:

将此添加到您的 Web.config

  <aspNetCore forwardWindowsAuthToken="true"

我在博客上写了一个完整的solution here

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多