Моя конфигурация безопасности
Код: Выделить всё
@Bean
SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
log.info("configure");
return http
.csrf(csrf -> csrf.disable())
.authorizeHttpRequests(auth -> auth
.dispatcherTypeMatchers(DispatcherType.FORWARD).permitAll()
.requestMatchers(
"/login",
"/",
"/static/**").permitAll()
.requestMatchers("/us").hasRole("USER")
.requestMatchers("/views/admin/**").hasRole("ADMIN")
.anyRequest().authenticated()
)
.formLogin(form -> form
.loginPage("/login")
.defaultSuccessUrl("/", true)
.permitAll()
)
.logout(logout -> logout
.logoutUrl("/logout")
.logoutSuccessUrl("/index")
.permitAll()
)
.build();
}
когда я добавляю «/WEB-INF/**» в requestMatchersand Permitall, я могу видеть/или войти в систему без авторизации.
как я могу решить эту проблему без добавления «/WEB-INF/**» ?
Подробнее здесь: https://stackoverflow.com/questions/798 ... ity-config
Мобильная версия