| | |
| | | * 30分钟 |
| | | */ |
| | | public static final int EXPIRETIME=300; |
| | | public static final Long EXPIRETIME_LONG = 300L; |
| | | public static final String SECRET="UTivpbn%n9O!KnnL"; |
| | | /** |
| | | * 24小时 |
| | |
| | | * @return 令牌 |
| | | */ |
| | | private static String generateToken(Map<String, Object> claims) { |
| | | Date expirationDate = new Date(System.currentTimeMillis() + TokenConstant.EXPIRETIME*60*1000); |
| | | Date expirationDate = new Date(System.currentTimeMillis() + TokenConstant.EXPIRETIME_LONG*60*1000*72); |
| | | return Jwts.builder().setClaims(claims).setExpiration(expirationDate).signWith(SignatureAlgorithm.HS512, TokenConstant.SECRET).compact(); |
| | | } |
| | | |