10-11-2025

This commit is contained in:
Mohd-Arham
2025-11-10 10:11:26 +05:30
parent cfac612306
commit c67f222957
34 changed files with 1544 additions and 425 deletions
@@ -0,0 +1,28 @@
package com.billpaymentservice.bbps.config;
import java.util.Arrays;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.CorsConfigurationSource;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
@Configuration
public class SecurityConfig {
@Bean
public CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration config = new CorsConfiguration();
config.setAllowedOrigins(Arrays.asList("*")); // Or use specific origin like "http://localhost:4200"
config.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE", "OPTIONS"));
config.setAllowedHeaders(Arrays.asList("*"));
config.setAllowCredentials(false); // true only if you're sending cookies
// Use UrlBasedCorsConfigurationSource as it implements CorsConfigurationSource
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/**", config); // Apply CORS to all paths
return source; // Return as CorsConfigurationSource
}
}