fix security configuration
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -21,22 +21,14 @@ class WebSecurityConfig () {
|
||||
@Bean
|
||||
@Throws(Exception::class)
|
||||
fun filterChain(http: HttpSecurity): SecurityFilterChain? {
|
||||
http
|
||||
.authorizeHttpRequests(Customizer { auth ->
|
||||
auth
|
||||
.anyRequest().authenticated()
|
||||
}
|
||||
)
|
||||
http.authorizeHttpRequests(Customizer { auth ->
|
||||
auth.anyRequest().authenticated() })
|
||||
.oauth2ResourceServer(Customizer { oauth2 ->
|
||||
oauth2!!
|
||||
.jwt(Customizer.withDefaults())
|
||||
} // ← проверяем JWT токен
|
||||
)
|
||||
oauth2!!.jwt(Customizer.withDefaults())
|
||||
}) // ← проверяем JWT токен
|
||||
.sessionManagement(Customizer { session: SessionManagementConfigurer<HttpSecurity?>? ->
|
||||
session!!
|
||||
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
|
||||
} // без сессий
|
||||
)
|
||||
session!!.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
|
||||
}) // без сессий
|
||||
.csrf(Customizer { csrf: CsrfConfigurer<HttpSecurity?>? -> csrf!!.disable() }) // отключаем CSRF для API
|
||||
|
||||
return http.build()
|
||||
|
||||
@@ -30,6 +30,9 @@ spring:
|
||||
# Keycloak Security
|
||||
security:
|
||||
oauth2:
|
||||
resourceserver:
|
||||
jwt:
|
||||
issuer-uri: https://keycloak.dmitriy-churmeev.tech/realms/test_realm
|
||||
client:
|
||||
registration:
|
||||
keycloak:
|
||||
|
||||
Reference in New Issue
Block a user