-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: refresh token을 발급해서 반환하도록 필드 추가 (#200)
- Loading branch information
1 parent
3834461
commit d6d74b6
Showing
9 changed files
with
58 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
public record AuthTokenDto( | ||
String accessToken, | ||
String refreshToken, | ||
String type | ||
) { | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/com/dnd/runus/auth/token/refresh/RefreshTokenProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.dnd.runus.auth.token.refresh; | ||
|
||
import com.dnd.runus.auth.token.dto.AuthTokenClaimDto; | ||
import com.dnd.runus.auth.token.strategry.TokenStrategy; | ||
import com.dnd.runus.global.constant.AuthConstant; | ||
import io.micrometer.common.util.StringUtils; | ||
import org.springframework.beans.factory.annotation.Qualifier; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class RefreshTokenProvider { | ||
private final TokenStrategy strategy; | ||
|
||
public RefreshTokenProvider(@Qualifier("refreshTokenStrategy") TokenStrategy tokenStrategy) { | ||
this.strategy = tokenStrategy; | ||
} | ||
|
||
public String resolveToken(String rawToken) { | ||
if (StringUtils.isNotBlank(rawToken) && rawToken.startsWith(AuthConstant.TOKEN_TYPE)) { | ||
return rawToken.substring(AuthConstant.TOKEN_TYPE.length()).trim(); | ||
} | ||
return ""; | ||
} | ||
|
||
public String issueToken(String subject) { | ||
return strategy.generateToken(subject); | ||
} | ||
|
||
public AuthTokenClaimDto getClaims(String token) { | ||
return strategy.getClaims(token); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters