Skip to content

Commit

Permalink
reissue API의 오류 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
김교휘 authored and 김교휘 committed May 26, 2024
1 parent 51c3f99 commit 66330b6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,12 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http
.cors(corsCustomizer -> corsCustomizer.configurationSource(request -> {
CorsConfiguration configuration = new CorsConfiguration();
configuration.setAllowedOrigins(Collections.singletonList("http://localhost:3000")); // 프론트 서버의 주소
configuration.setAllowedOrigins(Arrays.asList("http://localhost:3000", "http://localhost:8080")); // 프론트 서버의 주소들 // 프론트 서버의 주소
configuration.setAllowedMethods(Collections.singletonList("*")); // 모든 요청 메서드 허용
configuration.setAllowCredentials(true);
configuration.setAllowedHeaders(Collections.singletonList("*")); // 모든 헤더 허용
configuration.setMaxAge(3600L);
configuration.setExposedHeaders(Collections.singletonList("Set-Cookie")); // Set-Cookie 헤더 노출
configuration.setExposedHeaders(Collections.singletonList("Authorization"));
configuration.setExposedHeaders(Arrays.asList("Set-Cookie", "Authorization")); // Set-Cookie 및 Authorization 헤더 노출
return configuration;
}))
.csrf(csrf -> csrf.disable()) // CSRF 비활성화
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse
}
String path = request.getRequestURI();
if (path.startsWith("/health-check") || path.startsWith("/security-check") || path.startsWith("/reissue")) {
System.out.println("jwt필터 통과로직");
filterChain.doFilter(request, response);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ else if (role.equals("ROLE_MENTEE") || role.equals("ROLE_MENTOR"))
//가입필요 : 추가정보 가입 request넣어줘야함 가입완료 : 발급받은 토큰으로 요청보내면됨

response.setStatus(HttpStatus.OK.value()); //200으로 프론트에 반환쳐주기

response.sendRedirect("http://localhost:3000/callback");
//response.sendRedirect("http://localhost:8080/swagger-ui/index.html");
}

private Cookie createCookie(String key, String value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ public ResponseEntity<?> reissueByRefreshToken(HttpServletRequest request, HttpS
for (Cookie cookie : cookies) {

if (cookie.getName().equals("refresh")) {

refresh = cookie.getValue();
System.out.println("refresh = " + refresh);
System.out.println("리프레쉬토큰 찾음");
}
}

Expand All @@ -67,7 +68,6 @@ public ResponseEntity<?> reissueByRefreshToken(HttpServletRequest request, HttpS
}

//expired check
JWTUtil jwtUtil = null;
try {
jwtUtil.isExpired(refresh);
} catch (ExpiredJwtException e) {
Expand Down

0 comments on commit 66330b6

Please sign in to comment.