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:
@@ -24,25 +24,49 @@ class WebSecurityConfig () {
|
|||||||
http
|
http
|
||||||
.authorizeHttpRequests(Customizer { auth ->
|
.authorizeHttpRequests(Customizer { auth ->
|
||||||
auth
|
auth
|
||||||
.requestMatchers("/public/**").permitAll()
|
|
||||||
.anyRequest().authenticated()
|
.anyRequest().authenticated()
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.oauth2ResourceServer(Customizer { oauth2 ->
|
.oauth2ResourceServer(Customizer { oauth2 ->
|
||||||
oauth2!!
|
oauth2!!
|
||||||
.jwt(Customizer.withDefaults())
|
.jwt(Customizer.withDefaults())
|
||||||
} // ← проверяем JWT токены
|
} // ← проверяем JWT токен
|
||||||
)
|
)
|
||||||
.sessionManagement(Customizer { session: SessionManagementConfigurer<HttpSecurity?>? ->
|
.sessionManagement(Customizer { session: SessionManagementConfigurer<HttpSecurity?>? ->
|
||||||
session!!
|
session!!
|
||||||
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
|
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
|
||||||
} // REST API без сессий
|
} // без сессий
|
||||||
)
|
)
|
||||||
.csrf(Customizer { csrf: CsrfConfigurer<HttpSecurity?>? -> csrf!!.disable() }) // для API отключаем CSRF
|
.csrf(Customizer { csrf: CsrfConfigurer<HttpSecurity?>? -> csrf!!.disable() }) // отключаем CSRF для API
|
||||||
|
|
||||||
return http.build()
|
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
|
// @Bean
|
||||||
// @Throws(Exception::class)
|
// @Throws(Exception::class)
|
||||||
// fun filterChain(http: HttpSecurity): SecurityFilterChain? {
|
// fun filterChain(http: HttpSecurity): SecurityFilterChain? {
|
||||||
|
|||||||
Reference in New Issue
Block a user