相关疑难解决方法(0)

从身份服务器注销后如何将用户重定向到客户端应用程序?

我想在用户从该客户端注销后将其重定向到同一个客户端。因此,如果我在一台身份服务器上有 5 个客户端,我希望用户能够从一个客户端注销并在同一客户端上但已注销。

我尝试过的一件事是在快速入门中的 AccountController 中使用 PostLogoutRedirectUri,但该值始终为空。我发现的解决方法是手动设置 PostLogoutRedirectUri,如果服务器上只有一个客户端,则可以正常工作,但如果我有多个客户端,则效果不佳。有什么方法可以知道哪个客户端已“注销”?

  public async Task<IActionResult> Logout(LogoutInputModel model)
    {
        // build a model so the logged out page knows what to display
        var vm = await BuildLoggedOutViewModelAsync(model.LogoutId);

        if (User?.Identity.IsAuthenticated == true)
        {
            // delete local authentication cookie
            await HttpContext.SignOutAsync();

            // raise the logout event
            await _events.RaiseAsync(new UserLogoutSuccessEvent(User.GetSubjectId(), User.GetDisplayName()));
        }

        // check if we need to trigger sign-out at an upstream identity provider
        if (vm.TriggerExternalSignout)
        {
            // build a return URL so the upstream provider will …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-core identityserver4

2
推荐指数
1
解决办法
3903
查看次数

标签 统计

asp.net-core ×1

c# ×1

identityserver4 ×1