File tree 1 file changed +9
-1
lines changed
src/main/java/com/softeer/podoarrival/security/jwt
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 14
14
15
15
import java .text .ParseException ;
16
16
import java .util .Base64 ;
17
+ import java .util .Date ;
17
18
18
19
@ Component
19
20
public class TokenProvider {
@@ -38,7 +39,14 @@ public JWTClaimsSet validateTokenAndGetClaimsSet(String token) {
38
39
throw new InvalidTokenException ("Token signature is invalid" );
39
40
}
40
41
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 ;
42
50
43
51
} catch (JOSEException | ParseException e ) {
44
52
throw new InvalidTokenException ("JWE Token Decoding Error - 토큰 검증과정에서 오류 발생" );
You can’t perform that action at this time.
0 commit comments