Search in sources :

Example 6 with Property

use of org.jboss.dmr.Property in project wildfly by wildfly.

the class DiscoveryGroupAdd method addDiscoveryGroupConfigs.

static void addDiscoveryGroupConfigs(final OperationContext context, final Configuration configuration, final ModelNode model) throws OperationFailedException {
    if (model.hasDefined(CommonAttributes.DISCOVERY_GROUP)) {
        Map<String, DiscoveryGroupConfiguration> configs = configuration.getDiscoveryGroupConfigurations();
        if (configs == null) {
            configs = new HashMap<String, DiscoveryGroupConfiguration>();
            configuration.setDiscoveryGroupConfigurations(configs);
        }
        for (Property prop : model.get(CommonAttributes.DISCOVERY_GROUP).asPropertyList()) {
            configs.put(prop.getName(), createDiscoveryGroupConfiguration(context, prop.getName(), prop.getValue()));
        }
    }
}
Also used : DiscoveryGroupConfiguration(org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration) Property(org.jboss.dmr.Property)

Example 7 with Property

use of org.jboss.dmr.Property in project wildfly by wildfly.

the class SecurityDomainAdd method processAuthorization.

private boolean processAuthorization(OperationContext context, String securityDomain, ModelNode node, ApplicationPolicy applicationPolicy) throws OperationFailedException {
    node = peek(node, AUTHORIZATION, CLASSIC, POLICY_MODULE);
    if (node == null) {
        return false;
    }
    AuthorizationInfo authzInfo = new AuthorizationInfo(securityDomain);
    for (Property moduleProperty : node.asPropertyList()) {
        ModelNode module = moduleProperty.getValue();
        String codeName = extractCode(context, module, ModulesMap.AUTHORIZATION_MAP);
        String flag = LoginModuleResourceDefinition.FLAG.resolveModelAttribute(context, module).asString();
        ControlFlag controlFlag = ControlFlag.valueOf(flag);
        Map<String, Object> options = extractOptions(context, module);
        AuthorizationModuleEntry authzModuleEntry = new AuthorizationModuleEntry(codeName, options);
        authzModuleEntry.setControlFlag(controlFlag);
        authzInfo.add(authzModuleEntry);
        ModelNode moduleName = LoginModuleResourceDefinition.MODULE.resolveModelAttribute(context, module);
        if (moduleName.isDefined() && !moduleName.asString().isEmpty()) {
            authzInfo.addJBossModuleName(moduleName.asString());
        } else {
            authzInfo.addJBossModuleName(DEFAULT_MODULE);
        }
    }
    applicationPolicy.setAuthorizationInfo(authzInfo);
    return true;
}
Also used : ModelNode(org.jboss.dmr.ModelNode) AuthorizationInfo(org.jboss.security.config.AuthorizationInfo) Property(org.jboss.dmr.Property) AuthorizationModuleEntry(org.jboss.security.authorization.config.AuthorizationModuleEntry) ControlFlag(org.jboss.security.config.ControlFlag) LoginModuleControlFlag(javax.security.auth.login.AppConfigurationEntry.LoginModuleControlFlag)

Example 8 with Property

use of org.jboss.dmr.Property in project wildfly by wildfly.

the class SecurityDomainAdd method processACL.

private boolean processACL(OperationContext context, String securityDomain, ModelNode node, ApplicationPolicy applicationPolicy) throws OperationFailedException {
    node = peek(node, ACL, CLASSIC, ACL_MODULE);
    if (node == null) {
        return false;
    }
    ACLInfo aclInfo = new ACLInfo(securityDomain);
    for (Property moduleProperty : node.asPropertyList()) {
        ModelNode module = moduleProperty.getValue();
        String codeName = LoginModuleResourceDefinition.CODE.resolveModelAttribute(context, module).asString();
        String flag = LoginModuleResourceDefinition.FLAG.resolveModelAttribute(context, module).asString();
        ControlFlag controlFlag = ControlFlag.valueOf(flag);
        Map<String, Object> options = extractOptions(context, module);
        ACLProviderEntry entry = new ACLProviderEntry(codeName, options);
        entry.setControlFlag(controlFlag);
        aclInfo.add(entry);
        ModelNode moduleName = LoginModuleResourceDefinition.MODULE.resolveModelAttribute(context, module);
        if (moduleName.isDefined() && !moduleName.asString().isEmpty()) {
            aclInfo.addJBossModuleName(moduleName.asString());
        } else {
            aclInfo.addJBossModuleName(DEFAULT_MODULE);
        }
    }
    applicationPolicy.setAclInfo(aclInfo);
    return true;
}
Also used : ACLInfo(org.jboss.security.config.ACLInfo) ACLProviderEntry(org.jboss.security.acl.config.ACLProviderEntry) ModelNode(org.jboss.dmr.ModelNode) Property(org.jboss.dmr.Property) ControlFlag(org.jboss.security.config.ControlFlag) LoginModuleControlFlag(javax.security.auth.login.AppConfigurationEntry.LoginModuleControlFlag)

