for (EntityExternalIdentifierBo extId: results) {
entityId = extId.getEntityId();
}
// get the first principal and return details
Entity entity = getIdentityService().getEntity(entityId);
Principal principal = entity.getPrincipals().get(0);
List<GrantedAuthority> auths = new ArrayList<GrantedAuthority>();
auths.add(new SimpleGrantedAuthority("ROLE_USER"));
if (principal.isActive()) {
return new User(principal.getPrincipalName(), "password", true, true, true, true, auths);
} else {
return new User(principal.getPrincipalName(), "password", false, false, false, false, auths);
}
}