From 0f9bfe4c04e9c688806e622eb63e91bb0b7307cc Mon Sep 17 00:00:00 2001 From: CYY1007 Date: Fri, 16 Feb 2024 19:17:59 +0900 Subject: [PATCH] =?UTF-8?q?:bug:=20Fix=20:=20=EB=A6=AC=ED=94=84=EB=A0=88?= =?UTF-8?q?=EC=8B=9C=20=ED=86=A0=ED=81=B0=20=EB=AC=B4=EC=A1=B0=EA=B1=B4=20?= =?UTF-8?q?access=20Token=EA=B3=BC=20=EC=9E=AC=EB=B0=9C=EA=B8=89=20?= =?UTF-8?q?=EB=90=98=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../briefingapi/redis/service/RedisServiceImpl.java | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/Briefing-Api/src/main/java/com/example/briefingapi/redis/service/RedisServiceImpl.java b/Briefing-Api/src/main/java/com/example/briefingapi/redis/service/RedisServiceImpl.java index 29ef3ce..8d9ccce 100644 --- a/Briefing-Api/src/main/java/com/example/briefingapi/redis/service/RedisServiceImpl.java +++ b/Briefing-Api/src/main/java/com/example/briefingapi/redis/service/RedisServiceImpl.java @@ -47,7 +47,7 @@ public RefreshToken generateRefreshToken(String socialId, SocialType socialType) LocalDateTime currentTime = LocalDateTime.now(); - LocalDateTime expireTime = currentTime.plus(1000, ChronoUnit.MINUTES); + LocalDateTime expireTime = currentTime.plus(90, ChronoUnit.SECONDS); return refreshTokenRepository.save( RefreshToken.builder() @@ -68,8 +68,6 @@ public RefreshToken reGenerateRefreshToken(MemberRequest.ReissueDTO request) { () -> new RefreshTokenException(ErrorCode.INVALID_REFRESH_TOKEN)); LocalDateTime expireTime = findRefreshToken.getExpireTime(); LocalDateTime current = LocalDateTime.now(); - // 테스트용, 실제로는 현재 시간 + accessToken 만료 시간 - LocalDateTime expireDeadLine = current.plusSeconds(20); Member member = memberRepository @@ -80,13 +78,8 @@ public RefreshToken reGenerateRefreshToken(MemberRequest.ReissueDTO request) { logger.error("이미 만료된 리프레시 토큰 발견"); throw new RefreshTokenException(ErrorCode.RELOGIN_EXCEPTION); } - - // 새로 발급할 accessToken보다 refreshToken이 먼저 만료 될 경우인가? - if (expireTime.isAfter(expireDeadLine)) { - logger.info("기존 리프레시 토큰 발급"); - return findRefreshToken; - } else { - logger.info("accessToken보다 먼저 만료될 예정인 리프레시 토큰 발견"); + else{ + logger.info("리프레시 토큰과 access 토큰 재발급"); deleteRefreshToken(request.getRefreshToken()); return generateRefreshToken(member.getSocialId(), member.getSocialType()); }