*/
public static void buildRolePrincipalMap(Security security, Map roleDesignates, Map roleToPrincipalMap, ClassLoader classLoader) {
Iterator roleMappings = security.getRoleMappings().values().iterator();
while (roleMappings.hasNext()) {
Role role = (Role) roleMappings.next();
String roleName = role.getRoleName();
Subject roleDesignate = new Subject();
Set principalSet = new HashSet();
Iterator realmPrincipals = role.getRealmPrincipals().iterator();
while (realmPrincipals.hasNext()) {
RealmPrincipalInfo realmPrincipal = (RealmPrincipalInfo) realmPrincipals.next();
java.security.Principal principal = ConfigurationUtil.generateRealmPrincipal(realmPrincipal.getRealm(), realmPrincipal.getDomain(), realmPrincipal, classLoader);
principalSet.add(principal);
if (realmPrincipal.isDesignatedRunAs()) roleDesignate.getPrincipals().add(principal);
}
Iterator domainPrincipals = role.getLoginDomainPrincipals().iterator();
while (domainPrincipals.hasNext()) {
LoginDomainPrincipalInfo domainPrincipal = (LoginDomainPrincipalInfo) domainPrincipals.next();
java.security.Principal principal = ConfigurationUtil.generateDomainPrincipal(domainPrincipal.getDomain(), domainPrincipal, classLoader);
principalSet.add(principal);
if (domainPrincipal.isDesignatedRunAs()) roleDesignate.getPrincipals().add(principal);
}
Iterator principals = role.getPrincipals().iterator();
while (principals.hasNext()) {
PrincipalInfo plainPrincipalInfo = (PrincipalInfo) principals.next();
java.security.Principal principal = ConfigurationUtil.generatePrincipal(plainPrincipalInfo, classLoader);
principalSet.add(principal);
if (plainPrincipalInfo.isDesignatedRunAs()) roleDesignate.getPrincipals().add(principal);
}
for (Iterator names = role.getDistinguishedNames().iterator(); names.hasNext();) {
DistinguishedName dn = (DistinguishedName) names.next();
X500Principal x500Principal = ConfigurationUtil.generateX500Principal(dn.getName());
principalSet.add(x500Principal);