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:
@@ -5,11 +5,8 @@ import org.springframework.context.annotation.Configuration
|
||||
import org.springframework.security.config.Customizer
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity
|
||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity
|
||||
import org.springframework.security.config.annotation.web.configurers.AuthorizeHttpRequestsConfigurer.AuthorizationManagerRequestMatcherRegistry
|
||||
import org.springframework.security.config.annotation.web.configurers.CsrfConfigurer
|
||||
import org.springframework.security.config.annotation.web.configurers.SessionManagementConfigurer
|
||||
import org.springframework.security.config.annotation.web.configurers.oauth2.server.resource.OAuth2ResourceServerConfigurer
|
||||
import org.springframework.security.config.annotation.web.configurers.oauth2.server.resource.OAuth2ResourceServerConfigurer.JwtConfigurer
|
||||
import org.springframework.security.config.http.SessionCreationPolicy
|
||||
import org.springframework.security.web.SecurityFilterChain
|
||||
|
||||
@@ -34,47 +31,4 @@ class WebSecurityConfig () {
|
||||
return http.build()
|
||||
}
|
||||
|
||||
// @Bean
|
||||
// @Throws(Exception::class)
|
||||
// fun filterChain(http: HttpSecurity): SecurityFilterChain? {
|
||||
// http
|
||||
// .authorizeHttpRequests(Customizer { auth ->
|
||||
// auth
|
||||
// .requestMatchers("/public/**").permitAll()
|
||||
// .anyRequest().authenticated()
|
||||
// }
|
||||
// )
|
||||
// .oauth2ResourceServer(Customizer { oauth2 ->
|
||||
// oauth2!!
|
||||
// .jwt(Customizer.withDefaults())
|
||||
// } // ← проверяем JWT токены
|
||||
// )
|
||||
// .sessionManagement(Customizer { session: SessionManagementConfigurer<HttpSecurity?>? ->
|
||||
// session!!
|
||||
// .sessionCreationPolicy(SessionCreationPolicy.STATELESS)
|
||||
// } // REST API без сессий
|
||||
// )
|
||||
// .csrf(Customizer { csrf: CsrfConfigurer<HttpSecurity?>? -> csrf!!.disable() }) // для API отключаем CSRF
|
||||
//
|
||||
// return http.build()
|
||||
// }
|
||||
|
||||
// @Bean
|
||||
// @Throws(Exception::class)
|
||||
// fun filterChain(http: HttpSecurity): SecurityFilterChain? {
|
||||
// http
|
||||
// .authorizeHttpRequests(Customizer { auth -> auth
|
||||
// .requestMatchers("/", "/home").permitAll()
|
||||
// .anyRequest().authenticated()
|
||||
// })
|
||||
// .oauth2Login(Customizer { oauth2: OAuth2LoginConfigurer<HttpSecurity?>? ->
|
||||
// oauth2!!
|
||||
// .defaultSuccessUrl("/dashboard", true)
|
||||
// .loginPage("/oauth2/authorization/keycloak") } // Spring сам редиректит
|
||||
// ).logout(Customizer { logout: LogoutConfigurer<HttpSecurity?>? ->
|
||||
// logout!!
|
||||
// .logoutSuccessUrl("/") })
|
||||
//
|
||||
// return http.build()
|
||||
// }
|
||||
}
|
||||
@@ -33,13 +33,15 @@ spring:
|
||||
resourceserver:
|
||||
jwt:
|
||||
issuer-uri: https://keycloak.dmitriy-churmeev.tech/realms/test_realm
|
||||
client:
|
||||
registration:
|
||||
keycloak:
|
||||
client-id: test_client
|
||||
client-secret: jyO0RTH9dzPaschkpfjzwZ6WprTlMPZ6
|
||||
# scope: openid,profile,email
|
||||
redirect-uri: http://app.dmitriy-churmeev.tech/login/oauth2/code/keycloak
|
||||
|
||||
# Для использования клиентской сессии
|
||||
# client:
|
||||
# registration:
|
||||
# keycloak:
|
||||
# client-id: test_client
|
||||
# client-secret: jyO0RTH9dzPaschkpfjzwZ6WprTlMPZ6
|
||||
# redirect-uri: http://app.dmitriy-churmeev.tech/login/oauth2/code/keycloak
|
||||
|
||||
provider:
|
||||
keycloak:
|
||||
issuer-uri: https://keycloak.dmitriy-churmeev.tech/realms/test_realm
|
||||
@@ -50,9 +52,3 @@ spring:
|
||||
enabled: true
|
||||
locations: classpath:db/migration
|
||||
baseline-on-migrate: true
|
||||
|
||||
#keycloak:
|
||||
# auth-server-url: http://keycloak.dmitriy-churmeev.tech/auth
|
||||
# realm: test_realm
|
||||
# resource: test_client
|
||||
# public-client: true
|
||||
Reference in New Issue
Block a user