From f274ef63417cd54b6e482e99bddca21b86e99519 Mon Sep 17 00:00:00 2001 From: Florian Necas Date: Thu, 30 May 2024 14:20:25 +0200 Subject: [PATCH] feat: set cors to open by default, needs to be changed --- .../autoconfigure/api/ApiAutoConfiguration.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/services/ogc-features/src/main/java/com/camptocamp/opendata/ogc/features/autoconfigure/api/ApiAutoConfiguration.java b/src/services/ogc-features/src/main/java/com/camptocamp/opendata/ogc/features/autoconfigure/api/ApiAutoConfiguration.java index 5d42d1e..2246eb5 100644 --- a/src/services/ogc-features/src/main/java/com/camptocamp/opendata/ogc/features/autoconfigure/api/ApiAutoConfiguration.java +++ b/src/services/ogc-features/src/main/java/com/camptocamp/opendata/ogc/features/autoconfigure/api/ApiAutoConfiguration.java @@ -12,6 +12,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Import; import org.springframework.http.converter.HttpMessageConverter; +import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import com.camptocamp.opendata.ogc.features.autoconfigure.geotools.PostgisBackendAutoConfiguration; @@ -42,7 +43,7 @@ * - * + * * @see PostgisBackendAutoConfiguration * @see SampleDataBackendAutoConfiguration */ @@ -77,7 +78,7 @@ DataApiDelegate dataApiDelegate(CollectionRepository repo) { /** * {@inheritDoc} - * + * * @see CsvFeatureCollectionHttpMessageConverter * @see ShapefileFeatureCollectionHttpMessageConverter * @see Excel2007FeatureCollectionHttpMessageConverter @@ -180,4 +181,9 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha chain.doFilter(request, response); } } + + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**").allowedMethods("*"); + } }