Skip to content

Commit

Permalink
Merge pull request #231 from 100-hours-a-week/test/secure-and-sameSite
Browse files Browse the repository at this point in the history
test: 쿠키 Secure, SameSite 속성 테스트 복구
  • Loading branch information
49EHyeon42 authored Sep 25, 2024
2 parents cae0f21 + e1dbc6b commit 2e4025c
Showing 1 changed file with 6 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import java.io.IOException;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseCookie;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.GetMapping;
Expand Down Expand Up @@ -49,23 +48,12 @@ public void kakaoLogin(

try {
if (tokenDto.isFirstLogin()) {
ResponseCookie tempTokenCookie = ResponseCookie.from("tempToken", tokenDto.getTempToken())
.path("/")
.httpOnly(true)
.maxAge(tokenDto.getTempTokenExpirationTime())
.domain("connectrip.site")
// .sameSite("None")
.secure(true)
.build();

httpServletResponse.addHeader("Set-Cookie", tempTokenCookie.toString());

// Cookie tempTokenCookie = new Cookie("tempToken", tokenDto.getTempToken());
// tempTokenCookie.setPath("/");
// tempTokenCookie.setMaxAge(tokenDto.getTempTokenExpirationTime());
// tempTokenCookie.setHttpOnly(true);
//
// httpServletResponse.addCookie(tempTokenCookie);
Cookie tempTokenCookie = new Cookie("tempToken", tokenDto.getTempToken());
tempTokenCookie.setPath("/");
tempTokenCookie.setMaxAge(tokenDto.getTempTokenExpirationTime());
tempTokenCookie.setHttpOnly(true);

httpServletResponse.addCookie(tempTokenCookie);

httpServletResponse.sendRedirect(kakaoFirstLoginRedirectUrl);
} else {
Expand Down

0 comments on commit 2e4025c

Please sign in to comment.