title: SpringBoot UsernamePasswordAuthenticationFilter issue
body: <p>I'm extending <code>UsernamePasswordAuthenticationFilter</code> so that I can add custom field to save them into the session.</p>
  
  <pre><code>public class AuthFilter extends UsernamePasswordAuthenticationFilter {
  
  @Override
  public Authentication attemptAuthentication(HttpServletRequest request,
          HttpServletResponse response) throws AuthenticationException {
      //String dbValue = request.getParameter("dbParam");
      //request.getSession().setAttribute("dbValue", dbValue);
      System.out.println("attempting to authentificate");
      while (request.getAttributeNames().hasMoreElements()) {
          String e = (String) request.getAttributeNames().nextElement();
          System.out.println("param name : " + e + " and param value : " + request.getAttribute(e));
      }
  
      return super.attemptAuthentication(request, response);
      }
  }
  </code></pre>
  
  <p>And my WebSecurityConfig </p>
  
  <pre><code>@Configuration
  @EnableWebMvcSecurity
  @Order(SecurityProperties.ACCESS_OVERRIDE_ORDER)
  public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
  
  @Autowired
  private UserDetailsService userDetailsService;
  
  
  @Bean
  public AuthFilter customUsernamePasswordAuthenticationFilter()
          throws Exception {
      AuthFilter customUsernamePasswordAuthenticationFilter = new AuthFilter();
      customUsernamePasswordAuthenticationFilter
              .setAuthenticationManager(authenticationManagerBean());
     return customUsernamePasswordAuthenticationFilter;
  }
  
  @Override
  protected void configure(HttpSecurity http) throws Exception {
      http.addFilterAfter(customUsernamePasswordAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class);
  
      http.exceptionHandling().accessDeniedPage("/403").and()
              .authorizeRequests().antMatchers("/login", "/public/**").permitAll()
              .antMatchers("/users/**").hasAuthority("ADMIN")
              .anyRequest()
              .authenticated().and().formLogin().loginPage("/login")
              .defaultSuccessUrl("/index").permitAll().and().logout()
              .permitAll();
  
  
      http.sessionManagement().maximumSessions(1)
              .expiredUrl("/login?expired").and()
              .sessionCreationPolicy(SessionCreationPolicy.IF_REQUIRED)
              .invalidSessionUrl("/");
  }
  
  @Autowired
  public void configureGlobal(AuthenticationManagerBuilder auth) throws  Exception {
      auth.eraseCredentials(false)
      .userDetailsService(userDetailsService);
  }
  </code></pre>
  
  <p>Mapping filter: 'customUsernamePasswordAuthenticationFilter' to: [/*]</p>
  
  <p>So I know for sure that the filter is correctly added, but I can never print out what's inside, so it's not called during authentification.</p>
  
  <p>I use Thymeleaf and no xml configuration.</p>
  
  <p>as @M. Deinum suggested,
  i changed my <code>UsernamePasswordAuthenticationFilter</code>, to <code>AbstractAuthenticationProcessingFilter</code>, called <code>super(new AntPathRequestMatcher("/login","POST"));
  </code>
  Changed <code>addFilterAfter</code> to <code>addFilterBefore</code>, and a bit of code, and it worked !</p>