Я построил проект весной 5. Затем я начал настраивать вход в систему в угловых (CORS), но он просто дает мне ошибку 401 в предварительных настройках параметров.Я застрял с этим, если у вас есть что-то, чтобы помочь, дайте мне знать.Внутренний проект: https://github.com/maiconpintoabreu/Spring5SecurityMongodbTest Спасибо
Исправлено с конфигурацией @Order и Cors
@Order(4)
открытый класс WebSecurityConfiguration extends WebSecurityConfigurerAdapter {
...
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/**").hasAnyRole("ADMIN","USER")
.antMatchers(HttpMethod.OPTIONS, "**").permitAll()
.antMatchers("/resources/**").permitAll()
.anyRequest().authenticated().and()
.httpBasic().and().cors().and();
}
@Bean
CorsConfigurationSource corsConfigurationSource() {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/**", new CorsConfiguration().applyPermitDefaultValues());
return source;
}
}