From b3101d6d159daab8b0ab87eafd17dfe250fcf04c Mon Sep 17 00:00:00 2001 From: Jin Hyuk Date: Tue, 8 Oct 2024 02:08:09 +0900 Subject: [PATCH] =?UTF-8?q?feat/#507:=20=EB=A6=AC=ED=94=84=EB=A0=88?= =?UTF-8?q?=EC=8B=9C=20=ED=86=A0=ED=81=B0=EC=9D=84=20=EB=A0=88=EB=94=94?= =?UTF-8?q?=EC=8A=A4=EC=97=90=20=EC=A0=80=EC=9E=A5=ED=95=A0=20=EB=95=8C=20?= =?UTF-8?q?key=EB=A5=BC=20memberId=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/gaebaljip/exceed/adapter/out/redis/RedisAdapter.java | 4 ++-- .../exceed/application/service/auth/AuthService.java | 3 ++- .../gaebaljip/exceed/common/security/domain/JwtManager.java | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/BE/exceed/src/main/java/com/gaebaljip/exceed/adapter/out/redis/RedisAdapter.java b/BE/exceed/src/main/java/com/gaebaljip/exceed/adapter/out/redis/RedisAdapter.java index a8941b4e..ba720ee3 100644 --- a/BE/exceed/src/main/java/com/gaebaljip/exceed/adapter/out/redis/RedisAdapter.java +++ b/BE/exceed/src/main/java/com/gaebaljip/exceed/adapter/out/redis/RedisAdapter.java @@ -16,8 +16,8 @@ public class RedisAdapter implements CodePort { private final RedisUtils redisUtils; @Override - public void saveWithExpiration(String email, String code, Long expiredTime) { - redisUtils.setData(email, code, expiredTime); + public void saveWithExpiration(String key, String code, Long expiredTime) { + redisUtils.setData(key, code, expiredTime); } @Override diff --git a/BE/exceed/src/main/java/com/gaebaljip/exceed/application/service/auth/AuthService.java b/BE/exceed/src/main/java/com/gaebaljip/exceed/application/service/auth/AuthService.java index ab12e54e..1c5f2fb6 100644 --- a/BE/exceed/src/main/java/com/gaebaljip/exceed/application/service/auth/AuthService.java +++ b/BE/exceed/src/main/java/com/gaebaljip/exceed/application/service/auth/AuthService.java @@ -1,6 +1,7 @@ package com.gaebaljip.exceed.application.service.auth; import com.gaebaljip.exceed.adapter.out.redis.RedisAdapter; +import com.gaebaljip.exceed.common.dto.HttpRequestDTO; import com.gaebaljip.exceed.common.dto.ReissueTokenDTO; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.stereotype.Service; @@ -37,7 +38,7 @@ public LoginResponseDTO execute(LoginRequest request) { .accessToken(jwtManager.generateAccessToken(member.getId())) .refreshToken(jwtManager.generateRefreshToken(member.getId())) .build(); - jwtManager.saveRefreshToken(request.email(), loginResponseDTO.refreshToken()); + jwtManager.saveRefreshToken(member.getId().toString(), loginResponseDTO.refreshToken()); return loginResponseDTO; } } diff --git a/BE/exceed/src/main/java/com/gaebaljip/exceed/common/security/domain/JwtManager.java b/BE/exceed/src/main/java/com/gaebaljip/exceed/common/security/domain/JwtManager.java index a3d68659..af859ba0 100644 --- a/BE/exceed/src/main/java/com/gaebaljip/exceed/common/security/domain/JwtManager.java +++ b/BE/exceed/src/main/java/com/gaebaljip/exceed/common/security/domain/JwtManager.java @@ -156,8 +156,8 @@ public boolean validateRefreshToken(String refreshToken, HttpRequestDTO requestD return false; } - public void saveRefreshToken(String email, String refreshToken) { - redisAdapter.saveWithExpiration(email, refreshToken, REFRESH_TOKEN_EXPIRE_TIME); + public void saveRefreshToken(String memberId, String refreshToken) { + redisAdapter.saveWithExpiration(memberId, refreshToken, REFRESH_TOKEN_EXPIRE_TIME); } public Claims parseClaims(String Token) {