user.addPublicCredentials(SystemRole.GUEST);
// Collect the set of roles (granted authorities) for this users
Set<GrantedAuthority> authorities = new HashSet<GrantedAuthority>();
for (Object o : user.getPublicCredentials(Role.class)) {
Role masterRole = (Role) o;
for (Role r : masterRole.getClosure()) {
authorities.add(new SimpleGrantedAuthority(r.getContext() + ":" + r.getIdentifier()));
// Every role may or may not be a system role or - in case of non-
// system roles, may or may not be including one or more of those
// roles. Let's ask for a translation and then add those roles