【问题标题】:IdentityServer3 Logout not Redirecting to originIdentityServer3注销不重定向到源
【发布时间】:2016-09-09 22:15:57
【问题描述】:

我有 MVC 从身份服务器注销,但它不会自动重定向。我什至没有得到通常默认显示的“单击此处返回”。

这是我的设置。

在 idsvr 中: Factory 是使用 EF 的 Aspnet 身份(主要是开箱即用的实现)

IdentityServerOptions {
AuthenticationOptions =
    {
        EnablePostSignOutAutoRedirect = true,
        SignInMessageThreshold = 3,
        EnableSignOutPrompt = false
    }
}

在 MVC 中

app.UseOpenIdConnectAuthentication (new OpenIdConnectAuthenticationOptions
{
PostLogoutRedirectUri = "https://localhost:port",
RedirectUri = "https://localhost:port",
Notifications = new OpenIdConnectAuthenticationNotifications
{
SecurityTokenValidated = HereIGetRefreshTokenEtc(),
RedirectToIdentityProvider =  n =>
{
    if (n.ProtocolMessage.RequestType == OpenIdConnectRequestType.LogoutRequest)
    {
        var idTokenHint = n.OwinContext.Authentication.User.FindFirst("id_token");
        if (idTokenHint != null)
        {
            n.ProtocolMessage.IdTokenHint = idTokenHint.Value;
        }
    }
    return Task.FromResult(0);
}
}
});

Logout Controller 动作是这样的

    public ActionResult Logout()
    {
        //Option 1 : because I have already provided redirect URI in initial configuration
        Request.GetOwinContext().Authentication.SignOut();

        //Option 2: Because option 1 did not work
        Request.GetOwinContext().Authentication.SignOut(new AuthenticationProperties { RedirectUri = "https://mymvc.site" });

        //none of the return statements work. (obviously i have tried them individually)

        return RedirectToAction("Index", "Home", new{ area = ""});
        return Redirect("https://idsvr/connect/endsession");
    }

我错过了什么?

【问题讨论】:

    标签: oauth oauth-2.0 identityserver3 openid-connect thinktecture-ident-server


    【解决方案1】:

    知道了! 我错过了在客户端配置的 PostLogoutRedirectUris 中添加链接。说“无效的注销后 URI”是失败的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-06-16
      • 1970-01-01
      • 2014-06-07
      • 2021-12-20
      • 1970-01-01
      • 1970-01-01
      • 2017-06-01
      • 2012-11-05
      相关资源
      最近更新 更多