Repository navigation
Keycloak: Identity Broker Logout not working as expected #15755
Unanswered
nehacharya04
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
My scenario has four entities:
Client: anAngularapp, registered onKeycloakas a public clientKeycloak: configured as an Identity BrokerSpring Authorization Server: configured as an external/custom Identity Provider (IDP) onKeycloakResource Server: aSpring Bootapplication with a secureRESTendpoint which acceptsJWTtokens (issued byKeycloak(as per it's brokering mechanism) and sent by the client application on behalf of an end-user)I am trying to implement the
logoutmechanism and facing 2 main issues:The
Angularapplication gives a call to theKeycloaklogout endpoint usingthis.keycloak.logout()which redirects the user to Keycloak's login page (http://localhost:4200, as expected) and destroys the session (verified this by checkingSessionsinKeycloakUI console). However, when I clickSign in with Custom IDPat the login page, it doesn't show the Spring Authorization Server's form login page to input user credentials and directly takes me into the application which is not the expected behavior in my case.As a next step, I configured the
Logout URLin the custom IDP's configuration inKeycloakto point to the Spring Authorization Server's default logout endpoint i.e., http://localhost:9000/logout and updated theWebSecurityConfigclass to calllogout(). However, when the end-user initiates the logout process,Keycloak'send-session-endpoint is called after which Spring Authorization server's logout endpoint is called which redirects the user to the same logged in page. Also, Keycloak doesn't destroy the session this time.One solution that I implemented in the Spring Authorization Server was to delete the user that gets created in
Keycloak(by calling the delete by user ID Keycloak API) which destroys the session and brings me back to the login page. This time when I click onSign in with Custom IDP, I am able to view the form login page for providing user credentials but I am totally unsure if I should be deleting users created inKeycloakjust to terminate a session.It would be really helpful if someone can explain where I might be going wrong as I am relatively new to this concept.
Also, I have disabled
BackChannelLogout andFrontChannellogout mechanisms onKeycloakfor my custom IDP.All reactions