Skip to content

Commit

Permalink
Merge pull request #188 from catchroom/develop
Browse files Browse the repository at this point in the history
Refact : 쿠키 http only 설정 임시 false
  • Loading branch information
Parkgeonmoo authored Jan 17, 2024
2 parents 28ae4a6 + b307110 commit 7d24e79
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void accessTokenService(HttpServletRequest request, @AuthenticationPrinci
String newAccessToken = meJWTService.createAccessToken(jwtPayload);

Cookie accessTokenCookie = new Cookie("accessToken", newAccessToken);
accessTokenCookie.setHttpOnly(true);
accessTokenCookie.setHttpOnly(false);
accessTokenCookie.setMaxAge(accessTokenCookieValidTime); // 30분
accessTokenCookie.setPath("/");
response.addCookie(accessTokenCookie);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,20 @@ public void loginUser(LoginRequest loginRequest, HttpServletResponse response) {


Cookie idCookie = new Cookie("id", id);
idCookie.setHttpOnly(true);
idCookie.setHttpOnly(false);
idCookie.setMaxAge(idCookieValidTime); // 30분
idCookie.setPath("/");
response.addCookie(idCookie);

Cookie accessTokenCookie = new Cookie("accessToken", accessToken);
accessTokenCookie.setHttpOnly(true);
accessTokenCookie.setHttpOnly(false);
accessTokenCookie.setMaxAge(accessTokenCookieValidTime); // 30분
accessTokenCookie.setPath("/");
response.addCookie(accessTokenCookie);

// 응답에 리프레시 토큰 쿠키 추가
Cookie refreshTokenCookie = new Cookie("refreshToken", refreshToken);
refreshTokenCookie.setHttpOnly(true);
refreshTokenCookie.setHttpOnly(false);
refreshTokenCookie.setMaxAge(refreshTokenCookieValidTime); // 3000분
refreshTokenCookie.setPath("/");
response.addCookie(refreshTokenCookie);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public void addCorsMappings(CorsRegistry registry) {
// 모든 경로에 대해
registry.addMapping("/**")
// Origin이 http:localhost:3000에 대해
.allowedOrigins(/*"*"*/"http://localhost:3000")
.allowedOrigins("*")
// GET, POST, PUT, PATCH, DELETE, OPTIONS 메서드를 허용한다.
.allowedMethods("GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS")
Expand Down

0 comments on commit 7d24e79

Please sign in to comment.