Skip to content

Commit

Permalink
Merge pull request #187 from THEGOODs-repo/refactor/186
Browse files Browse the repository at this point in the history
♻️ Refactor: Cookie 설정 변경
  • Loading branch information
hyoungj00n authored May 18, 2024
2 parents 305fa60 + 603809f commit 135102b
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,9 @@ public MemberResponseDTO.LoginResultDTO login(MemberRequestDTO.LoginDTO request,
// refresh 생성후 쿠키로 만들고 response 헤더에 담기
RefreshToken refreshToken = redisService.generateRefreshToken(request.getEmail());
Cookie cookie = new Cookie("refreshToken",refreshToken.getToken());
cookie.setSecure(true);
cookie.setHttpOnly(true);
cookie.setPath("/");
response.addCookie(cookie);

LocalDateTime currentDateTime = LocalDateTime.now();
Expand Down Expand Up @@ -407,6 +409,8 @@ public MemberResponseDTO.LoginResultDTO emailAuthCreateJWT(MemberRequestDTO.Emai
RefreshToken refreshToken = redisService.generateRefreshToken(request.getEmail());
Cookie cookie = new Cookie("refreshToken",refreshToken.getToken());
cookie.setHttpOnly(true);
cookie.setSecure(true);
cookie.setPath("/");
response.addCookie(cookie);

LocalDateTime currentDateTime = LocalDateTime.now();
Expand Down Expand Up @@ -527,7 +531,9 @@ public ApiResponse<?> kakaoAuth(String code, HttpServletResponse res) {
// refresh 생성후 쿠키로 만들고 response 헤더에 담기
RefreshToken refreshToken = redisService.generateRefreshToken(member.get().getEmail());
Cookie cookie = new Cookie("refreshToken",refreshToken.getToken());
cookie.setSecure(true);
cookie.setHttpOnly(true);
cookie.setPath("/");
res.addCookie(cookie);


Expand Down Expand Up @@ -630,6 +636,8 @@ public ApiResponse<?> naverAuth(String code, String state, HttpServletResponse r
RefreshToken refreshToken = redisService.generateRefreshToken(member.get().getEmail());
Cookie cookie = new Cookie("refreshToken",refreshToken.getToken());
cookie.setHttpOnly(true);
cookie.setSecure(true);
cookie.setPath("/");
res.addCookie(cookie);

return ApiResponse.onSuccess(MemberResponseDTO.LoginResultDTO.builder()
Expand Down

0 comments on commit 135102b

Please sign in to comment.