如何使用FrontChannelLogout从外部IdentityServer4从IdentityServer4-客户端注销

时间:2018-12-05 14:13:26

标签: c# .net-core identityserver4

我有一个IdentityServer4 identity-server-client 作为外部IdentityServer4 identity-server-master 的客户端strong>在 identity-server-master 上注销时,从 identity-server-client 退出时遇到一些问题强>。我在 AddOpenIdConnect 中为 identity-server-master 中的 SignedOutCallBackPath RemoteSignedOutPath 指定了 身份服务器客户端 。我还为客户端指定了 FrontChannelLogoutUri PostLogoutRedirectUri

我遵循了Identity Server 4中的示例。

身份服务器客户端中的配置

.AddOpenIdConnect("demoidsrv", "IdentityServer", options =>
            {
                options.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme;
                options.SignOutScheme = IdentityServerConstants.SignoutScheme;

                options.Authority = "https://demo.identityserver.io/";
                options.ClientId = "implicit";
                options.ResponseType = "id_token";
                options.SaveTokens = true;
                options.CallbackPath = "/signin-idsrv";
                options.SignedOutCallbackPath = "/signout-callback-idsrv";
                options.RemoteSignOutPath = "/signout-idsrv";

                options.TokenValidationParameters = new TokenValidationParameters
                {
                    NameClaimType = "name",
                    RoleClaimType = "role"
                };
            })

...以及他们的demo instance

中的 identity-server-master 中的配置
                new Client
            {
                ClientId = "implicit",
                ClientName = "Implicit Client",
                AllowAccessTokensViaBrowser = true,

                RedirectUris = { "https://notused" },
                PostLogoutRedirectUris = { "https://notused" },
                FrontChannelLogoutUri = "http://localhost:5000/signout-idsrv", // for testing identityserver on localhost

                AllowedGrantTypes = GrantTypes.Implicit,
                AllowedScopes = { "openid", "profile", "email", "api" },
            },

问题在于,当它尝试退出前通道时,找不到路径。我一无所知...

1 个答案:

答案 0 :(得分:0)

通过添加一个用于front-channel-logout的终结点来解决此问题,该终结点基本上会终止正在进行的会话。我不知道这是否是最佳解决方案,因为我了解到可以在IdentityServer4的注销页面上将前通道注销与iframe一起使用。