Search in sources :

Example 1 with AuthorizationModuleEntry

use of org.jboss.security.authorization.config.AuthorizationModuleEntry 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)

Aggregations

LoginModuleControlFlag (javax.security.auth.login.AppConfigurationEntry.LoginModuleControlFlag)1 ModelNode (org.jboss.dmr.ModelNode)1 Property (org.jboss.dmr.Property)1 AuthorizationModuleEntry (org.jboss.security.authorization.config.AuthorizationModuleEntry)1 AuthorizationInfo (org.jboss.security.config.AuthorizationInfo)1 ControlFlag (org.jboss.security.config.ControlFlag)1