title: Spring Security and custom Remember me filter: logout issue
body: <p>I need to define a custom RememberMeAuthenticationFilter so that I can override the <code>onSuccessfulAuthentication(HttpServletRequest request, HttpServletResponse response, Authentication authResult)</code> method to put some custom logic.</p>
  
  <p>I've configured the XML in order to use my custom filter:</p>
  
  <pre><code> &lt;security:http disable-url-rewriting="true" request-matcher-ref="excludeUrlRequestMatcher" entry-point-ref="authenticationEntryPoint"&gt;
      &lt;security:custom-filter position="FORM_LOGIN_FILTER" ref="usernamePasswordAuthenticationFilter"/&gt;
      &lt;security:custom-filter position="REMEMBER_ME_FILTER" ref="extRememberMeProcessingFilter"/&gt;
  
      &lt;security:anonymous username="anonymous" granted-authority="ROLE_ANONYMOUS"/&gt;
  
      &lt;security:session-management session-authentication-strategy-ref="fixation" /&gt;
  
      &lt;!-- Intercepts url HERE: removed for brevity --&gt;
  
      &lt;!--&lt;security:form-login: using custom filter --&gt;
              &lt;!--login-page="/login"--&gt;
              &lt;!--authentication-failure-handler-ref="loginAuthenticationFailureHandler"--&gt;
              &lt;!--authentication-success-handler-ref="loginGuidAuthenticationSuccessHandler"/&gt;--&gt;
  
  
      &lt;security:logout logout-url="/logout" success-handler-ref="logoutSuccessHandler"/&gt;
  
      &lt;security:port-mappings&gt;
          &lt;security:port-mapping http="#{configurationService.configuration.getProperty('tomcat.http.port')}"
                                 https="#{configurationService.configuration.getProperty('tomcat.ssl.port')}"/&gt;
          &lt;security:port-mapping http="80" https="443"/&gt;
          &lt;!--security:port-mapping http="#{configurationService.configuration.getProperty('proxy.http.port')}"
              https="#{configurationService.configuration.getProperty('proxy.ssl.port')}" /--&gt;
      &lt;/security:port-mappings&gt;
  
      &lt;security:request-cache ref="httpSessionRequestCache"/&gt;
  
      &lt;security:access-denied-handler ref="b2bAccessDeniedHandler"/&gt;
  
      &lt;!-- RememberMe: using custom filter --&gt;
      &lt;!--&lt;security:remember-me key="comtestrememberme" services-ref="rememberMeServices"/&gt;--&gt;
  
  &lt;/security:http&gt;
  
  &lt;security:authentication-manager alias="authenticationManager"&gt;
      &lt;security:authentication-provider ref="myAuthenticationProvider"/&gt;
      &lt;security:authentication-provider ref="rememberMeAuthenticationProvider"/&gt;
  &lt;/security:authentication-manager&gt;
  
  &lt;bean id="myAuthenticationProvider"
        class="com.test.security.MyAuthenticationProvider"&gt;
      &lt;property name="bruteForceAttackCounter" ref="bruteForceAttackCounter"/&gt;
      &lt;property name="customerService" ref="customerService"/&gt;
      &lt;aop:scoped-proxy/&gt;
  &lt;/bean&gt;
  
  &lt;bean id="rememberMeServices"
        class="com.test.security.MyRememberMeServices"&gt;
      &lt;property name="key" value="comtestrememberme"/&gt;
      &lt;property name="cookieName" value="myRememberMe"/&gt;
      &lt;property name="alwaysRemember" value="false"/&gt;
      &lt;property name="customerService" ref="customerService"/&gt;
      &lt;property name="useSecureCookie" value="false"/&gt;
      &lt;aop:scoped-proxy/&gt;
  &lt;/bean&gt;
  
  &lt;bean id="rememberMeAuthenticationProvider"
        class="org.springframework.security.authentication.RememberMeAuthenticationProvider"&gt;
      &lt;property name="key" value="comtestrememberme"/&gt;
      &lt;aop:scoped-proxy/&gt;
  &lt;/bean&gt;
  
  &lt;bean id="usernamePasswordAuthenticationFilter" class="org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter"&gt;
      &lt;property name="authenticationManager" ref="authenticationManager"/&gt;
      &lt;property name="filterProcessesUrl" value="/j_spring_security_check"/&gt;
      &lt;property name="rememberMeServices" ref="rememberMeServices"/&gt;
      &lt;property name="authenticationSuccessHandler" ref="loginGuidAuthenticationSuccessHandler"/&gt;
      &lt;property name="authenticationFailureHandler" ref="loginAuthenticationFailureHandler"/&gt;
  &lt;/bean&gt;
  
  &lt;bean id="authenticationEntryPoint" class="org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint"&gt;
      &lt;property name="loginFormUrl" value="/login"/&gt;
  &lt;/bean&gt;
  
  &lt;bean id="extRememberMeProcessingFilter" class="com.test.security.filters.ExtRememberMeAuthenticationFilter"&gt;
      &lt;property name="rememberMeServices" ref="rememberMeServices"/&gt;
      &lt;property name="authenticationManager" ref="authenticationManager"/&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>The remember me cookie is getting created and my custom filter is being used, but the problem is that the logout never happens.</p>
  
  <p>When I click on the logout button it looks like I'm going through the authentication process again and the customer is logged in again.</p>
  
  <p>If I revert back to the standard Spring Filters everything is working fine. </p>
  
  <p>Have I missed something in the configuration?</p>