Это мой метод настройки в WebSecurityConfig extends WebSecurityConfigurerAdapter
@Override
protected void configure(HttpSecurity http) throws Exception {
http.cors()
.and()
.csrf().disable()
.exceptionHandling().authenticationEntryPoint(unauthorizedHandler)
.and()
.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and().authorizeRequests()
.antMatchers("/", "/favicon.ico", "/**/*.png", "/**/*.gif", "/**/*.svg", "/**/*.jpg", "/**/*.html",
"/**/*.css", "/**/*.js").permitAll()
.antMatchers("api/v1/data/**").permitAll()
.antMatchers(HttpMethod.POST,"api/v1/users/").permitAll()
.antMatchers(HttpMethod.POST,"api/v1/users/login/").permitAll()
.antMatchers(HttpMethod.POST,"api/v1/users/verify/phone/").permitAll()
.antMatchers(HttpMethod.POST,"api/v1/users/checkNumber/").permitAll()
.antMatchers(HttpMethod.POST, "api/v1/users/**").permitAll().anyRequest().authenticated();
// Add our custom JWT security filter
http.addFilterBefore(jwtAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class);
}
В этом методе я добавил неограниченный доступ к api/v1/users/login/
, но когда я вызываю логин, я получаю 401 Unauthorized
.Что не так в моем коде?