Keycloak注销请求 [英] Keycloak Logout Request
问题描述
我想问一下是否有一种方法可以通过一个http请求从 keycloak
中注销.
I wanted to ask if there is a way to logout from keycloak
via a single http request.
我已经尝试过发布/protocol/openid-connect/logout
或/tokens/logout
,但是结果始终是起源问题.
I already tried to POST /protocol/openid-connect/logout
or /tokens/logout
, but the result is always a ORIGIN-Problem.
但是在密钥斗篷中配置了调用源ORIGIN,并且可以使用请求登录.
But the calling ORIGIN is configured in keycloak and the login with a request works.
这里是否有机会注销而无需重定向或打开另一个窗口?
Any chance here to logout without redirecting or open another window?
最诚挚的问候和感谢!:)
Best regards and thanks! :)
推荐答案
来自官方文档:
From the official documentation:
您可以通过多种方式退出Web应用程序.对于Java EEservlet容器,您可以调用
HttpServletRequest.logout()
.
对于其他浏览器应用程序,您可以将浏览器重定向到 http://auth-server/auth/realms/{realm-name}/protocol/openid-connect/logout?redirect_uri = encodedRedirectUri
,如果您使用浏览器进行SSO会话,则会注销
For other browser applications, you can redirect the browser to
http://auth-server/auth/realms/{realm-name}/protocol/openid-connect/logout?redirect_uri=encodedRedirectUri
, which logs you out if you have an SSO session with your browser.
要获取应用程序的确切URL(主机,领域和redirect_uri配置):
To get the exact URL of the app (host, realm and redirect_uri configuration):
- 登录到您的Keycloak用户帐户
- 打开浏览器的开发者控制台
- 执行注销操作
- 记下用于请求注销的URL
- 使用应用程序中的相同网址执行注销
这篇关于Keycloak注销请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!