Fiz todos os passos conforme o video, porém os métodos GET continuam sendo bloqueados. No postman continuo recebendo o status 401 Unauthorized.
Segue abaixo a classe SecurityConfiguration:
package br.com.forum.config.security;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@EnableWebSecurity
@Configuration
public class SecurityConfiguration extends WebSecurityConfigurerAdapter{
//Configurações de autenticação
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
}
//Configurações de Autorização
@Override
protected void configure(HttpSecurity http) throws Exception {
//http.authorizeRequests().antMatchers(HttpMethod.GET, "/topicos").permitAll().
//antMatchers(HttpMethod.GET, "/topicos/*").permitAll();
http.authorizeRequests()
.antMatchers(HttpMethod.GET, "/topicos").permitAll()
.antMatchers(HttpMethod.GET, "/topicos/*").permitAll();
}
//Configuraçõaes de recureos estaticos(j, css, imagens, etc)
@Override
public void configure(WebSecurity web) throws Exception {
}
}
insira seu código aqui