【问题标题】:Identity Server 4 - SSO with multiple tenantsIdentity Server 4 - 具有多个租户的 SSO
【发布时间】:2018-07-19 14:27:29
【问题描述】:

我有几个使用同一个客户端由不同 URL 定义的租户

客户端 - c1

租户 - t1、t2、t3

所以,我们的用户可以使用不同的 URL 访问客户端

http://t1.c1.com

http://t2.c1.com

http://t3.c1.com

除了尝试单点退出之外,一切都很好。

According to the docs,我们将使用来自客户端的字段 FrontChannelLogoutUri 打开一个 IFrame 以清除该客户端的 cookie。

如果我们为上述任何域设置 FrontChannelLogoutUri,SSO 将适用于租户,但不适用于其他租户

问题:我们如何从上述任何租户中注销?

我的想法是手动删除所有子域中的 ALL cookie,因此,使用 FrontChannelLogoutUri 作为 http://c1.com/logout-confirm,因此它将清除该域中的所有 cookie/子域

 [HttpGet("logout-confirm")]
    public async Task LogoutConfirm()
    {
       foreach (var cookie in Request.Cookies.Keys)
       {
          Response.Cookies.Delete(cookie);
       }
       HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
                    await
       HttpContext.SignOutAsync(OpenIdConnectDefaults.AuthenticationScheme);
    }

如果我们使用该 URL(在客户端表中定义)打开一个新选项卡,则此方法有效,但由于某种原因,IdentityServer 在执行注销时未使用该 URL 打开 IFrame。

有什么想法吗?

【问题讨论】:

  • 我看到你在 github 上找到了解决方案。那你能关闭这个吗?

标签: c# asp.net-core single-sign-on identityserver4


【解决方案1】:

我所做的是将一个域作为通过 FrontChanelLogoutUri 注销的起点,例如 http://t1.c1.com/logout 清除该子域的所有 cookie 并将重定向 (302) 返回到下一个域 http://t2.c1.com/logout 并继续直到你'已清除所有域中的所有 cookie。

【讨论】:

    猜你喜欢
    • 2020-10-06
    • 2021-03-06
    • 2018-12-16
    • 1970-01-01
    • 2021-05-18
    • 2017-02-18
    • 1970-01-01
    • 2021-11-10
    • 1970-01-01
    相关资源
    最近更新 更多