【问题标题】:Logging out from IdentityServer does not close the webview popup从 IdentityServer 注销不会关闭 webview 弹出窗口
【发布时间】:2022-01-12 09:20:03
【问题描述】:

我已将 IdentityModel.OidcClient 与 UWP 应用程序一起使用并连接到 Azure AD。登录 webview 打开并自动关闭,但注销弹出窗口不会自动关闭。

我的实现基于this。当注销发生时,最后的函数调用会在此处进行,但直到手动关闭弹出窗口,执行才会在此 AuthenticateAsync 函数调用中挂起。

if (string.Equals(options.EndUrl, WebAuthenticationBroker.GetCurrentApplicationCallbackUri().AbsoluteUri, StringComparison.Ordinal))
            {
                wabResult = await WebAuthenticationBroker.AuthenticateAsync(
                    wabOptions, new Uri(options.StartUrl));
                //Execution returns here, once the popup closes manually.
            }

注销发生正确,但弹出窗口仍然存在。注销后 URL 也已正确配置。

【问题讨论】:

    标签: uwp win-universal-app openid-connect oidc-client identitymodel


    【解决方案1】:

    找到了答案。 您需要设置LogoutRequest 对象并从LoginResult 对象设置IdentityToken(来自LoginAsync 函数的响应)并使用LogoutAsync 函数发送。

    var logoutRequest = new LogoutRequest
    {
         IdTokenHint = _result.IdentityToken,
         BrowserDisplayMode = DisplayMode.Visible
    };
    await oidcClient.LogoutAsync(logoutRequest);
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-10-10
    • 2012-04-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多