List<String> userGroups = Collections.emptyList();
long issueTime = System.currentTimeMillis();
long expireTime = issueTime + tokenValidity;
// Create and sign a new AccessTokenIdentifier to generate the AccessToken.
AccessTokenIdentifier tokenIdentifier = new AccessTokenIdentifier(username, userGroups, issueTime, expireTime);
AccessToken token = tokenManager.signIdentifier(tokenIdentifier);
LOG.debug("Issued token for user {}", username);
// Set response headers
response.setContentType("application/json;charset=UTF-8");