@Bean
 @ConditionalOnProperty(name = "jhipster.cors.allowed-origins")
 public CorsFilter corsFilter() {
   log.debug("Registering CORS filter");
   UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
   CorsConfiguration config = jHipsterProperties.getCors();
   source.registerCorsConfiguration("/api/**", config);
   source.registerCorsConfiguration("/v2/api-docs", config);
   source.registerCorsConfiguration("/oauth/**", config);
   return new CorsFilter(source);
 }
Ejemplo n.º 2
0
 @Bean
 public CorsFilter corsFilter() {
   UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
   CorsConfiguration config = props.getCors();
   if (config.getAllowedOrigins() != null && !config.getAllowedOrigins().isEmpty()) {
     source.registerCorsConfiguration("/api/**", config);
     source.registerCorsConfiguration("/v2/api-docs", config);
     source.registerCorsConfiguration("/oauth/**", config);
   }
   return new CorsFilter(source);
 }
Ejemplo n.º 3
0
 @Bean
 public CorsFilter corsFilter() {
   UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
   CorsConfiguration config = new CorsConfiguration();
   config.setAllowCredentials(true);
   config.addAllowedOrigin("*");
   config.addAllowedHeader("*");
   config.addAllowedMethod("GET");
   config.addAllowedMethod("PUT");
   source.registerCorsConfiguration("/**", config);
   return new CorsFilter(source);
 }