fix security configuration
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
dmitriy.churmeev
2026-03-29 14:26:56 +03:00
parent 983f91eb1c
commit d6cd2139f6

View File

@@ -11,20 +11,27 @@ import org.springframework.security.config.annotation.web.configurers.SessionMan
import org.springframework.security.config.http.SessionCreationPolicy
import org.springframework.security.core.authority.SimpleGrantedAuthority
import org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationConverter
import org.springframework.security.oauth2.server.resource.authentication.JwtGrantedAuthoritiesConverter
import org.springframework.security.web.SecurityFilterChain
@Configuration
@EnableWebSecurity
@EnableMethodSecurity
@EnableMethodSecurity(
prePostEnabled = true, // ← явно включаем
securedEnabled = true // ← опционально
)
class WebSecurityConfig () {
@Bean
@Throws(Exception::class)
fun filterChain(http: HttpSecurity): SecurityFilterChain? {
http.authorizeHttpRequests(Customizer { auth ->
auth.anyRequest().authenticated() })
auth.requestMatchers("/public/**", "/health", "/info").permitAll()
auth.anyRequest().permitAll()
//auth.anyRequest().authenticated()
})
.oauth2ResourceServer(Customizer { oauth2 ->
// oauth2!!.jwt(Customizer.withDefaults())
// добавляем конвертер для извлечения ролей