Skip to content

Commit

Permalink
fix : 토큰 재발급 오류 해결 (#237)
Browse files Browse the repository at this point in the history
* fix : 만료된 토큰에 대해 parseClaim 예외 catch

* feat : JwtFilter 예외 엔드포인트 추가 및 수정
  • Loading branch information
rladmstn authored Dec 8, 2024
1 parent 0729081 commit dae2f9e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
@RequiredArgsConstructor
public class JwtAuthenticationFilter extends OncePerRequestFilter {
private final TokenProvider tokenProvider;
private final List<String> excludedPaths = Arrays.asList("/api/users/sign-in", "/api/users/sign-up");
private final List<String> excludedPaths = Arrays.asList("/api/auth/sign-in", "/api/auth/sign-up",
"/api/auth/reissue-token");

@Override
protected boolean shouldNotFilter(HttpServletRequest request) throws ServletException {
Expand Down
14 changes: 9 additions & 5 deletions src/main/java/com/gamzabat/algohub/common/jwt/TokenProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,15 @@ public boolean validateToken(String token) {
}

private Claims parseClaims(String token) {
return Jwts.parserBuilder()
.setSigningKey(accessTokenKey)
.build()
.parseClaimsJws(token)
.getBody();
try {
return Jwts.parserBuilder()
.setSigningKey(accessTokenKey)
.build()
.parseClaimsJws(token)
.getBody();
} catch (ExpiredJwtException e) {
return e.getClaims();
}
}

public String getUserEmail(String authToken) {
Expand Down

0 comments on commit dae2f9e

Please sign in to comment.