【问题标题】:IdentityServer3 redirect Logout to the Custom URLIdentityServer3 将注销重定向到自定义 URL
【发布时间】:2017-03-08 11:48:54
【问题描述】:

我在 google 和 Stack Overflow 中搜索,没有合适的答案可用。

我在客户端应用程序中使用 ReactJs + Redux,.Net WebAPI 用于联系数据库和其他逻辑实现,最后我使用 IdentityServer3 对用户进行身份验证。

点击注销后,我将触发以下 URL:https://localhost:123/core/connect/endsession

new Client
{
    Enabled = true,
    ClientName = "Super Star Application",
    ClientId = "SS",
    Flow = Flows.Implicit,
    RequireConsent = false,
    RequireSignOutPrompt =false,
    RedirectUris = new List<string>
    {
        "http://localhost:111/callback"
    },
    PostLogoutRedirectUris = new List<string> {"https://www.google.com/"},
    AllowedCorsOrigins = new List<string>
    {
        "http://localhost:111/"
    },
    AllowAccessToAllScopes=true
}

在 Startup.cs 我有以下代码

app.Map("/core", core =>
{
    var idSvrFactory = Factory.Configure();
    idSvrFactory.ConfigureUserService("AspId");

    var options = new IdentityServerOptions
    {
        SiteName = "Super Star",
        SigningCertificate = Certificate.Get(),
        Factory = idSvrFactory,
        ProtocolLogoutUrls = new System.Collections.Generic.List<string>()
        {
            "https://www.google.co.in"
        },
        AuthenticationOptions = new AuthenticationOptions
        {
            EnablePostSignOutAutoRedirect=true,
            EnableSignOutPrompt = false,
            PostSignOutAutoRedirectDelay = 1,
            EnableLoginHint = true,
            RememberLastUsername = true,
            EnableAutoCallbackForFederatedSignout = true,
            RequireSignOutPrompt = false
        }
    };

    core.UseIdentityServer(options);
});

我不知道如何重定向到http://www.google.com 而不是下面的屏幕

请帮助我...

【问题讨论】:

    标签: c# .net url-redirection logout identityserver3


    【解决方案1】:

    您需要调用 endsession 端点,传递 id 令牌和注销后重定向 url 作为参数。

    /connect/endsession?id_token_hint={id token}&post_logout_redirect_uri=http://www.google.com
    

    其中 {id token} 是调用 /connect/authorize 端点时从身份服务器返回的 id 令牌。

    在此处查看文档https://identityserver.github.io/Documentation/docsv2/endpoints/endSession.html

    请注意,您必须发回一个 id 令牌才能使重定向生效,否则结束会话请求的验证将失败并且不会发生重定向。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-01-10
      • 2017-06-16
      • 2021-12-20
      • 2015-03-11
      • 2012-03-12
      • 2015-09-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多