public Group getRoles (JAASUserPrincipal principal)
{
//get all the roles of the various types
String[] roleClassNames = getRoleClassNames();
Group roleGroup = new JAASGroup(JAASGroup.ROLES);
try
{
JAASUserPrincipal thePrincipal = principal;
if (thePrincipal == null)
thePrincipal = defaultUser;
for (int i=0; i<roleClassNames.length;i++)
{
Class load_class=Thread.currentThread().getContextClassLoader().loadClass(roleClassNames[i]);
Set rolesForType = thePrincipal.getSubject().getPrincipals (load_class);
Iterator itor = rolesForType.iterator();
while (itor.hasNext())
{
roleGroup.addMember((Principal) itor.next());
}
}
return roleGroup;
}