Skip to content

Commit

Permalink
feat: front url - 리스트로 관리
Browse files Browse the repository at this point in the history
  • Loading branch information
f1v3-dev committed Oct 25, 2024
1 parent f452bab commit 2cc8c5d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.List;

/**
* 째깍 서비스 Properties 관리 클래스
*
Expand All @@ -15,7 +17,7 @@
@ConfigurationProperties(prefix = "jjakkak")
public class JjakkakProperties {

private String frontUrl;
private List<String> frontUrl;

private String jwtSecret;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"));

Expand Down

0 comments on commit 2cc8c5d

Please sign in to comment.