Skip to content

Commit e03b6b3

Browse files
committed
feat: jwt expire 검증 누락 추가
1 parent 3c3f391 commit e03b6b3

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Diff for: src/main/java/com/softeer/podoarrival/security/jwt/TokenProvider.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import java.text.ParseException;
1616
import java.util.Base64;
17+
import java.util.Date;
1718

1819
@Component
1920
public class TokenProvider {
@@ -38,7 +39,14 @@ public JWTClaimsSet validateTokenAndGetClaimsSet(String token) {
3839
throw new InvalidTokenException("Token signature is invalid");
3940
}
4041

41-
return signedJWT.getJWTClaimsSet();
42+
JWTClaimsSet claimsSet = signedJWT.getJWTClaimsSet();
43+
// expirationTime 검증
44+
Date expirationTime = claimsSet.getExpirationTime();
45+
if (expirationTime == null || expirationTime.before(new Date())) {
46+
throw new InvalidTokenException("이미 만료된 토큰입니다.");
47+
}
48+
49+
return claimsSet;
4250

4351
} catch (JOSEException | ParseException e) {
4452
throw new InvalidTokenException("JWE Token Decoding Error - 토큰 검증과정에서 오류 발생");

0 commit comments

Comments
 (0)