Skip to content

Commit

Permalink
fix: 토큰 재발급은 refreshToken으로만 가능하도록 함
Browse files Browse the repository at this point in the history
  • Loading branch information
SJ70 committed Jul 25, 2024
1 parent 1104b7e commit c9246fc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/java/com/j9/bestmoments/service/TokenService.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ public Token findByToken(String token) {
@Transactional
public String refresh(String refreshToken) {
Token foundToken = this.findByToken(refreshToken);
if (!foundToken.getTokenType().equals(TokenType.REFRESH_TOKEN)) {
throw new AccessDeniedException("만료되거나 발급되지 않은 토큰입니다.");
}
Member member = memberService.findById(foundToken.getMemberId());
String newAccessToken = createAccessToken(member);
return newAccessToken;
Expand Down

0 comments on commit c9246fc

Please sign in to comment.