use of org.platformlayer.auth.ProjectEntity in project platformlayer by platformlayer.
the class TokenHelpers method buildAccess.
public Access buildAccess(UserEntity user) {
byte[] tokenSecret = authSecrets.buildToken(user.getUserSecret());
TokenInfo token = buildToken("" + user.getId(), tokenSecret);
Access access = new Access();
// response.access.serviceCatalog = serviceMapper.getServices(userInfo,
// project);
access.token = new Token();
access.token.expires = token.expiration;
access.token.id = tokenService.encodeToken(token);
access.projects = Lists.newArrayList();
try {
for (ProjectEntity project : userAuthenticator.listProjects(user)) {
access.projects.add(project.getName());
}
} catch (RepositoryException e) {
log.warn("Error while listing projects for user: " + user.key, e);
throw new IllegalStateException("Error listing projects for user", e);
}
return access;
}
Aggregations