Код: Выделить всё
@Configuration
public static class ActuatorWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter {
@Autowired
UserProvider userProvider;
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(new UserDetailsServiceCustom(userProvider)).passwordEncoder(new BCryptPasswordEncoder(12));
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable()
.and().sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);
http.authorizeRequests()
.antMatchers("/actuator/shutdown").authenticated().and().httpBasic();
}
}
Код: Выделить всё
management:
endpoints:
web:
exposure:
include: shutdown
endpoint:
shutdown:
enabled: true
Поэтому мой вопрос заключается в том, как включить базовую аутентификацию, которая использует пользователей моей базы данных для этой конечной точки?
ОБНОВЛЕНИЕ
Хорошо, проблема была не в конфигурации HttpSecurity или CSRF, а в том, как Я неправильно реализовал несколько HttpSecurity
Подробнее здесь: https://stackoverflow.com/questions/626 ... ot-working