1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
@Test public void testJWT() { long time = 3 * 60 * 60 * 1000;
var claims = new HashMap<String, Object>(); claims.put("id", 1); claims.put("name", "amane");
String token = Jwts.builder() .signWith(SignatureAlgorithm.HS256, "Ciallo_World") .addClaims(claims) .setExpiration(new Date(System.currentTimeMillis() + time)) .compact();
log.info(token); }
|