Skip to content

Commit

Permalink
feat/#507: 리프레시 토큰을 레디스에 저장할 때 key를 memberId로 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
LJH098 committed Oct 7, 2024
1 parent 43c231f commit b3101d6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit b3101d6

Please sign in to comment.