Package org.glite.authz.pap.common.xacml.wizard

Examples of org.glite.authz.pap.common.xacml.wizard.PolicyWizard


            updateOperationForPolicySet = true;
        }

        String policyId = null;

        PolicyWizard targetPolicyWizard;
        PolicyType candidatePolicy = getTargetPolicy(papContainer, targetPolicySet);

        if (candidatePolicy == null) {
            targetPolicyWizard = new PolicyWizard(actionAttributeWizard);
            targetPolicyWizard.setPrivate(!isPublic);
            policyId = targetPolicyWizard.getPolicyId();
            PolicySetHelper.addPolicyReference(targetPolicySet, 0, policyId);
        } else {
            targetPolicyWizard = new PolicyWizard(candidatePolicy);

            if (targetPolicyWizard.denyRuleForAttributeExists(banAttributeWizard)) {
                // ban policy already exists
                return null;
            }
            policyId = candidatePolicy.getPolicyId();
            updateOperationForPolicy = true;
            policySetNeedToBeSaved = false;
        }

        targetPolicyWizard.addRule(0, banAttributeWizard, EffectType.Deny);

        // Store the ban policy and the policy set in which it is contained
        // (only if needed)
        if (policySetNeedToBeSaved) {
            if (updateOperationForPolicySet) {
                String oldVersion = targetPolicySet.getVersion();
                PolicySetWizard.increaseVersion(targetPolicySet);
                papContainer.updatePolicySet(oldVersion, targetPolicySet);
            } else {
                papContainer.addPolicySet(0, targetPolicySet);
            }
        } else {
            TypeStringUtils.releaseUnneededMemory(targetPolicySet);
        }

        if (updateOperationForPolicy) {
            String oldVersion = targetPolicyWizard.getVersionString();
            targetPolicyWizard.increaseVersion();
            papContainer.updatePolicy(oldVersion, targetPolicyWizard.getXACML());
        } else {
            papContainer.storePolicy(targetPolicyWizard.getXACML());
        }

        targetPolicyWizard.releaseChildrenDOM();
        targetPolicyWizard.releaseDOM();

        return policyId;
    }
View Full Code Here


        PolicyType[] policyArray = new PolicyType[size];
        String[] idPrefixArray = new String[size];
        String[] tagAndValueArray = new String[size];

        for (int i = 0; i < size; i++) {
            PolicyWizard policyWizard = policyWizardList.get(i);
            policyArray[i] = policyWizard.getXACML();
            TypeStringUtils.releaseUnneededMemory(policyArray[i]);
            idPrefixArray[i] = policyWizard.getPolicyIdPrefix();
            tagAndValueArray[i] = policyWizard.getTagAndValue();
            TypeStringUtils.releaseUnneededMemory(policyWizard);
            policyWizard = null;
        }

        log.debug("Inserting actions into position: " + position);
View Full Code Here

      // TODO: how to handle wildcards? Should we use regexp match?
      String actionValue = PolicyWizard.getActionValue(policy);
      if (actionFilter != null && !actionValue.equals(actionFilter))
        continue;
     
      PolicyWizard policyWizard = new PolicyWizard(policy);
      policyWizardList.add(policyWizard);
      policyWizard.releaseChildrenDOM();
      policyWizard.releaseDOM();
    }

    policyArray = null;

    PolicySetType localRootPolicySet = policySetArray[0];
View Full Code Here

            log.debug("targetPolicy not found");
            unbanResult.setStatusCode(1);
            return unbanResult;
        }

        PolicyWizard policyWizard = new PolicyWizard(targetPolicy);
        TypeStringUtils.releaseUnneededMemory(targetPolicy);

        if (policyWizard.removeDenyRuleForAttribute(bannedAttributeWizard)) {
            log.debug("ban rule found, updating policy");
           
            if (policyWizard.getNumberOfRules() == 0) {
               
                papContainer.removePolicyAndReferences(policyWizard.getPolicyId());
               
            } else {

                String oldVersion = policyWizard.getVersionString();
                policyWizard.increaseVersion();
                papContainer.updatePolicy(oldVersion, policyWizard.getXACML());
            }

            unbanResult.setStatusCode(0);
            return unbanResult;
        }
View Full Code Here

     * @return the id of the created action.
     */
    private String createAction(PapContainer papContainer, String resourceId, String actionValue,
            boolean bottom) {

      PolicyWizard pw = new PolicyWizard(new AttributeWizard("action", actionValue));
     
      if (obligationValue != null && obligationScope.equals(ObligationScopeType.action)){
        pw.addObligation(new ObligationWizard(obligationValue));
      }
     
        PolicyType action = pw.getXACML();
       
        papContainer.storePolicy(action);
       
        String actionId = action.getPolicyId();

View Full Code Here

        int size = policyWizardList.size();
        PolicyType[] policyArray = new PolicyType[size];
        String[] idPrefixArray = new String[size];

        for (int i = 0; i < size; i++) {
            PolicyWizard policyWizard = policySetWizard.getPolicyWizardList().get(i);
            policyArray[i] = policyWizard.getXACML();
            idPrefixArray[i] = policyWizard.getPolicyIdPrefix();
            TypeStringUtils.releaseUnneededMemory(policyWizard);
        }

        xacmlPolicyMgmtClient.addPolicies(alias, 0, id, idPrefixArray, policyArray);
       
View Full Code Here

            PolicyType[] policyArray = new PolicyType[size];
            String[] idPrefixArray = new String[size];
            String[] tagAndValueArray = new String[size];

            for (int i = 0; i < size; i++) {
                PolicyWizard policyWizard = policySetWizard.getPolicyWizardList().get(i);
                policyArray[i] = policyWizard.getXACML();
                TypeStringUtils.releaseUnneededMemory(policyArray[i]);
                idPrefixArray[i] = policyWizard.getPolicyIdPrefix();
                tagAndValueArray[i] = policyWizard.getTagAndValue();
                TypeStringUtils.releaseUnneededMemory(policyWizard);
            }

            String[] policyIdArray = xacmlPolicyMgmtClient.addPolicies(alias,
                                                                       0,
View Full Code Here

TOP

Related Classes of org.glite.authz.pap.common.xacml.wizard.PolicyWizard

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.