private String getPrincipal() {
// Retrieve the principal (members of the Group.class)
Set principals = subject.getPrincipals(Principal.class);
Iterator iterator = principals.iterator();
while (iterator.hasNext()) {
Principal principal = (Principal) iterator.next();
if (logger.isLoggable(BasicLevel.DEBUG))
logger.log(BasicLevel.DEBUG, "getPrincipal class = " + principal.getClass().getName());
// Signed group (empty group that contains a signature)?
if (principal instanceof JPrincipal) {
if (logger.isLoggable(BasicLevel.DEBUG))
logger.log(BasicLevel.DEBUG, "getPrincipal name = " + ((JPrincipal)principal).getName());
return principal.getName();
}
}
return null;
}