I'm doing a small app using Spring Boot 2, Spring Security, and Vue 3. Currently I only have some endpoints for login, register new user, and get a list of tasks assigned to each user. I am using Postman to test my endspoints. I can perform login without a problem, it generates me a JWT. When I try to use that token to get the list of tasks for an user, I get 403 Forbidden. ``` @Override
protected void configure(HttpSecurity httpSecurity) throws Exception {
httpSecurity
.cors()
.and()
.csrf()
.disable()
.exceptionHandling()
.authenticationEntryPoint(jwtAuthenticationEntryPoint)
.and()
.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
.authorizeRequests()
.antMatchers("/api/auth/").permitAll() // Allow public access to authentication endpoints
// .antMatchers("/login").permitAll()
.antMatchers("/api/user-tasks/").hasRole("ADMIN") // Restricted to admin role
.antMatchers("/api/tasks/**").hasAnyRole("BASIC_USER", "ADMIN") // Access for logged in users
.anyRequest().authenticated();
// Add JWT filter
httpSecurity.addFilterBefore(jwtAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class);
} ``` This is the configure method in my ``` @Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class SecurityConfig extends WebSecurityConfigurerAdapter``` class . I don't get any errors, I do not understand what is happening, I am very new to Java/Spring Boot but not to programming.