身份服务器4 Windows身份验证

时间:2018-05-09 13:51:22

标签: iis asp.net-identity asp.net-core-2.0 windows-authentication identityserver4

我已经开始使用这三种资源的组合来开始使用Identity Server 4.

  1. IdentityServer4.Quickstart.UI
  2. 4_ImplicitFlowAuthenticationWithExternal
  3. Combined_AspNetIdentity_and_EntityFrameworkStorage
  4. 三者的组合用于将用户存储在数据库中,甚至来自外部提供商。还存储Identity Server 4配置,例如声明,角色,客户端和资源。我现在的主要问题是在IIS Express中运行时,Windows身份验证按预期工作。一旦我发布到本地计算机上的完整IIS服务器,当我点击Windows外部登录页面时,我会重复弹出一次登录。在IIS Express中运行Identity Server 4时,我没有获得该弹出窗口。在IIS Express中,我可以单击Windows外部身份验证按钮。它正确地通过应用程序路由并成功完成登录。

    非常感谢任何和所有帮助。我试图尽可能多地包含复制步骤,如果有任何不清楚的地方,请告诉我。

    重复登录弹出:

    enter image description here

    使用Windows身份验证和匿名身份验证启用IIS。

    enter image description here

    Setup.CS(ConfigureServices方法)

    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();
    

1 个答案:

答案 0 :(得分:0)

鉴于您的代码在快速但未完整的情况下工作,IIS可能会在验证您输入的窗口信息时遇到权限问题。确保您的应用程序池帐户有权访问您域中的信用证。