diff --git a/src/main/java/com/soongsil/CoffeeChat/controller/RefreshTokenController.java b/src/main/java/com/soongsil/CoffeeChat/controller/RefreshTokenController.java index 7f425e8..1a02d31 100644 --- a/src/main/java/com/soongsil/CoffeeChat/controller/RefreshTokenController.java +++ b/src/main/java/com/soongsil/CoffeeChat/controller/RefreshTokenController.java @@ -30,7 +30,7 @@ public RefreshTokenController(JWTUtil jwtUtil, RefreshTokenService refreshTokenS @PostMapping("/reissue") @Operation(summary="리프레쉬 토큰으로 액세스 토큰 reissue") - @ApiResponse(responseCode = "200", description = "액세스토큰 재발급") + @ApiResponse(responseCode = "200", description = "헤더 : access, refresh, loginStatus") public ResponseEntity reissue(HttpServletRequest request, HttpServletResponse response){ return refreshTokenService.reissueByRefreshToken(request, response); } diff --git a/src/main/java/com/soongsil/CoffeeChat/service/RefreshTokenService.java b/src/main/java/com/soongsil/CoffeeChat/service/RefreshTokenService.java index 12639f9..bb09fbe 100644 --- a/src/main/java/com/soongsil/CoffeeChat/service/RefreshTokenService.java +++ b/src/main/java/com/soongsil/CoffeeChat/service/RefreshTokenService.java @@ -51,9 +51,12 @@ private void addRefreshEntity(String username, String refresh, Long expiredMs) { public ResponseEntity reissueByRefreshToken(HttpServletRequest request, HttpServletResponse response) { //get refresh token String refresh = null; + String loginStatus=null; Cookie[] cookies = request.getCookies(); for (Cookie cookie : cookies) { - + if (cookie.getName().equals("loginStatus")){ + loginStatus=cookie.getValue(); + } if (cookie.getName().equals("refresh")) { refresh = cookie.getValue(); System.out.println("refresh = " + refresh); @@ -107,6 +110,7 @@ public ResponseEntity reissueByRefreshToken(HttpServletRequest request, HttpS //response response.setHeader("access", newAccess); response.setHeader("refresh", newRefresh); + response.setHeader("loginStatus", loginStatus); response.addCookie(createCookie("refresh", newRefresh)); return new ResponseEntity<>(HttpStatus.OK);