身份服务器4 Windows身份验证 [英] identity server 4 windows authentication
问题描述
我已经开始使用这三种资源的组合来开始使用Identity Server 4.
-
IIS已启用Windows Auth并启用了匿名身份验证。
Setup.CS(配置服务方法)
public void ConfigureServices(IServiceCollection services){
//仅通过托管Kestrel支持Windows身份验证(iis中的Asp.net核心Web服务器作为反向代理)
//它与其他身份验证方法不同,因为您没有像上面那样添加身份验证中间件。
services.Configure< IISOptions>(options => {
options.AuthenticationDisplayName =Windows;
options.AutomaticAuthentication = true;
});
services.AddMvc();
Program.cs
public static IWebHost BuildWebHost(string [] args)=>
WebHost.CreateDefaultBuilder(args)
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup< Startup>()
.Build();
解决方案我自己很幸运地回答了这个问题。这实际上不是软件开发人员的问题,而是环境配置问题。自应用程序部署在本地以来的本地环回检查导致了问题。
https://support.microsoft.com/en-us/help/896861/you-receive-error-401-1-when-you-browse-a-web- site-that-uses-integrateI have followed a combination of these three resources for getting started with Identity Server 4.
- IdentityServer4.Quickstart.UI
- 4_ImplicitFlowAuthenticationWithExternal
- Combined_AspNetIdentity_and_EntityFrameworkStorage
The combination of the three were used in order to store users within the the database even from external providers. Also store Identity Server 4 configurations such as claims, roles, clients, and resources. My main issue right now is when running in IIS Express windows authentication works as expected. Once I publish to a full IIS server on my local machine I get a repeated popup to login when I hit the Windows external login page. I do not get that popup when running Identity Server 4 within IIS Express. In IIS Express, I am able to click the windows external authentication button. It routes through the app properly and successfully completes the login.
Any and all help is highly appreciated. I tried to include as many reproduction steps as possible so let me know if there is anything not clear.
Repeating Login Popup:
IIS is setup with Windows Auth and Anonymous Auth enabled.
Setup.CS (ConfigureServices method)
public void ConfigureServices(IServiceCollection services) { // Windows authentication is supported only by hosting Kestrel (Asp.net Core Web Server inside iis as a reverse proxy) // It is different than other Authentication methods because you don't Add the Authentication middleware like above. services.Configure<IISOptions>(options => { options.AuthenticationDisplayName = "Windows"; options.AutomaticAuthentication = true; }); services.AddMvc();
Program.cs
public static IWebHost BuildWebHost(string[] args) => WebHost.CreateDefaultBuilder(args) .UseKestrel() .UseContentRoot(Directory.GetCurrentDirectory()) .UseIISIntegration() .UseStartup<Startup>() .Build();
解决方案I luckily answered this myself. This in fact was not a software developer issue but was an environment configuration issue. Local loopback check since the app was deployed locally was causing the issue. https://support.microsoft.com/en-us/help/896861/you-receive-error-401-1-when-you-browse-a-web-site-that-uses-integrate
这篇关于身份服务器4 Windows身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!