[spring-boot3]: Change allow origins to all

This commit is contained in:
Konstantinos Triantafyllou 2024-07-30 13:59:05 +03:00
parent 6cea9e373e
commit d0e8e7ea3f
1 changed files with 1 additions and 9 deletions

View File

@ -1,6 +1,5 @@
package eu.dnetlib.uoaauthorizationlibrary.configuration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
@ -13,20 +12,13 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@ComponentScan(basePackages = { "eu.dnetlib.uoaauthorizationlibrary" })
public class AuthorizationConfiguration {
private final SecurityConfig securityConfig;
@Autowired
public AuthorizationConfiguration(SecurityConfig securityConfig) {
this.securityConfig = securityConfig;
}
@Bean
public WebMvcConfigurer corsConfigurer() {
return new WebMvcConfigurer() {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOriginPatterns("*" + securityConfig.getDomain())
.allowedOriginPatterns("*")
.allowedMethods("GET", "POST", "PUT", "DELETE", "HEAD", "OPTIONS")
.allowCredentials(true);
}