IdentityServer4& Windows身份验证

时间:2017-07-27 09:31:20

标签: windows-authentication identityserver4

我一直在追逐这个问题已经有一段时间了,我无法深究这个问题。我已经在这里阅读了其他解决方案(https://identityserver4.readthedocs.iohttps://github.com/IdentityServer/IdentityServer4.Quickstart.UI)并且它仍然无效,所以我尝试将其降低到绝对基础。这不是我面临的实际问题,但会产生相同的结果。即我无法使用Windows身份验证。

  1. 我克隆https://github.com/IdentityServer/IdentityServer4.Samples
  2. 我修改了Quickstarts/7_JavaScriptClient/src/QuickstartIdentityServer/Quickstart/Account/AccountController.cs,以便WindowsAuthenticationEnabledtrue
  3. 然后我转到http://localhost:5000/account/login并尝试使用Windows外部提供程序,我得到401。
  4. 这里这个简单示例的唯一区别,以及我在实际系统中看到的是我在真实网站上的凭据受到质疑。

    调试代码我从未见过if(HttpContext.User is WindowsPrincipal)成功,因为它始终是ClaimsPrincipal

    有人可以向我解释我做错了吗?

1 个答案:

答案 0 :(得分:2)

您的IIS站点上是否启用了Windows身份验证?需要启用此功能才能分配WindowsPrincipal。请注意,Windows身份验证仅在IIS或IIS Express后运行时才有效。