From ae8627ab890eb62e7279db165bb2e0bcb054eacb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EA=B5=90=ED=9C=98?= Date: Tue, 28 May 2024 15:39:59 +0900 Subject: [PATCH] =?UTF-8?q?loginStatus=20=ED=97=A4=EB=8D=94=EC=97=90=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CoffeeChat/controller/RefreshTokenController.java | 2 +- .../soongsil/CoffeeChat/service/RefreshTokenService.java | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) 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);