title: Spring security custom filter called multiple times
body: <p>I have a custom logout filter called six times. Twice as soon I try to access the application, twice when I enter username/password and click on 'Login' and then twice again when I click on 'logout'.</p>
  
  <p>What am I doing wrong?</p>
  
  <p>Configuration:</p>
  
  <pre><code>&lt;http auto-config="true" use-expressions="true"&gt;
      &lt;intercept-url pattern="/admin/**" access="hasRole('ROLE_ADMIN_FUNCTIONS')" /&gt;      
      &lt;intercept-url pattern="/**" access="hasRole('ROLE_USER')" /&gt;
  
      &lt;form-login login-page="/login"
          authentication-success-handler-ref="customAuthenticationSuccessHandlerBean"
          authentication-failure-handler-ref="customAuthenticationFailureHandlerBean" /&gt;
      &lt;logout invalidate-session="true" success-handler-ref="logoutHandlerBean" /&gt;
      &lt;session-management session-fixation-protection="migrateSession"&gt;
          &lt;concurrency-control max-sessions="1"
              expired-url="/login_sessionexpired" /&gt;
      &lt;/session-management&gt;
  
      &lt;custom-filter before="LOGOUT_FILTER" ref="customLogoutFilter" /&gt;
  &lt;/http&gt;
  
  &lt;beans:bean id="customLogoutFilter" class="com.hurontg.libms.security.CustomLogoutFilter" /&gt;
  </code></pre>
  
  <p>The filter:</p>
  
  <pre><code>public class CustomLogoutFilter extends OncePerRequestFilter {
  /**
   * 
   */
  private XLogger logger = XLoggerFactory
          .getXLogger(CustomLogoutFilter.class.getName());
  
  @Override
  protected void doFilterInternal(HttpServletRequest req,
          HttpServletResponse res, FilterChain chain)
          throws ServletException, IOException {
  
      logger.error("========================================================================================");
      logger.error("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Custom Logout Filter $$$$$$$$$$$$$$$$$$$$$$$$$$$$$");
      logger.error("========================================================================================");
  
      chain.doFilter(req, res);
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Spring version: 4.1.1
  Spring security: 3.2.5</p>