Skip to content

Commit

Permalink
[feat] 토큰 리프레시할 경우 기존 토큰 삭제 #160
Browse files Browse the repository at this point in the history
  • Loading branch information
wjdtkdgns committed Sep 7, 2023
1 parent 0c10146 commit 5b80997
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public OauthRegisterResponse execute(String refreshToken) {
RefreshTokenEntity oldToken = refreshTokenAdaptor.findTokenByRefreshToken(refreshToken);
Long userId = jwtTokenProvider.parseRefreshToken(oldToken.getRefreshToken());
User user = userAdaptor.findById(userId);
refreshTokenAdaptor.delete(oldToken);
return OauthRegisterResponse.from(tokenGenerateHelper.execute(user));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,8 @@ public RefreshTokenEntity findTokenByRefreshToken(String refreshToken) {
.findByRefreshToken(refreshToken)
.orElseThrow(() -> ExpiredRefreshTokenException.EXCEPTION);
}

public void delete(RefreshTokenEntity token) {
refreshTokenRepository.delete(token);
}
}

0 comments on commit 5b80997

Please sign in to comment.