Quando eu habilito a segurança do Spring Boot 2.2.9 com:
@EnableWebSecurity
@Configuration
public class SecurityConfigurations extends WebSecurityConfigurerAdapter {
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().antMatchers(HttpMethod.GET, "/topicos").permitAll()
.antMatchers(HttpMethod.GET, "/topicos/**").permitAll().anyRequest().authenticated().and().formLogin();
}
@Override
public void configure(WebSecurity web) throws Exception {
}
}Não consigo acessar nenhum endpoint, ficam todos bloqueados. Se eu fizer:
@EnableAutoConfiguration(exclude = { SecurityAutoConfiguration.class })Libera tudo e ignora minhas configurações de acesso. Olhando a documentação do Spring vi que isso também quebra definições de segurança no application.properties
Qual a solução?