}
}
}
private static Security buildSecurityConfig(GerSecurityType securityType) {
Security security = null;
if (securityType == null) {
return null;
}
security = new Security();
security.setDoAsCurrentCaller(securityType.getDoasCurrentCaller());
security.setUseContextHandler(securityType.getUseContextHandler());
if (securityType.isSetDefaultRole()) {
security.setDefaultRole(securityType.getDefaultRole().trim());
}
if (securityType.isSetRoleMappings()) {
GerRoleMappingsType roleMappingsType = securityType.getRoleMappings();
for (int i = 0; i < roleMappingsType.sizeOfRoleArray(); i++) {
GerRoleType roleType = roleMappingsType.getRoleArray(i);
Role role = new Role();
String roleName = roleType.getRoleName().trim();
role.setRoleName(roleName);
for (int j = 0; j < roleType.sizeOfRealmArray(); j++) {
GerRealmType realmType = roleType.getRealmArray(j);
String realmName = realmType.getRealmName().trim();
Realm realm = new Realm();
realm.setRealmName(realmName);
for (int k = 0; k < realmType.sizeOfPrincipalArray(); k++) {
realm.getPrincipals().add(buildPrincipal(realmType.getPrincipalArray(k)));
}
role.getRealms().put(realmName, realm);
}
for (int j = 0; j < roleType.sizeOfDistinguishedNameArray(); j++) {
GerDistinguishedNameType dnType = roleType.getDistinguishedNameArray(j);
DistinguishedName name = new DistinguishedName(dnType.getName());
name.setDesignatedRunAs(dnType.getDesignatedRunAs());
role.append(name);
}
security.getRoleMappings().put(roleName, role);
}
}
security.setDefaultPrincipal(buildDefaultPrincipal(securityType.getDefaultPrincipal()));
return security;
}