}
List roles = new ArrayList();
Iterator uroles = user.getRoles();
while(uroles.hasNext()) {
Role role = (Role)uroles.next();
roles.add(role.getName());
}
Iterator groups = user.getGroups();
while(groups.hasNext()) {
Group group = (Group)groups.next();
uroles = user.getRoles();
while(uroles.hasNext()) {
Role role = (Role)uroles.next();
roles.add(role.getName());
}
}
return new GenericPrincipal(this, username, user.getPassword(), roles, user);
}