title: Single Log Out not working in keycloak and spring security
body: <p>I'm using keycloak server along with its spring security adapter to secure two sample apps. Everything works fine, except that there's no Single Log Out solution out of the box. Is there any specific configuration for that?<br>
  <strong>Edit</strong><br>
  Here is my logout button:   </p>
  
  <pre><code>    &lt;c:url var="logoutUrl" value="/sso/logout"/&gt;
      &lt;form class="form-inline" action="${logoutUrl}" method="post"&gt;
          &lt;input type="submit" value="Log out" /&gt;
          &lt;input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/&gt;
      &lt;/form&gt;   
  </code></pre>
  
  <p>and here is my spring-security config file:   </p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:context="http://www.springframework.org/schema/context"
         xmlns:sec="http://www.springframework.org/schema/security"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="
         http://www.springframework.org/schema/beans
         http://www.springframework.org/schema/beans/spring-beans.xsd
         http://www.springframework.org/schema/context
         http://www.springframework.org/schema/context/spring-context.xsd
         http://www.springframework.org/schema/security
         http://www.springframework.org/schema/security/spring-security.xsd"&gt;
  
      &lt;context:component-scan base-package="org.keycloak.adapters.springsecurity" /&gt;
  
      &lt;sec:authentication-manager alias="authenticationManager"&gt;
          &lt;sec:authentication-provider ref="keycloakAuthenticationProvider" /&gt;
      &lt;/sec:authentication-manager&gt;
  
      &lt;sec:http auto-config="false" entry-point-ref="keycloakAuthenticationEntryPoint"&gt;
          &lt;sec:custom-filter ref="keycloakPreAuthActionsFilter" before="LOGOUT_FILTER" /&gt;
          &lt;sec:custom-filter ref="keycloakAuthenticationProcessingFilter" before="FORM_LOGIN_FILTER" /&gt;
          &lt;sec:intercept-url pattern="/Login.jsp"         access="permitAll()" /&gt;
          &lt;sec:intercept-url pattern="/resources/**"      access="permitAll()" /&gt;
          &lt;sec:intercept-url pattern="/Index.jsp"         access="hasRole('ROLE_USER')" /&gt;
          &lt;sec:intercept-url pattern="/cont/**"           access="hasRole('ROLE_USER')" /&gt;
          &lt;sec:custom-filter ref="logoutFilter" position="LOGOUT_FILTER" /&gt;
      &lt;/sec:http&gt;
  
      &lt;bean id="keycloakAuthenticationProvider" class="org.keycloak.adapters.springsecurity.authentication.KeycloakAuthenticationProvider" /&gt;
  
      &lt;bean id="adapterDeploymentContext" class="org.keycloak.adapters.springsecurity.AdapterDeploymentContextFactoryBean"&gt;
          &lt;constructor-arg value="/WEB-INF/keycloak/keycloak.json" /&gt;
      &lt;/bean&gt;
      &lt;bean id="keycloakAuthenticationEntryPoint" class="org.keycloak.adapters.springsecurity.authentication.KeycloakAuthenticationEntryPoint" &gt;
          &lt;constructor-arg ref="adapterDeploymentContext"/&gt;
      &lt;/bean&gt;
  
      &lt;bean id="keycloakPreAuthActionsFilter" class="org.keycloak.adapters.springsecurity.filter.KeycloakPreAuthActionsFilter" /&gt;
      &lt;bean id="keycloakAuthenticationProcessingFilter" class="org.keycloak.adapters.springsecurity.filter.KeycloakAuthenticationProcessingFilter"&gt;
          &lt;constructor-arg name="authenticationManager" ref="authenticationManager" /&gt;
      &lt;/bean&gt;
  
      &lt;bean id="logoutFilter" class="org.springframework.security.web.authentication.logout.LogoutFilter"&gt;
          &lt;constructor-arg name="logoutSuccessUrl" value="/Index.jsp" /&gt;
          &lt;constructor-arg name="handlers"&gt;
              &lt;list&gt;
                  &lt;ref bean="keycloakLogoutHandler" /&gt;
                  &lt;bean class="org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler" /&gt;
              &lt;/list&gt;
          &lt;/constructor-arg&gt;
          &lt;property name="logoutRequestMatcher"&gt;
              &lt;bean class="org.springframework.security.web.util.matcher.AntPathRequestMatcher"&gt;
                  &lt;constructor-arg name="pattern" value="/sso/logout**" /&gt;
                  &lt;constructor-arg name="httpMethod" value="POST" /&gt;
              &lt;/bean&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
      &lt;bean id="keycloakLogoutHandler" class="org.keycloak.adapters.springsecurity.authentication.KeycloakLogoutHandler"&gt;
          &lt;constructor-arg ref="adapterDeploymentContext" /&gt;
      &lt;/bean&gt;
  
  
  &lt;/beans&gt;
  </code></pre>