Skip to content

Commit

Permalink
feat: 토큰 재발급 메서드
Browse files Browse the repository at this point in the history
  • Loading branch information
SJ70 committed Jul 25, 2024
1 parent 9cc3d10 commit 4d80ff6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main/java/com/j9/bestmoments/service/Token_Service.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class Token_Service {

private final Token_Repository tokenRepository;
private final JwtTokenProvider jwtTokenProvider;
private final MemberService memberService;

@Transactional
public LoginDto create(Member member) {
Expand Down Expand Up @@ -55,4 +56,12 @@ private Token_ findByToken(String token) {
.orElseThrow(() -> new AccessDeniedException("만료되거나 발급되지 않은 토큰입니다."));
}

@Transactional
public String refresh(String refreshToken) {
Token_ foundToken = this.findByToken(refreshToken);
Member member = memberService.findById(foundToken.getMemberId());
String newAccessToken = createAccessToken(member);
return newAccessToken;
}

}

0 comments on commit 4d80ff6

Please sign in to comment.