身份服务器 4 windows 身份验证
identity server 4 windows authentication
我结合使用了这三种资源来开始使用 Identity Server 4。
- IdentityServer4.Quickstart.UI
- 4_ImplicitFlowAuthenticationWithExternal
- Combined_AspNetIdentity_and_EntityFrameworkStorage
这三者的组合用于将用户存储在数据库中,甚至来自外部提供商。还存储 Identity Server 4 配置,例如声明、角色、客户端和资源。我现在的主要问题是当 IIS Express windows 身份验证中的 运行 按预期工作时。一旦我发布到我本地机器上的完整 IIS 服务器,当我点击 Windows 外部登录页面时,我会重复弹出登录。当 IIS Express 中的 运行 Identity Server 4 时,我没有得到该弹出窗口。在 IIS Express 中,我可以单击 windows 外部身份验证按钮。它通过应用程序正确路由并成功完成登录。
非常感谢您提供的任何帮助。我尝试包含尽可能多的复制步骤,所以如果有任何不清楚的地方,请告诉我。
重复登录弹出窗口:
IIS 设置为启用 Windows 身份验证和匿名身份验证。
Setup.CS(配置服务方法)
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();
鉴于您的代码可以快速运行但不完整,IIS 可能在验证您输入的 windows 凭据时遇到权限问题。确保您的应用程序池帐户有权访问您域中的凭据。
幸运的是我自己回答了这个问题。这实际上不是软件开发人员的问题,而是环境配置问题。由于应用程序是在本地部署的,所以本地环回检查导致了这个问题。
https://support.microsoft.com/en-us/help/896861/you-receive-error-401-1-when-you-browse-a-web-site-that-uses-integrate
我结合使用了这三种资源来开始使用 Identity Server 4。
- IdentityServer4.Quickstart.UI
- 4_ImplicitFlowAuthenticationWithExternal
- Combined_AspNetIdentity_and_EntityFrameworkStorage
这三者的组合用于将用户存储在数据库中,甚至来自外部提供商。还存储 Identity Server 4 配置,例如声明、角色、客户端和资源。我现在的主要问题是当 IIS Express windows 身份验证中的 运行 按预期工作时。一旦我发布到我本地机器上的完整 IIS 服务器,当我点击 Windows 外部登录页面时,我会重复弹出登录。当 IIS Express 中的 运行 Identity Server 4 时,我没有得到该弹出窗口。在 IIS Express 中,我可以单击 windows 外部身份验证按钮。它通过应用程序正确路由并成功完成登录。
非常感谢您提供的任何帮助。我尝试包含尽可能多的复制步骤,所以如果有任何不清楚的地方,请告诉我。
重复登录弹出窗口:
IIS 设置为启用 Windows 身份验证和匿名身份验证。
Setup.CS(配置服务方法)
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();
鉴于您的代码可以快速运行但不完整,IIS 可能在验证您输入的 windows 凭据时遇到权限问题。确保您的应用程序池帐户有权访问您域中的凭据。
幸运的是我自己回答了这个问题。这实际上不是软件开发人员的问题,而是环境配置问题。由于应用程序是在本地部署的,所以本地环回检查导致了这个问题。 https://support.microsoft.com/en-us/help/896861/you-receive-error-401-1-when-you-browse-a-web-site-that-uses-integrate