Search in sources :

Example 1 with MappingInfo

use of org.jboss.security.config.MappingInfo in project wildfly by wildfly.

the class SecurityDomainAdd method processMapping.

private boolean processMapping(OperationContext context, String securityDomain, ModelNode node, ApplicationPolicy applicationPolicy) throws OperationFailedException {
    node = peek(node, MAPPING, CLASSIC, MAPPING_MODULE);
    if (node == null) {
        return false;
    }
    for (Property moduleProperty : node.asPropertyList()) {
        ModelNode module = moduleProperty.getValue();
        MappingInfo mappingInfo = new MappingInfo(securityDomain);
        String codeName = extractCode(context, module, ModulesMap.MAPPING_MAP);
        String mappingType;
        if (module.hasDefined(TYPE)) {
            mappingType = MappingModuleDefinition.TYPE.resolveModelAttribute(context, module).asString();
        } else {
            mappingType = MappingType.ROLE.toString();
        }
        Map<String, Object> options = extractOptions(context, module);
        MappingModuleEntry entry = new MappingModuleEntry(codeName, options, mappingType);
        mappingInfo.add(entry);
        applicationPolicy.setMappingInfo(mappingType, mappingInfo);
        ModelNode moduleName = LoginModuleResourceDefinition.MODULE.resolveModelAttribute(context, module);
        if (moduleName.isDefined() && !moduleName.asString().isEmpty()) {
            mappingInfo.addJBossModuleName(moduleName.asString());
        } else {
            mappingInfo.addJBossModuleName(DEFAULT_MODULE);
        }
    }
    return true;
}
Also used : MappingModuleEntry(org.jboss.security.mapping.config.MappingModuleEntry) ModelNode(org.jboss.dmr.ModelNode) Property(org.jboss.dmr.Property) MappingInfo(org.jboss.security.config.MappingInfo)

Aggregations

ModelNode (org.jboss.dmr.ModelNode)1 Property (org.jboss.dmr.Property)1 MappingInfo (org.jboss.security.config.MappingInfo)1 MappingModuleEntry (org.jboss.security.mapping.config.MappingModuleEntry)1