为什么jwt生成的token会是完全一样的?
jwt生成的token为什么会一样,登录的是同一个账号,但是我去使用的时候token又报过期的错误?我设置了过期时间
public String createToken(Integer id,String username,Integer gradeId,Integer jurisdictionId,Integer status) {
JWTCreator.Builder builder = JWT.create();
builder.withClaim("id",id);
builder.withClaim("username",username);
builder.withClaim("gradeId",gradeId);
builder.withClaim("jurisdictionId",jurisdictionId);
builder.withClaim("status",status);
long expiration = StatusCode.tokenExpiration.getCode() * 60 * 60 * 1000;
builder.withExpiresAt(new Date(expiration));
String token = builder.sign(Algorithm.HMAC256(SIGNATURE));
Map<String,Object> verifyTokenMap = new HashMap<>();
verifyTokenMap.put("userId",id);
verifyTokenMap.put("token",token);
this.verifyToken.add(verifyTokenMap);
this.redisUtil.setValue("token" + id,token);
return token;
}