In my Spring Boot 2.0.5 App I'm using basic-auth to secure REST-API's.
@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;
}
}
One of these API's is used by a Feign client (another Spring Boot App) with Feigns BasicAuthRequestInterceptor.
NewRelic reports for every Webservice request that Spring's BasicAuthenticationFilter.doFilter() uses up to 10 seconds (!).
That is a massive overhead. What is wrong here and what can I do to speed things up?