update de la cors

This commit is contained in:
Guams 2025-02-16 00:41:12 +01:00
parent 2d01f65c95
commit 8a2ac5be69
2 changed files with 2 additions and 3 deletions

View File

@ -54,7 +54,7 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
if (isRateLimited(authorUuid, request)) { if (isRateLimited(authorUuid, request)) {
response.setStatus(429); // TOO MANY REQUESTS response.setStatus(429); // TOO MANY REQUESTS
response.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8");
response.getWriter().write("{\"message\":\"Vous avez envoyé trop de requête d'un coups, patientez un peu...\"}"); response.getWriter().write("{\"message\":\"Vous avez envoyé trop de requête d'un coups, patientez un peu...\"}");
return; return;
} }

View File

@ -52,8 +52,7 @@ public class SpringSecurityConfig {
@Bean @Bean
public CorsConfigurationSource corsConfigurationSource() { public CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration configuration = new CorsConfiguration(); CorsConfiguration configuration = new CorsConfiguration();
// configuration.setAllowedOrigins(List.of("http://192.168.1.35:4200")); configuration.setAllowedOrigins(List.of("https://abonentendeur.guams.fr", "http://192.168.1.35:4200", "http://localhost:4200"));
configuration.setAllowedOrigins(List.of("http://localhost:4200"));
configuration.setAllowedMethods(List.of("GET", "POST", "PUT", "DELETE")); // Méthodes HTTP autorisées configuration.setAllowedMethods(List.of("GET", "POST", "PUT", "DELETE")); // Méthodes HTTP autorisées
configuration.setAllowedHeaders(List.of("Authorization", "Content-Type")); // En-têtes autorisés configuration.setAllowedHeaders(List.of("Authorization", "Content-Type")); // En-têtes autorisés
configuration.setAllowCredentials(true); // Permet l'utilisation des cookies ou des tokens configuration.setAllowCredentials(true); // Permet l'utilisation des cookies ou des tokens