Commit 4aa85cab authored by Matija Obreza's avatar Matija Obreza
Browse files

CORS

parent 7c2dacfa
......@@ -40,9 +40,6 @@ import org.springframework.security.oauth2.provider.approval.TokenApprovalStore;
import org.springframework.security.oauth2.provider.error.OAuth2AccessDeniedHandler;
import org.springframework.security.oauth2.provider.token.DefaultTokenServices;
import org.springframework.security.oauth2.provider.token.TokenStore;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
@Configuration
@Import(SwaggerConfig.class)
......@@ -54,18 +51,6 @@ public class OAuth2ServerConfig {
return new OAuthServiceImpl();
}
@Bean
public CorsFilter corsFilter() {
final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
final CorsConfiguration config = new CorsConfiguration();
config.setAllowCredentials(true);
config.addAllowedOrigin("*");
config.addAllowedHeader("*");
config.addAllowedMethod("*");
source.registerCorsConfiguration("/**", config);
return new CorsFilter(source);
}
@Configuration
@EnableResourceServer
protected static class ResourceServerConfiguration extends ResourceServerConfigurerAdapter {
......
......@@ -169,7 +169,7 @@ public class WebConfiguration extends WebMvcConfigurerAdapter {
public void addCorsMappings(final CorsRegistry registry) {
registry.addMapping("/api/**")
// .allowedOrigins(uiOrigin)
.allowedMethods("PUT", "POST", "GET", "DELETE");
.allowedMethods("*");
// .allowedHeaders("header1", "header2", "header3")
// .exposedHeaders("header1", "header2")
// .allowCredentials(false).maxAge(3600);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment