Boa tarde. Eu estava com dificuldades nesse módulo, pois mesmo seguindo todos os passos, o Postman dava com código: 200 o acesso aos topicos da aplicação. O Postman só deu código:401 depois que declarei a anotação @EnableWebSecurity nas classes "ForumApplication" e "SecurityConfiguration", ficando dessa forma:
package br.com.alura.forum;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.data.web.config.EnableSpringDataWebSupport;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
@SpringBootApplication
@EnableSpringDataWebSupport
@EnableCaching
@EnableWebSecurity
public class ForumApplication {
public static void main(String[] args) {
SpringApplication.run(ForumApplication.class, args);
}
}
package br.com.alura.forum.config.security;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
@EnableWebSecurity
@Configuration
public class SecurityConfiguration {
}