File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
src/main/java/com/alwinsimon/UserManagementJavaSpringBoot/Config/Auth Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com .alwinsimon .UserManagementJavaSpringBoot .Config .Auth ;
2
+
3
+ import jakarta .servlet .http .HttpServletRequest ;
4
+ import org .springframework .context .annotation .Configuration ;
5
+ import org .springframework .lang .Nullable ;
6
+ import org .springframework .web .cors .CorsConfiguration ;
7
+ import org .springframework .web .cors .CorsConfigurationSource ;
8
+
9
+ import java .util .Arrays ;
10
+ import java .util .Collections ;
11
+
12
+ @ Configuration
13
+ public class CorsConfig implements CorsConfigurationSource {
14
+
15
+ @ Override
16
+ @ Nullable
17
+ public CorsConfiguration getCorsConfiguration (HttpServletRequest arg0 ) {
18
+ CorsConfiguration config = new CorsConfiguration ();
19
+ config .setAllowedOrigins (Collections .singletonList ("*" ));
20
+ config .setAllowedMethods (Collections .singletonList ("*" ));
21
+ config .setAllowCredentials (true );
22
+ config .setAllowedHeaders (Collections .singletonList ("*" ));
23
+ config .setExposedHeaders (Arrays .asList ("Authorization" ));
24
+ config .setMaxAge (3600L );
25
+
26
+ return config ;
27
+ }
28
+ }
You can’t perform that action at this time.
0 commit comments