我们的ASP.NET Core应用程序在Windows身份验证中运行良好,可通过以下方式正确保护应用程序:
[Authorize(Roles = "ABC\\MyGroup")]
但是,当我们将应用程序移动到另一个服务器时,应用程序正在运行的池没有访问活动目录的权限。在setup.cs中,我如何告诉asp.net core使用特定帐户访问active directory以对请求进行身份验证。
我不是在问应用程序中的模拟,应用程序需要简单地访问广告,以便它可以确定用户是否可以访问控制器
services.AddAuthentication(IISDefaults.AuthenticationScheme); services.Configure<IISOptions>(options => { options.AutomaticAuthentication = true; options.ForwardClientCertificate = true; options.AuthenticationDisplayName = "EnterAccount"; });
解决方案:
将此添加到web.config
<aspNetCore forwardWindowsAuthToken="true"
我在博客上说 solution here 。