File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
src/main/java/com/alwinsimon/UserManagementJavaSpringBoot/Config Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change 1
1
package com .alwinsimon .UserManagementJavaSpringBoot .Config ;
2
2
3
+ import com .alwinsimon .UserManagementJavaSpringBoot .Config .Auth .CorsConfig ;
3
4
import com .alwinsimon .UserManagementJavaSpringBoot .Config .Filter .JwtAuthenticationFilter ;
4
5
import jakarta .servlet .Filter ;
5
6
import lombok .RequiredArgsConstructor ;
7
+ import org .springframework .beans .factory .annotation .Autowired ;
6
8
import org .springframework .context .annotation .Bean ;
7
9
import org .springframework .context .annotation .Configuration ;
8
10
import org .springframework .security .authentication .AuthenticationProvider ;
@@ -20,11 +22,15 @@ public class SecurityConfig {
20
22
private final JwtAuthenticationFilter jwtAuthenticationFilter ;
21
23
private final AuthenticationProvider authenticationProvider ;
22
24
25
+ @ Autowired
26
+ private CorsConfig corsConfig ;
27
+
23
28
@ Bean
24
29
public SecurityFilterChain securityFilterChain (HttpSecurity http ) throws Exception {
25
30
26
31
http
27
32
.csrf ((csrf ) -> csrf .disable ())
33
+ .cors ( cors ->cors .configurationSource (corsConfig ))
28
34
.authorizeHttpRequests (authorize ->authorize
29
35
.requestMatchers ("/health/" ,"/api/v1/auth/**" )
30
36
.permitAll ()
You can’t perform that action at this time.
0 commit comments