Skip to content
This repository was archived by the owner on Apr 5, 2024. It is now read-only.

Commit 93b0a56

Browse files
authored
FF-181 Removed custom cors config. (#42)
* FF-181 Removed custom cors config. * BUG: fixed pipeline
1 parent b80132c commit 93b0a56

File tree

2 files changed

+3
-26
lines changed

2 files changed

+3
-26
lines changed

.github/workflows/featureRelease.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ jobs:
2626
run: |
2727
docker create -p 27017:27017 --name FileFighterDB mongo:latest
2828
docker start FileFighterDB
29-
-
30-
name: Run Tests and update Sonar
31-
run: mvn clean test sonar:sonar -s ./settings.xml
3229
-
3330
name: Build Docker Image
3431
run: mvn spring-boot:build-image -f pom.xml
Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
package de.filefighter.rest.configuration;
22

3-
import org.springframework.context.annotation.Bean;
4-
import org.springframework.context.annotation.Configuration;
5-
import org.springframework.web.cors.CorsConfiguration;
6-
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
7-
import org.springframework.web.filter.CorsFilter;
8-
9-
import java.util.ArrayList;
10-
import java.util.Arrays;
11-
12-
@Configuration
133
public class RestConfiguration {
144

155
//Custom static constants
@@ -21,17 +11,7 @@ public class RestConfiguration {
2111
public static final String USER_BASE_URI = "/users/";
2212
public static final String DEFAULT_ERROR_PATH = "/error";
2313

24-
@Bean
25-
public CorsFilter corsFilter(){
26-
final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
27-
final CorsConfiguration config = new CorsConfiguration();
28-
// Don't do this in production, use a proper list of allowed origins
29-
ArrayList<String> allowedOrigins = new ArrayList<>();
30-
allowedOrigins.add("http://localhost:3000");
31-
config.setAllowedOrigins(allowedOrigins);
32-
config.setAllowedHeaders(Arrays.asList("Origin", "Content-Type", "Accept"));
33-
config.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "OPTIONS", "DELETE", "PATCH"));
34-
source.registerCorsConfiguration("/**", config);
35-
return new CorsFilter(source);
14+
private RestConfiguration(){
15+
// Cannot be inst
3616
}
37-
}
17+
}

0 commit comments

Comments
 (0)