TokenManager { public String createToken(String clientIp) { return JWT.create() .withClaim("clientIp", clientIp) .withExpiresAt(Date.from(Instant.now().plus(expiry))) .sign(algorithm) ; } TokenManager(ApplianceConfiguration applianceConfiguration); String createToken(String clientIp); boolean validateToken(String token, String clientIp); DecodedJWT validateAndDecode(String token);  }
@Test public void testCreateToken() { final TokenManager tm = createTokenManager(); final String token = tm.createToken("127.0.0.1"); assertNotNull(token); final DecodedJWT jwt = JWT.decode(token); final Claim clientIp = jwt.getClaim("clientIp"); assertNotNull(clientIp); assertEquals("127.0.0.1", clientIp.asString()); }