secure /api/brands/** endpoint and update CORS configuration

This commit is contained in:
Vincent Guillet
2025-10-14 14:50:26 +02:00
parent 611eb685a8
commit f2f855bc70

View File

@@ -40,6 +40,7 @@ public class SecurityConfig {
.authorizeHttpRequests(authz -> authz
.requestMatchers("/api/auth/**").permitAll()
.requestMatchers("/api/users/**").authenticated()
.requestMatchers("/api/brands/**").authenticated()
.anyRequest().permitAll()
)
@@ -58,7 +59,7 @@ public class SecurityConfig {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("http://localhost:4200", "http://127.0.0.1:4200") // Ton front
.allowedOrigins("http://localhost:4200", "http://127.0.0.1:4200")
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
.allowedHeaders("*")
.allowCredentials(true);