diff --git a/java/services/auth/src/main/java/com/uva/authentication/config/CorsConfig.java b/java/services/auth/src/main/java/com/uva/authentication/config/CorsConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..ed09601f0b2f69c7b0cde58bcfc1ad3f1796a95f --- /dev/null +++ b/java/services/auth/src/main/java/com/uva/authentication/config/CorsConfig.java @@ -0,0 +1,19 @@ +package com.uva.authentication.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +@Configuration +public class CorsConfig implements WebMvcConfigurer { + + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") // Permitir acceso a todos los endpoints + .allowedOrigins("http://localhost:4200") // Origen del frontend + .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") + .allowedHeaders("*") + .allowCredentials(true); + } +} \ No newline at end of file