Skip to content

Commit

Permalink
[CHORE] #11 bearer prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
nykoh2001 committed May 31, 2024
1 parent b960c65 commit 7d648ac
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
@RequiredArgsConstructor
public class JwtTokenProvider {
private static final String USER_ID = "userId";
private static final String BEARER_PREFIX = "Bearer ";

private static final Long ACCESS_TOKEN_EXPIRATION_TIME = 24 * 60 * 60 * 1000L * 7;
private static final Long REFRESH_TOKEN_EXPIRATION_TIME = 24 * 60 * 60 * 1000L * 14;
Expand Down Expand Up @@ -58,7 +59,7 @@ public String generateAccessToken(Authentication authentication, Long tokenExpir

claims.put(USER_ID, authentication.getPrincipal());

return Jwts.builder()
return BEARER_PREFIX + Jwts.builder()
.setHeaderParam(Header.TYPE, Header.JWT_TYPE) // Header
.setClaims(claims) // Claim
.signWith(getSigningKey()) // Signature
Expand All @@ -71,7 +72,7 @@ public String generateRefreshToken(Long tokenExpirationTime) {
.setIssuedAt(now)
.setExpiration(new Date(now.getTime() + tokenExpirationTime)); // 만료 시간

return Jwts.builder()
return BEARER_PREFIX + Jwts.builder()
.setClaims(claims)
.signWith(getSigningKey())
.compact();
Expand Down

0 comments on commit 7d648ac

Please sign in to comment.