secure /api/brands/** endpoint and update CORS configuration
This commit is contained in:
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user