payload 中有个标准字段 exp,明确表示了这个 token 的过期时间. 服务端可以拿这个时间与服务器时间作对比,过期则拒绝访问。
DecodedJWT jwt
= JWT
.decode(token
);
Map
<String, Claim> claims
= jwt
.getClaims();
Claim exp
= claims
.get("exp");
Date date
= exp
.asDate();
System
.out
.println("date = " + date
);
转载请注明原文地址: https://lol.8miu.com/read-37201.html