Skip to content

Commit

Permalink
refactor: jwt cookie name 매직 리터럴 상수화 #8
Browse files Browse the repository at this point in the history
  • Loading branch information
PgmJun committed Jan 18, 2024
1 parent 57f66b5 commit 768e9b3
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public class AuthController {
private final CreateTokenService createTokenService;
private final CommonAuthService commonAuthService;

private static final String ACCESS_TOKEN_COOKIE_NAME = "accessToken";
private static final String REFRESH_TOKEN_COOKIE_NAME = "refreshToken";

@Operation(summary = "OAuth2 소셜 회원가입")
@ResponseStatus(HttpStatus.OK)
Expand Down Expand Up @@ -77,8 +79,8 @@ public ApiResponse<?> reissue(@CookieValue String accessToken, @CookieValue Stri
}

private void addTokensToCookie(TokenVO tokenVO, HttpServletResponse response) {
addTokenToCookie("accessToken", tokenVO.getAccessToken(), response);
addTokenToCookie("refreshToken", tokenVO.getRefreshToken(), response);
addTokenToCookie(ACCESS_TOKEN_COOKIE_NAME, tokenVO.getAccessToken(), response);
addTokenToCookie(REFRESH_TOKEN_COOKIE_NAME, tokenVO.getRefreshToken(), response);
}

private void addTokenToCookie(String cookieName, String token, HttpServletResponse response) {
Expand Down

0 comments on commit 768e9b3

Please sign in to comment.