jwt加密
1.pom
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.1</version>
</dependency>
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>3.4.0</version>
</dependency>
2.demo
public static void main(String[] arg) {
//jwt加密
String jwt = Jwts
.builder()
//SECRET_KEY是加密算法对应的密钥,这里使用额是HS256加密算法
.signWith(SignatureAlgorithm.HS256, "GWATOCTP")
//expTime是过期时间
.setExpiration(new Date(System.currentTimeMillis() + 1 * 60 * 1000))
.claim("userKey", "234")
.claim("token", "18")
.compact();
//jwt解析
Claims claims = Jw