0

I have a spring security config that implements HTTP basic authentication like this:

@Configuration
@EnableWebSecurity
@RequiredArgsConstructor
public class SecurityConfig extends WebSecurityConfigurerAdapter {
    private final AuthenticationEntryPoint authenticationEntryPoint;
    private final MyAuthenticationProvider myAuthenticationProvider;

    @Override
    public void configure(final AuthenticationManagerBuilder auth) {
        auth.authenticationProvider(myAuthenticationProvider);
    }

    @Override
    protected void configure(final HttpSecurity http) throws Exception {
        http.authorizeRequests()
            .anyRequest().authenticated()
            .and()
            .httpBasic()
            .authenticationEntryPoint(authenticationEntryPoint);
    }

    @Override
    public void configure(final WebSecurity web) {
        web.ignoring().antMatchers("/swagger-ui/**",
                                   ....
                                   ....);
    }
}

It works fine.

However, for some of the developers, it is annoying to have to authenticate to endpoints during development.

Is there an out-of-box configuration Spring Security offers so that I can disable endpoint authentication in the yml configuration file?

I understand I can implement it myself, but I would like to know if there is an out-of-box option.

ZZZ
  • 645
  • 4
  • 17

0 Answers0