protected TokenInfo verify(JwtVerifier verifier, String token) throws TokenVerifyException {
Map<String,Object> jwtDetail;
try {
jwtDetail = verifier.verify(token);
}catch (TokenVerifyException e) {
refreshJwtVerifier();
jwtDetail = verifier.verify(token);
}
SimpleTokenInfo tokenInfo = new SimpleTokenInfo();
String userId = (String)jwtDetail.get(JWT.CLAIM_SUBJECT);
tokenInfo.setUserId(userId);
tokenInfo.setScope((String)jwtDetail.get("scope"));
tokenInfo.setClientId((String)jwtDetail.get("client_id"));
tokenInfo.setCreated(System.currentTimeMillis());
Object exp = jwtDetail.get(JWT.CLAIM_EXPIRATION_TIME);
if (null != exp && exp instanceof Number) {
long expirationTimeSecond = ((Number) exp).longValue();
long nowTimeInSecond = System.currentTimeMillis()/1000L;
tokenInfo.setExpiresIn((int)(expirationTimeSecond-nowTimeInSecond));
}
tokenInfo.setClaims(jwtDetail);
return tokenInfo;
}