|
@@ -23,6 +23,9 @@ import org.springframework.cache.ehcache.EhCacheCacheManager;
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
import org.springframework.context.annotation.DependsOn;
|
|
|
+import org.springframework.web.cors.CorsConfiguration;
|
|
|
+import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
|
|
+import org.springframework.web.filter.CorsFilter;
|
|
|
import org.springframework.web.filter.DelegatingFilterProxy;
|
|
|
|
|
|
import javax.crypto.KeyGenerator;
|
|
@@ -218,7 +221,17 @@ public class ShiroConfiguration {
|
|
|
return filterRegistration;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ @Bean
|
|
|
+ public CorsFilter corsFilter() {
|
|
|
+ CorsConfiguration config = new CorsConfiguration();
|
|
|
+ config.addAllowedOrigin("*");
|
|
|
+ config.setAllowCredentials(true);
|
|
|
+ config.addAllowedMethod("*");
|
|
|
+ config.addAllowedHeader("*");
|
|
|
+ UrlBasedCorsConfigurationSource configSource = new UrlBasedCorsConfigurationSource();
|
|
|
+ configSource.registerCorsConfiguration("/**", config);
|
|
|
+ return new CorsFilter(configSource);
|
|
|
+ }
|
|
|
|
|
|
|
|
|
}
|