|  |  | 
 |  |  |     private final static String jwtSecret = "MhAjU9poLf8ko54K25XBDtonaL33vtt1"; | 
 |  |  |     //过期时间(s) 86400L=1天 604800L=7天 | 
 |  |  |     private static final long expire = 86400L; | 
 |  |  |     //redis过期时间 | 
 |  |  |     private static final Integer redisExpire = 3; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 生成token,根据userId和默认过期时间 | 
 |  |  | 
 |  |  |      * 生成token,根据userId和默认过期时间 | 
 |  |  |      */ | 
 |  |  |     public static String generateTokenForZb(Long userId,String userType,String userInfo,RedisTemplate<String,Object> redisTemplate) { | 
 |  |  |         Long expiredSeconds = getExpireSeconds(); | 
 |  |  |         final Date expirationDate = new Date(System.currentTimeMillis() + expiredSeconds * 1000); | 
 |  |  |         return generateTokenZb(userId,userType,userInfo, expirationDate,redisTemplate); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     public static String generateTokenZb(Long userId, String userType,String userInfo, Date expiredDate,RedisTemplate<String,Object> redisTemplate) { | 
 |  |  |         String tokenKey =  UUID.randomUUID() + "_" + userId; | 
 |  |  |         redisTemplate.opsForValue().set(userType + "_" +tokenKey,userInfo); | 
 |  |  |         redisTemplate.opsForValue().set(userType + "_" +tokenKey,userInfo,redisExpire,TimeUnit.HOURS); | 
 |  |  |         return tokenKey; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 验证token是否失效 |