以 ADFS 作为身份提供者呈现 OAuth2 令牌端点

Presenting an OAuth2 token endpoint with ADFS as identity provider

我想设置一个身份服务器来集中对多个后端 API(主要是 ASP.NET Web API)和多个客户端(Web SPA、Xamarin Mobile 和WPF PC 客户端)。我最好向客户端提供单个 OAuth2 令牌端点,他们可以在其中发送用户凭据以及 client_id 和 client_secret(加上领域等)并取回令牌(和刷新令牌)在与 HTTP APIs.

交谈时用作承载令牌

有点棘手的部分是我希望身份服务器使用 ADFS 来验证用户 Active Directory 帐户的身份。

我看过 Thinktecture IdentityServer v3,但我似乎无法找到一种方法来允许仅将 HTTP post 用于令牌端点的工作流程。在我看来,它的工作方式是将用户重定向到授权端点,这需要在非 Web 客户端中使用 webview。有没有办法在不需要 webview 的情况下实现这一点,只需使用 HTTP API?

任何指向此示例或可能的其他解决方案的链接将不胜感激。

在 GitHub 上的 Thinktecture IdentityServer3 问题跟踪器中,我从其中一位创作者 Dominick Baier 那里找到了这个答案:

We only support ADFS as an identity provider - via the browser login window. Is that what you want? Or are you looking for a programmatic way to authenticate the user?

If yes - we don't support that out of the box anymore - but can be implemented using a custom grant. The samples repo has a basic example of custom grant implementation.

https://github.com/IdentityServer/Thinktecture.IdentityServer3/issues/618

这回答了我的问题。开箱即用的 IdentityServer v3 无法以编程方式针对 ADFS 进行身份验证。