Skip to content

Commit

Permalink
disable cors for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
mschulte-tsi committed Jul 8, 2021
1 parent 25aca04 commit 38b5a14
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
17 changes: 4 additions & 13 deletions src/main/java/eu/europa/ec/dgc/businessrule/config/CorsConfig.java
Original file line number Diff line number Diff line change
@@ -1,24 +1,15 @@
package eu.europa.ec.dgc.businessrule.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.CorsConfigurationSource;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
@EnableWebSecurity
public class CorsConfig implements WebMvcConfigurer {

@Bean
CorsConfigurationSource corsConfigurationSource(DgcConfigProperties dgcConfigProperties) {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
CorsConfiguration corsConfiguration = new CorsConfiguration().applyPermitDefaultValues();
corsConfiguration.addAllowedOrigin(dgcConfigProperties.getCorsUrl());
source.registerCorsConfiguration("/**",corsConfiguration);
return source;
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**").allowedMethods("*");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {

@Override
protected void configure(HttpSecurity http) throws Exception {
http.cors();
http.cors().and().csrf().disable();
}

}

0 comments on commit 38b5a14

Please sign in to comment.