Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

keycloak openid single log out with spring boot

I'm trying to implement a single log out in my spring boot applications using keycloak and openid.

I already setup keycloak 3.4.3 with sprint boot 1.5.3 and spring security adapter (documentation here), algo using tomcat adapter (documentation here ). Everything works fine until I try to log out from all my sessions.

I have tried:

1) On keycloak administration console ui: logout all sessions result: it does clean all sessions from keycloak, but not the browser ones in my client applications. So I keep logged in until i delete them manually.

2) Using HttpServletRequest.logout() and http://auth-server/auth/realms/{realm-name}/protocol/openid-connect/logout?redirect_uri=encodedRedirectUri (documentation here), only logs out from the current client and not as a SLO

I'm not sure if OpenID supports SLO and I cannot find any reliable documentation about it.

¿Is there a way to implement Single log out using OpenID and Spring boot?

like image 271
dgr018 Avatar asked Nov 06 '25 04:11

dgr018


1 Answers

You can do the following to log out

   @GetMapping(path = "/logout")
   public String logout(HttpServletRequest request) throws ServletException {
      request.logout();
      return "/";
   }

http

<a href="/logout">Logout</a>
like image 96
Sazzad Islam Avatar answered Nov 08 '25 11:11

Sazzad Islam