Skip to content

Commit

Permalink
Update SecurityConfig.java
Browse files Browse the repository at this point in the history
  • Loading branch information
jinu0328 committed Dec 28, 2024
1 parent 601301c commit c64a382
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.gulbi.Backend.global.config;

import static org.springframework.security.config.Customizer.withDefaults;

import com.gulbi.Backend.global.filter.JwtAuthenticationFilter;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Bean;
Expand All @@ -17,7 +19,6 @@
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import static org.springframework.security.config.Customizer.withDefaults;
@Configuration
@EnableWebSecurity
@RequiredArgsConstructor
Expand All @@ -44,7 +45,8 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**") // 모든 경로에 대해 적용
.allowedOrigins("https://yajoba-frontend.vercel.app", "http://localhost") // 허용할 도메인
.allowedOrigins("https://yajoba-frontend.vercel.app", "http://localhost",
"http://3.38.240.132", "http://192.168.219.78") // 허용할 도메인
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") // 허용할 HTTP 메서드
.allowedHeaders("*") // 허용할 헤더
.allowCredentials(true); // 쿠키 허용 여부
Expand All @@ -56,7 +58,8 @@ public PasswordEncoder passwordEncoder() {
}

@Bean
public AuthenticationManager authenticationManager(AuthenticationConfiguration authenticationConfiguration) throws Exception {
public AuthenticationManager authenticationManager(AuthenticationConfiguration authenticationConfiguration)
throws Exception {
return authenticationConfiguration.getAuthenticationManager();
}
}

0 comments on commit c64a382

Please sign in to comment.