Example 9 with Property

use of org.jboss.dmr.Property in project wildfly by wildfly.

the class SecurityDomainAdd method processLoginModules.

private void processLoginModules(OperationContext context, ModelNode node, BaseAuthenticationInfo authInfo, LoginModuleContainer container) throws OperationFailedException {
    for (Property moduleProperty : node.asPropertyList()) {
        ModelNode module = moduleProperty.getValue();
        String codeName = extractCode(context, module, ModulesMap.AUTHENTICATION_MAP);
        String flag = LoginModuleResourceDefinition.FLAG.resolveModelAttribute(context, module).asString();
        LoginModuleControlFlag controlFlag = getControlFlag(flag);
        Map<String, Object> options = extractOptions(context, module);
        AppConfigurationEntry entry = new AppConfigurationEntry(codeName, controlFlag, options);
        container.addAppConfigurationEntry(entry);
        ModelNode moduleName = LoginModuleResourceDefinition.MODULE.resolveModelAttribute(context, module);
        if (moduleName.isDefined() && !moduleName.asString().isEmpty()) {
            authInfo.addJBossModuleName(moduleName.asString());
        } else {
            authInfo.addJBossModuleName(DEFAULT_MODULE);
        }
    }
}
Also used : AppConfigurationEntry(javax.security.auth.login.AppConfigurationEntry) LoginModuleControlFlag(javax.security.auth.login.AppConfigurationEntry.LoginModuleControlFlag) ModelNode(org.jboss.dmr.ModelNode) Property(org.jboss.dmr.Property)

Example 10 with Property

use of org.jboss.dmr.Property in project wildfly by wildfly.

the class SecurityDomainAdd method processAudit.

private boolean processAudit(OperationContext context, String securityDomain, ModelNode node, ApplicationPolicy applicationPolicy) throws OperationFailedException {
    node = peek(node, AUDIT, CLASSIC, PROVIDER_MODULE);
    if (node == null) {
        return false;
    }
    AuditInfo auditInfo = new AuditInfo(securityDomain);
    for (Property moduleProperty : node.asPropertyList()) {
        ModelNode module = moduleProperty.getValue();
        String codeName = MappingProviderModuleDefinition.CODE.resolveModelAttribute(context, module).asString();
        Map<String, Object> options = extractOptions(context, module);
        AuditProviderEntry entry = new AuditProviderEntry(codeName, options);
        auditInfo.add(entry);
        ModelNode moduleName = MappingProviderModuleDefinition.MODULE.resolveModelAttribute(context, module);
        if (moduleName.isDefined() && !moduleName.asString().isEmpty()) {
            auditInfo.addJBossModuleName(moduleName.asString());
        } else {
            auditInfo.addJBossModuleName(DEFAULT_MODULE);
        }
    }
    applicationPolicy.setAuditInfo(auditInfo);
    return true;
}
Also used : AuditInfo(org.jboss.security.config.AuditInfo) ModelNode(org.jboss.dmr.ModelNode) Property(org.jboss.dmr.Property) AuditProviderEntry(org.jboss.security.audit.config.AuditProviderEntry)

Aggregations

Property (org.jboss.dmr.Property)203 ModelNode (org.jboss.dmr.ModelNode)163 HashMap (java.util.HashMap)22 Test (org.junit.Test)19 AttributeDefinition (org.jboss.as.controller.AttributeDefinition)16 SimpleAttributeDefinition (org.jboss.as.controller.SimpleAttributeDefinition)16 PathAddress (org.jboss.as.controller.PathAddress)12 ArrayList (java.util.ArrayList)11 Map (java.util.Map)11 ValueExpression (org.jboss.dmr.ValueExpression)10 ModelType (org.jboss.dmr.ModelType)9 OperationFailedException (org.jboss.as.controller.OperationFailedException)8 HashSet (java.util.HashSet)7 ArrayDeque (java.util.ArrayDeque)6 OperateOnDeployment (org.jboss.arquillian.container.test.api.OperateOnDeployment)6 Properties (java.util.Properties)5 LinkedHashMap (java.util.LinkedHashMap)4 LoginModuleControlFlag (javax.security.auth.login.AppConfigurationEntry.LoginModuleControlFlag)4 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)4 HttpResponse (org.apache.http.HttpResponse)3