【问题标题】:IdentityServer4 & Windows AuthenticationIdentityServer4 和 Windows 身份验证
【发布时间】:2018-01-02 22:38:30
【问题描述】:

我一直在寻找这个问题一段时间,但我无法深入了解它。我已经阅读了这里的其他解决方案(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。

这里的这个简单示例和我在实际系统上看到的唯一区别是我在真实站点上的凭据方面受到挑战。

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

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

【问题讨论】:

    标签: windows-authentication identityserver4


    【解决方案1】:

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

    【讨论】:

    • 是的,在 IIS 上启用了 Windows 身份验证。我已经让它使用 UseIISIntegration 运行 Kestrel,所以我猜 IIS 正在充当它的反向代理。
    • IIS 还是 IIS Express?为站点或服务器启用?我问是因为 HttpContext.User 是 WindowsPrincipal 工作正常,所以这很可能是环境问题。
    • 哇...我为站点和应用程序启用了 Windows 身份验证,但是当我为服务器启用它时,一切都变得生动起来。谢谢。
    • docs.identityserver.io/en/release/topics/windows.html 很好地解释了启动 Windows 身份验证所需的步骤。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-11-23
    • 1970-01-01
    • 1970-01-01
    • 2021-04-06
    • 1970-01-01
    • 2021-05-01
    • 1970-01-01
    相关资源
    最近更新 更多