Skip to content

Commit d2b3458

Browse files
authored
test(auth): 프론트 테스트 위해 쿠키값 임시 설정
test(auth): 프론트 테스트 위해 쿠키값 임시 설정
2 parents ea6b08f + b6b7aa4 commit d2b3458

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

gdgoc/src/main/java/inha/gdgoc/domain/auth/controller/AuthController.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import lombok.RequiredArgsConstructor;
2424
import lombok.extern.slf4j.Slf4j;
2525
import org.springframework.http.HttpStatus;
26+
import org.springframework.http.ResponseCookie;
2627
import org.springframework.http.ResponseEntity;
2728
import org.springframework.security.core.Authentication;
2829
import org.springframework.security.core.context.SecurityContextHolder;
@@ -162,12 +163,12 @@ private String extractRefreshTokenFromCookie(HttpServletRequest request) {
162163
}
163164

164165
private void expireCookie(HttpServletResponse response) {
165-
Cookie cookie = new Cookie("refresh_token", null);
166-
cookie.setMaxAge(0);
167-
cookie.setPath("/");
168-
cookie.setHttpOnly(true);
169-
cookie.setSecure(false);
170-
cookie.setDomain("localhost");
171-
response.addCookie(cookie);
166+
ResponseCookie expiredCookie = ResponseCookie.from("refresh_token", null)
167+
.maxAge(0)
168+
.path("/")
169+
.httpOnly(true)
170+
.secure(false)
171+
.sameSite("Lax")
172+
.build();
172173
}
173174
}

gdgoc/src/main/java/inha/gdgoc/domain/auth/service/AuthService.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,8 @@ public Map<String, Object> processOAuthLogin(String code, HttpServletResponse re
100100
ResponseCookie refreshCookie = ResponseCookie.from("refresh_token", refreshToken)
101101
.httpOnly(true)
102102
.secure(false)
103-
.sameSite("None")
103+
.sameSite("Lax")
104104
.path("/")
105-
.domain("localhost")
106105
.maxAge(Duration.ofDays(1))
107106
.build();
108107

@@ -133,9 +132,8 @@ public LoginResponse loginWithPassword(UserLoginRequest userLoginRequest, HttpSe
133132
ResponseCookie refreshCookie = ResponseCookie.from("refresh_token", refreshToken)
134133
.httpOnly(true)
135134
.secure(false)
136-
.sameSite("None")
135+
.sameSite("Lax")
137136
.path("/")
138-
.domain("localhost")
139137
.maxAge(Duration.ofDays(1))
140138
.build();
141139

0 commit comments

Comments
 (0)