From ca1d79acb0b4182f217e23c7b254481406f72fdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20M=C3=BCller?= Date: Mon, 27 Jul 2026 18:26:50 +0200 Subject: [PATCH] fix(backend): fixed cors error on build dev environment --- .../java/at/mueller/eeg/backend/iam/config/SecurityConfig.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eeg_backend/src/main/java/at/mueller/eeg/backend/iam/config/SecurityConfig.java b/eeg_backend/src/main/java/at/mueller/eeg/backend/iam/config/SecurityConfig.java index be47bae..16f95ac 100644 --- a/eeg_backend/src/main/java/at/mueller/eeg/backend/iam/config/SecurityConfig.java +++ b/eeg_backend/src/main/java/at/mueller/eeg/backend/iam/config/SecurityConfig.java @@ -23,6 +23,7 @@ import org.springframework.security.oauth2.jwt.NimbusJwtDecoder; import org.springframework.security.oauth2.jwt.NimbusJwtEncoder; import org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationConverter; import org.springframework.security.oauth2.server.resource.authentication.JwtGrantedAuthoritiesConverter; +import org.springframework.security.oauth2.server.resource.web.HeaderBearerTokenResolver; import org.springframework.security.web.SecurityFilterChain; import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.CorsConfigurationSource; @@ -61,6 +62,7 @@ public class SecurityConfig { .anyRequest().denyAll() ) .oauth2ResourceServer(oauth2 -> oauth2 + .bearerTokenResolver(new HeaderBearerTokenResolver("X-Access-Token")) .jwt(jwt -> jwt.jwtAuthenticationConverter(jwtAuthenticationConverter())) );