JAVA 8 + ВЕСНА 5 + Junit - нет пружинного башмака
У меня есть образец следующей конфигурации пружины. Я хочу написать базовый c тест для проверки конфигурации, если кто-то отключит тест конфигурации csrf, если он не пройдёт.
по умолчанию csrf включен, поэтому вы не увидите никакой конфигурации csrf.
любая помощь приветствуется заранее.
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(securedEnabled = true, prePostEnabled = true)
public class WebMVCSecurity extends WebSecurityConfigurerAdapter {
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication()
.withUser("user1").password("{noop}user1Pass")
.authorities("ROLE_USER");
}
@Override
public void configure(WebSecurity web) throws Exception {
web.ignoring().antMatchers("/resources/**");
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.anyRequest()
.authenticated()
.and()
.httpBasic();
}
}