title: Keycloak logout does not end session
body: <p>I am using Keycloak 3.4 in a Java Application using Spring Framework and Jetty 8.1 with Keycloak Jetty-81-Adapter 3.4.</p>
  
  <p>According to the Keycloak documentation I should be able to use the HttpServletRequest in a Java EE application to logout from Keycloak. However, this does not work in my case, even though Jetty supports HttpServletRequests.</p>
  
  <blockquote>
    <p>You can log out of a web application in multiple ways. For Java EE servlet containers, you can call HttpServletRequest.logout()..</p>
  </blockquote>
  
  <p>If I try to logout this way, I get redirected to keycloak (login screen with option to choose from multiple realm logins). When I choose my preferred realm however, I am immediately logged in to the webapplication again, without having to provide any credentials.</p>
  
  <p>I tried the alternative approach, by redirecting to Keycloak:</p>
  
  <blockquote>
    <p>For other browser applications, you can redirect the browser to<br>
    <a href="http://auth-server/auth/realms/" rel="noreferrer">http://auth-server/auth/realms/</a>{realm-name}/protocol/openid-connect/logout?redirect_uri=encodedRedirectUri</p>
  </blockquote>
  
  <p>but it throws a connection refused error in the Keycloak log, because Keycloak tries to call my webapp in a direct way. It has no effect on the Keycloak session, which stays active. I strongly prefer no serverside calls necessary from Keycloak to the webapp directly.</p>
  
  <p>Any suggestions why the <code>HttpServletRequest.logout()</code> does not destroy the keycloak session in my case? 
  Is the Jetty implementation of the HttpServletRequest so different from the Java EE implementation that it could not work at all?</p>