【问题标题】:post_logout_redirect_uri is empty OpenIdConnect IdentityServerpost_logout_redirect_uri 为空 OpenIdConnect IdentityServer
【发布时间】:2021-06-25 10:03:21
【问题描述】:

我试图在注销后将我的用户重定向到应用登录页面,但我找不到设置 post_logout_redirect_uri 参数的方法。 我正在使用 OpenIdConnect 和 IdentityServer,因此在从客户端启动 signOut 后,用户被重定向到 IdentityServer 结束会话 endPoint,但 post_logout_redirect_uri 为空。

客户:

var props = new AuthenticationProperties()
{
  RedirectUri = HttpContext.Request.Scheme + "://" + HttpContext.Request.Host.Value
};
await HttpContext.SignOutAsync(props);
await HttpContext.SignOutAsync(OpenIdConnectDefaults.AuthenticationScheme, props);

据我了解,带有“oidc”的方法 HttpContext.SignOutAsync() 然后重定向到 IdentityServer 结束会话端点:

如您所见,post_logout_redirect_uri 查询参数为空。由于配置,这是自动发生的,所以我希望我可以在某个地方设置 post_logout_redirect_uri,但我找不到它。有什么想法吗?

【问题讨论】:

    标签: asp.net-core asp.net-identity identityserver4 openid-connect


    【解决方案1】:

    post_logout_redirect_uri 可以在启动时设置,您可以在其中使用AddOpenIdConnect 注册您的外部身份验证方案。您设置的OpenIdConnectOptions 有一个名为SignedOutCallbackPath 的属性:

    /// <summary>
    /// The request path within the application's base path where the user agent will be returned after sign out from the identity provider.
    /// See post_logout_redirect_uri from http://openid.net/specs/openid-connect-session-1_0.html#RedirectionAfterLogout.
    /// </summary>
    public PathString SignedOutCallbackPath { get; set; }
    

    您也可以检查:

    /// <summary>
    /// The uri where the user agent will be redirected to after application is signed out from the identity provider.
    /// The redirect will happen after the SignedOutCallbackPath is invoked.
    /// </summary>
    /// <remarks>This URI can be out of the application's domain. By default it points to the root.</remarks>
    public string SignedOutRedirectUri { get; set; } = "/";
    

    【讨论】:

      猜你喜欢
      • 2020-04-22
      • 2018-01-09
      • 2021-04-14
      • 1970-01-01
      • 2015-11-18
      • 1970-01-01
      • 2021-12-21
      • 2019-06-11
      • 2018-01-28
      相关资源
      最近更新 更多