Тело ответа
Код: Выделить всё
{
"timestamp": "2024-12-09T13:54:07.648+00:00",
"status": 403,
"error": "Forbidden",
"message": "Forbidden",
"path": "/users"
}
Код: Выделить всё
cache-control: no-cache,no-store,max-age=0,must-revalidate
connection: keep-alive
content-type: application/json
date: Mon,09 Dec 2024 13:54:07 GMT
expires: 0
keep-alive: timeout=60
pragma: no-cache
transfer-encoding: chunked
x-content-type-options: nosniff
x-frame-options: DENY
x-xss-protection: 0
// файл pom.xml
Код: Выделить всё
...
org.springframework.boot
spring-boot-starter-security
org.springframework.security
spring-security-test
6.4.1
test
org.springframework.boot
spring-boot-starter-oauth2-client
...
Код: Выделить всё
@Configuration
@EnableWebSecurity
public class SecurityConfig {
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http
.authorizeHttpRequests(authorize -> authorize
.requestMatchers("/").permitAll()
.requestMatchers("/images/**", "/css/**", "/js/**").permitAll()
.requestMatchers("/swagger-resources/**").permitAll()
.requestMatchers("/swagger-ui.html").permitAll()
.requestMatchers("/swagger-ui/*").permitAll()
.requestMatchers("/webjars/**").permitAll()
.anyRequest().authenticated()
)
.formLogin(formLogin -> formLogin
.loginPage("/login")
.permitAll()
)
.rememberMe(withDefaults());
return http.build();
}
}
- Конфигурация Spring Security: ошибка HTTP 403< /li>
Неожиданная ошибка (тип = Запрещено, статус = 403) при использовании csrf с Spring Security v3.0.0 и Thymeleaf - Неожиданная ошибка 403 при использовании Spring Безопасность
Подробнее здесь: https://stackoverflow.com/questions/792 ... sponse-sta