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 .authorizeHttpRequests(authz -> authz
.requestMatchers("/api/auth/**").permitAll() .requestMatchers("/api/auth/**").permitAll()
.requestMatchers("/api/users/**").authenticated() .requestMatchers("/api/users/**").authenticated()
.requestMatchers("/api/brands/**").authenticated()
.anyRequest().permitAll() .anyRequest().permitAll()
) )
@@ -58,7 +59,7 @@ public class SecurityConfig {
@Override @Override
public void addCorsMappings(CorsRegistry registry) { public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**") 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") .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
.allowedHeaders("*") .allowedHeaders("*")
.allowCredentials(true); .allowCredentials(true);