From 91fc751a1d50351dfb9be40c743526276851c16c Mon Sep 17 00:00:00 2001 From: Heidi Lammi-Mihaljov Date: Mon, 2 Dec 2024 10:43:54 +0200 Subject: [PATCH] OK-735: Poistetaan autentikointivaatimus /healthcheck-endpointilta --- .../{CasConfig.scala => SecurityConfig.scala} | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) rename ovara-backend/src/main/scala/fi/oph/ovara/backend/security/{CasConfig.scala => SecurityConfig.scala} (94%) diff --git a/ovara-backend/src/main/scala/fi/oph/ovara/backend/security/CasConfig.scala b/ovara-backend/src/main/scala/fi/oph/ovara/backend/security/SecurityConfig.scala similarity index 94% rename from ovara-backend/src/main/scala/fi/oph/ovara/backend/security/CasConfig.scala rename to ovara-backend/src/main/scala/fi/oph/ovara/backend/security/SecurityConfig.scala index 0e33b7a..f42aea5 100644 --- a/ovara-backend/src/main/scala/fi/oph/ovara/backend/security/CasConfig.scala +++ b/ovara-backend/src/main/scala/fi/oph/ovara/backend/security/SecurityConfig.scala @@ -22,7 +22,7 @@ import org.springframework.security.web.authentication.HttpStatusEntryPoint @Configuration @EnableWebSecurity -class CasConfig { +class SecurityConfig { @Value("${cas.url}") val cas_url: String = null @@ -116,6 +116,16 @@ class CasConfig { .build() } + @Bean + @Order(3) + def healthcheckFilterChain(http: HttpSecurity): SecurityFilterChain = { + http + .securityMatcher("/api/healthcheck") + .authorizeHttpRequests(requests => requests.anyRequest.permitAll) + .csrf(c => c.disable) + .build() + } + @Bean @Order(1) def csrfFilterChain(http: HttpSecurity): SecurityFilterChain = {