title: Spring BasicAuthenticationFilter.doFilter() very slow
body: <p>In my Spring Boot 2.0.5 App I'm using basic-auth to secure REST-API's.</p>
  
  <pre><code>@Configuration
  @EnableWebSecurity
  public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
     @Override
     protected void configure(final HttpSecurity http) throws Exception {
         http.authorizeRequests().antMatchers("/api/**").authenticated().and()
         .httpBasic().and().csrf().disable();
     }
     @Bean
     public InMemoryUserDetailsManager inMemoryUserDetailsManager() {
      final InMemoryUserDetailsManager manager = new InMemoryUserDetailsManager();
      manager.createUser("user").password("pwd").roles("roles").build()));
      return manager;
      }
  }
  </code></pre>
  
  <p>One of these API's is used by a Feign client (another Spring Boot App) with Feigns BasicAuthRequestInterceptor.</p>
  
  <p>NewRelic reports for every Webservice request that Spring's BasicAuthenticationFilter.doFilter() uses up to 10 seconds (!).</p>
  
  <p>That is a massive overhead. What is wrong here and what can I do to speed things up?</p>