简体   繁体   English

从 IdentityServer 注销不会关闭 webview 弹出窗口

[英]Logging out from IdentityServer does not close the webview popup

I have used IdentityModel.OidcClient with a UWP app and connected to Azure AD.我已将IdentityModel.OidcClient与 UWP 应用程序一起使用并连接到 Azure AD。 Login webview opens and automatically closes but the logout popup does not automatically close.登录 webview 打开并自动关闭,但注销弹出窗口不会自动关闭。

My implementation is based on this .我的实现是基于这个 When logout happens the final function call goes here but until the popup closes manually, execution hangs inside this AuthenticateAsync function call.当注销发生时,最终的 function 调用会转到此处,但直到手动关闭弹出窗口,执行才会在此AuthenticateAsync function 调用中挂起。

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.
            }

Logout happens correctly but the popup remains.注销发生正确,但弹出窗口仍然存在。 Post logout URL was also configured correctly.注销后 URL 也已正确配置。 在此处输入图像描述

found the answer.找到了答案。 You need to setup the LogoutRequest object and set the IdentityToken from the LoginResult object (Comes from the response of LoginAsync function) and send it with the LogoutAsync function.您需要设置LogoutRequest object 并从 LoginResult object 设置IdentityToken (来自LoginResult函数的响应)并使用LogoutAsync LoginAsync发送它。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM