if (module.hasDefined(MODULE_OPTIONS)) {
for (Property prop : module.get(MODULE_OPTIONS).asPropertyList()) {
options.put(prop.getName(), prop.getValue().asString());
}
}
MappingModuleEntry entry = new MappingModuleEntry(codeName, options, mappingType);
mappingInfo.add(entry);
applicationPolicy.setMappingInfo(mappingType, mappingInfo);
}
}
// authentication-jaspi
node = operation.get(AUTHENTICATION_JASPI);
if (node.isDefined()) {
if (applicationPolicy == null)
applicationPolicy = new ApplicationPolicy(securityDomain);
JASPIAuthenticationInfo authenticationInfo = new JASPIAuthenticationInfo(securityDomain);
Map<String, LoginModuleStackHolder> holders = new HashMap<String, LoginModuleStackHolder>();
ModelNode moduleStack = node.get(LOGIN_MODULE_STACK);
modules = moduleStack.asList();
for (ModelNode loginModuleStack : modules) {
List<ModelNode> nodes = loginModuleStack.asList();
Iterator<ModelNode> iter = nodes.iterator();
ModelNode nameNode = iter.next();
String name = nameNode.get(NAME).asString();
LoginModuleStackHolder holder = new LoginModuleStackHolder(name, null);
holders.put(name, holder);
authenticationInfo.add(holder);
while (iter.hasNext()) {
ModelNode lmsNode = iter.next();
List<ModelNode> lms = lmsNode.asList();
for (ModelNode lmNode : lms) {
String code = lmNode.require(CODE).asString();
LoginModuleControlFlag controlFlag = getControlFlag(lmNode.require(FLAG).asString());
Map<String, Object> options = new HashMap<String, Object>();
if (lmNode.hasDefined(MODULE_OPTIONS)) {
for (Property prop : lmNode.get(MODULE_OPTIONS).asPropertyList()) {
options.put(prop.getName(), prop.getValue().asString());
}
}
AppConfigurationEntry entry = new AppConfigurationEntry(code, controlFlag, options);
holder.addAppConfigurationEntry(entry);
}
}
}
ModelNode authModuleNode = node.get(AUTH_MODULE);
List<ModelNode> authModules = authModuleNode.asList();
for (ModelNode authModule : authModules) {
String code = authModule.require(CODE).asString();
String loginStackRef = null;
if (authModule.hasDefined(LOGIN_MODULE_STACK_REF))
loginStackRef = authModule.get(LOGIN_MODULE_STACK_REF).asString();
Map<String, Object> options = new HashMap<String, Object>();
if (authModule.hasDefined(MODULE_OPTIONS)) {
for (Property prop : authModule.get(MODULE_OPTIONS).asPropertyList()) {
options.put(prop.getName(), prop.getValue().asString());
}
}
AuthModuleEntry entry = new AuthModuleEntry(code, options, loginStackRef);
if (loginStackRef != null) {
if (!holders.containsKey(loginStackRef)) {
throw new IllegalArgumentException("auth-module references a login module stack that doesn't exist: "
+ loginStackRef);
}
entry.setLoginModuleStackHolder(holders.get(loginStackRef));
}
authenticationInfo.add(entry);
}
applicationPolicy.setAuthenticationInfo(authenticationInfo);
}