{
final Set<Principal> principals = new HashSet<Principal>(1 + groups.length);
principals.add(new AuthenticatedPrincipal(username));
for (String group : groups)
{
principals.add(new GroupPrincipal(group));
}
return new Subject(false, principals, Collections.EMPTY_SET, Collections.EMPTY_SET);
}