diff --git a/src/main/java/com/dnd/jjakkak/domain/jwt/handler/OAuth2FailureHandler.java b/src/main/java/com/dnd/jjakkak/domain/jwt/handler/OAuth2FailureHandler.java index c435a10..7d13ec3 100644 --- a/src/main/java/com/dnd/jjakkak/domain/jwt/handler/OAuth2FailureHandler.java +++ b/src/main/java/com/dnd/jjakkak/domain/jwt/handler/OAuth2FailureHandler.java @@ -29,6 +29,6 @@ public class OAuth2FailureHandler extends SimpleUrlAuthenticationFailureHandler public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException e) throws IOException, ServletException { request.getSession().removeAttribute(tokenProperties.getQueryParam()); - response.sendRedirect(jjakkakProperties.getFrontUrl() + "/login/failure"); + response.sendRedirect(jjakkakProperties.getFrontUrl().get(0) + "/login/failure"); } } diff --git a/src/main/java/com/dnd/jjakkak/domain/jwt/handler/OAuth2SuccessHandler.java b/src/main/java/com/dnd/jjakkak/domain/jwt/handler/OAuth2SuccessHandler.java index c7d72aa..3eb8240 100644 --- a/src/main/java/com/dnd/jjakkak/domain/jwt/handler/OAuth2SuccessHandler.java +++ b/src/main/java/com/dnd/jjakkak/domain/jwt/handler/OAuth2SuccessHandler.java @@ -56,7 +56,7 @@ public void onAuthenticationSuccess(HttpServletRequest request, HttpServletRespo * @return 리다이렉트 URL */ public String getRedirectUrl(HttpServletRequest request) { - String baseUrl = jjakkakProperties.getFrontUrl() + "/login/success"; + String baseUrl = jjakkakProperties.getFrontUrl().get(0) + "/login/success"; HttpSession session = request.getSession(); String redirectParam = (String) session.getAttribute(tokenProperties.getQueryParam()); diff --git a/src/main/java/com/dnd/jjakkak/global/config/proprties/JjakkakProperties.java b/src/main/java/com/dnd/jjakkak/global/config/proprties/JjakkakProperties.java index 22c5b0d..0966098 100644 --- a/src/main/java/com/dnd/jjakkak/global/config/proprties/JjakkakProperties.java +++ b/src/main/java/com/dnd/jjakkak/global/config/proprties/JjakkakProperties.java @@ -4,6 +4,8 @@ import lombok.Setter; import org.springframework.boot.context.properties.ConfigurationProperties; +import java.util.List; + /** * 째깍 서비스 Properties 관리 클래스 * @@ -15,7 +17,7 @@ @ConfigurationProperties(prefix = "jjakkak") public class JjakkakProperties { - private String frontUrl; + private List frontUrl; private String jwtSecret; } diff --git a/src/main/java/com/dnd/jjakkak/global/config/security/SecurityConfig.java b/src/main/java/com/dnd/jjakkak/global/config/security/SecurityConfig.java index 0c3ef7f..fcdeb2f 100644 --- a/src/main/java/com/dnd/jjakkak/global/config/security/SecurityConfig.java +++ b/src/main/java/com/dnd/jjakkak/global/config/security/SecurityConfig.java @@ -110,7 +110,7 @@ SecurityFilterChain filterChain(HttpSecurity http) throws Exception { @Bean protected CorsConfigurationSource corsConfigurationSource() { // 추후 CORS 수정 필요 CorsConfiguration config = new CorsConfiguration(); - config.setAllowedOrigins(List.of(jjakkakProperties.getFrontUrl(), "http://localhost:5173", "http://jjakkak.com", "https://jjakkak.com")); // 허용할 도메인 명시 + config.setAllowedOrigins(jjakkakProperties.getFrontUrl()); config.setAllowedMethods(List.of("GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS")); config.setAllowedHeaders(List.of("Authorization", "Content-Type", "Access-Control-Allow-Headers", "Access-Control-Expose-Headers", "_retry"));