TokenInfo tokenInfo = loginService.buildTokenInfo(authentication);
token.expires = TokenAuth.getExpiration(tokenInfo);
token.id = tokenService.encodeToken(tokenInfo);
if (project != null) {
Tenant tenant = new Tenant();
tenant.id = "" + project.getId();
tenant.name = project.getName();
token.tenant = tenant;
}