经过一番挖掘后:
这个例子 https://github.com/IdentityServer/IdentityServer3.Samples/blob/master/source/WebHost%20(Windows%20Auth)/README.mdidsrv 中展示了如何在单独的 Web 应用程序中运行 Windows authn 以及如何使用 ws-fed 委托给该 Web 应用程序。这也解释在这个问题 https://github.com/IdentityServer/IdentityServer2/issues/358.
斯科特·布雷迪的这篇博文 https://www.scottbrady91.com/Identity-Server/Identity-Server-3-using-WS-Federation演示如何配置 adfs 以允许 idsrv 作为依赖方,以及如何使用 ws-fed 委托给 adfs 以允许在 adfs 上使用用户名/密码登录
如果您同时使用这两个 ws-fed 委托,请确保对authenticationtype 使用不同的值。
您可以做的是强制用户首先尝试 winauth,方法是将 acr_values 和 idp 添加到第一个重定向并将 idp 设置为 winauth 外部 idp 的名称。看idsrv 文档在这里 https://identityserver.github.io/Documentation/docsv2/endpoints/authorization.html
如果失败,您可以使用这项技术 https://github.com/IdentityServer/IdentityServer3/issues/2489检测从外部 winauth 提供商登录失败并自动重定向到 adfs 提供商。
如果由于某种原因您确实到达了登录页面,您可以禁用本地登录 https://identityserver.github.io/Documentation/docsv2/configuration/authenticationOptions.html(不显示用户名/密码输入字段)并且外部提供程序(winauth 和 adfs)默认情况下仅显示为按钮。
edit:
是的,您可以在 idsrv 旁边添加一个额外的 Web 应用程序,这样就不必使用 Windows 集成身份验证来运行 idsrv
winauth 用户的流程是
client app -> IdSrv (login page) -> WinAuthHost -> IdSrv (auth endpoint)-> client app
实际上,如果成功,用户很可能只会在 Winauth 主机中看到客户端应用程序和一个屏幕,而永远不会看到 Idsrv
如果用户没有登录Windows(或者不是正确的域),那么流程将是这样的
client app -> IdSrv (login page) -> WinAuthHost -> IdSrv login (auth endpoint, fails)
-> ADFS -> IdSrv login (auth endpoint) -> client app