How to have Keycloak logout unset session?

廉价感情. 提交于 2019-12-11 10:25:09

问题


I have a configuration where I'm using Keycloak as an Identity Broker, and a custom Identity Provider (using Spring Security OAuth) to provide user information.

What I observe is that when I attempt to log out (using frontchannel flow), Keycloak cookies including KEYCLOAK_IDENTITY remain. I expect to see Set-Cookie headers setting the expires to some date in the past.

The implication of this is that if I then go to a protected endpoint/page, I am able to access that resource without logging back in. Keycloak reads the IdToken value from the KEYCLOAK_IDENTITY cookie and uses that to reauthenticate the user.

How do I configure Keycloak to fully log a user out?


回答1:


The solution is buried in the Keycloak source code:

  • If I specify a logout url in my Identity Provider configuration, Keycloak will not unset its own cookies. Reference: OIDCIdentityProvider.keycloakInitiatedBrowserLogout(). This method needs to return null in order for Keycloak to unset its cookies.


来源:https://stackoverflow.com/questions/55130831/how-to-have-keycloak-logout-unset-session

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!