如何在多个 Web 应用程序之间共享声明?

How can I share claims among multiple web applications?

我想将 login/logout 功能委托给 一个 网络应用程序,而不是在所有应用程序中都使用它。这就是我想要的设置方式:

1) 用户导航到应用 "foo"

2) 用户 登录,因此被重定向到应用程序 "authorization"

3) 应用程序 "authorization" 使用 Azure AD 作为身份提供程序 (IDP) 并重定向到 Microsoft 登录页面。

4) 用户输入用户名和密码

5) 用户被重定向到 "authorization"

6) 用户被重定向到应用 "foo" 并登录

这一直有效到第 6 步。这里 IDP 设置的声明丢失了,这是理智的,因为 IDP 中只注册了应用程序 "authorization"。

但是有没有办法实现这个场景呢?干杯!

正如@MohammadNiazmand 所建议的,考虑使用 IdentityServer4。在您上面的流程中 "authorization" 是 IdentityServer 4 服务(但用户实际上并不直接与其交互,都是重定向)。这里的优点是您仍然可以将外部提供商 (AD) 与 IS4 一起使用——但是一旦 AD 对用户进行身份验证并重定向回 IS4,您就可以在需要时使用 ProfileService 扩展点插入您自己的自定义声明 (http://docs.identityserver.io/en/latest/reference/profileservice.html). Then all of your web apps just need to be setup to use IS4 for identity and everything is centralized and a single set of claims will be available to all apps. IS4 supports Asp.Net Core Identity out of box (http://docs.identityserver.io/en/latest/quickstarts/6_aspnet_identity.html).