gpt4 book ai didi

redirect - 身份服务器 4 - 检查 iframe session 问题 - oidc 客户端

转载 作者:行者123 更新时间:2023-12-04 17:45:29 24 4
gpt4 key购买 nike

我正在使用 OIDC Client在我针对身份服务器 4 进行身份验证的 Angular 应用程序中。一切正常,直到我点击退出。

我已启用监视器 session (默认启用),以便其他浏览器可以检测到注销,并且我可以在同一浏览器的其他选项卡中注销用户。当我从一个选项卡注销时,另一个选项卡向身份服务器请求静默刷新 token 并成功。我希望其他浏览器也能退出。如果我在另一个选项卡中按 F5,那么是的,它会被重定向到再次登录。但不是自动的。

最佳答案

更新
从共享同一身份服务器的其他客户端注销 frontChannel ,您可以在您的身份中添加一个 Iframe 以通知您的客户有关注销的信息( oidc-client.js 支持前端 channel 注销 )

Front-channel server-side clients

To signout the user from the server-side client applications via the front-channel spec, the “logged out” page in IdentityServer must render an to notify the clients that the user has signed out. Clients that wish to be notified must have the FrontChannelLogoutUri configuration value set. IdentityServer tracks which clients the user has signed into, and provides an API called GetLogoutContextAsync on the IIdentityServerInteractionService (details). This API returns a LogoutRequest object with a SignOutIFrameUrl property that your logged out page must render into an .

Back-channel server-side clients

To signout the user from the server-side client applications via the back-channel spec, the SignOutIFrameUrl endpoint in IdentityServer will automatically trigger server-to-server invocation passing a signed sign-out request to the client. This means that even if there are no front-channel clients, the “logged out” page in IdentityServer must still render an to the SignOutIFrameUrl as described above. Clients that wish to be notified must have the BackChannelLogoutUri configuration value set.

Browser-based JavaScript clients

Given how the session management specification is designed, there is nothing special in IdentityServer that you need to do to notify these clients that the user has signed out. The clients, though, must perform monitoring on the check_session_iframe, and this is implemented by the oidc-client JavaScript library.


之后你可以监听事件 addUserSignedOut oidc 客户端 在您的所有客户端中并触发 退出重定向注销您的客户
this._userManager.events.addUserSignedOut(() => {
this._userManager
.signoutRedirect()
.then(resp => {
console.log('Success');
})
.catch(err => {
console.log(err);
});
});
检查这个 documentation更多细节

关于redirect - 身份服务器 4 - 检查 iframe session 问题 - oidc 客户端,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52260648/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com