for (LdapUser ldapUser : this.users) {
if (ldapUser.getUsername().equals(username)) {
// if we do not have any roles, throw
if (ldapUser.getMembership() == null || ldapUser.getMembership().isEmpty()) {
throw new NoLdapUserRolesFoundException(username);
}
return ldapUser.getMembership();
}
}
// no user, throw
throw new NoLdapUserRolesFoundException(username);
}