Package org.opensaml.xacml.policy

Examples of org.opensaml.xacml.policy.PolicyType


        super();
    }

    /** {@inheritDoc} */
    protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
        PolicyType policy = (PolicyType) xmlObject;

        if (attribute.getLocalName().equals(PolicyType.POLICY_ID_ATTRIB_NAME)) {
            policy.setPolicyId(attribute.getValue());
        } else if (attribute.getLocalName().equals(PolicyType.VERSION_ATTRIB_NAME)) {
            policy.setVersion(attribute.getValue());
        } else if (attribute.getLocalName().equals(PolicyType.RULE_COMBINING_ALG_ID_ATTRIB_NAME)) {
            policy.setRuleCombiningAlgoId(attribute.getValue());
        } else {
            super.processAttribute(xmlObject, attribute);
        }
    }
View Full Code Here


    }

    /** {@inheritDoc} */
    protected void processChildElement(XMLObject parentXMLObject, XMLObject childXMLObject)
            throws UnmarshallingException {
        PolicyType policy = (PolicyType) parentXMLObject;

        if (childXMLObject instanceof DescriptionType) {
            policy.setDescription((DescriptionType) childXMLObject);
        } else if (childXMLObject.getElementQName().equals(DefaultsType.POLICY_DEFAULTS_ELEMENT_NAME)) {
            policy.setPolicyDefaults((DefaultsType) childXMLObject);
        } else if (childXMLObject instanceof TargetType) {
            policy.setTarget((TargetType) childXMLObject);
        } else if (childXMLObject instanceof CombinerParametersType) {
            policy.getCombinerParameters().add((CombinerParametersType) childXMLObject);
        } else if (childXMLObject instanceof RuleCombinerParametersType) {
            policy.getRuleCombinerParameters().add((RuleCombinerParametersType) childXMLObject);
        } else if (childXMLObject instanceof VariableDefinitionType) {
            policy.getVariableDefinitions().add((VariableDefinitionType) childXMLObject);
        } else if (childXMLObject instanceof RuleType) {
            policy.getRules().add((RuleType)childXMLObject);
        } else if (childXMLObject instanceof ObligationsType) {
            policy.setObligations((ObligationsType) childXMLObject);
        } else {
            super.processChildElement(parentXMLObject, childXMLObject);
        }
    }
View Full Code Here

        super();
    }

    /** {@inheritDoc} */
    protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
        PolicyType policy = (PolicyType) xmlObject;

        if (!DatatypeHelper.isEmpty(policy.getPolicyId())) {
            domElement.setAttribute(PolicyType.POLICY_ID_ATTRIB_NAME, policy.getPolicyId());
        }

        if (!DatatypeHelper.isEmpty(policy.getVersion())) {
            domElement.setAttribute(PolicyType.VERSION_ATTRIB_NAME, policy.getVersion());
        }

        if (!DatatypeHelper.isEmpty(policy.getRuleCombiningAlgoId())) {
            domElement.setAttribute(PolicyType.RULE_COMBINING_ALG_ID_ATTRIB_NAME, policy.getRuleCombiningAlgoId());
        }
    }
View Full Code Here

                        log.debug(String.format("Stored PolicySet \"%s\" into pap \"%s\"",
                                                policySet.getPolicySetId(),
                                                pap.getAlias()));
                    } else if (xacmlObject instanceof PolicyType) {

                        PolicyType policy = (PolicyType) xacmlObject;
                        papContainer.storePolicy(policy);

                        log.debug(String.format("Stored Policy \"%s\" into pap \"%s\"",
                                                policy.getPolicyId(),
                                                pap.getAlias()));
                    } else {

                        log.error(String.format("Invalid object (not a Policy or PolicySet) received from PAP %s (%s)",
                                                pap.getAlias(),
View Full Code Here

                alias = Pap.DEFAULT_PAP_ALIAS;
            }

            Pap ps = PapManager.getInstance().getPap(alias);

            PolicyType policy;

            if (ps.isLocal()) {
                policy = GetLocalPolicyOperation.instance(ps, policyId).execute();
            } else {
                policy = GetRemotePolicyOperation.instance(ps, policyId).execute();
View Full Code Here

        // replace policy references with policies
        idReferenceList = PolicySetHelper.getPolicyIdReferencesValues(policySetNoRef);
        for (String policyIdReference : idReferenceList) {

            try {
                PolicyType policy = papContainer.getPolicy(policyIdReference);

                PolicySetHelper.addPolicy(policySetNoRef, policy);

                TypeStringUtils.releaseUnneededMemory(policy);
            } catch (NotFoundException e) {
View Full Code Here

       
        if (actionId == null) {
            actionId = getActionId(papContainer, actionValue, resourceValue, after);
        }
       
        PolicyType actionPolicy = papContainer.getPolicy(actionId);
       
       
        if (obligationValue!= null){
          if (ObligationScopeType.action.equals(obligationScope)){
           
            if (!PolicyHelper.hasObligationWithId(actionPolicy, obligationValue)){
              ObligationWizard owiz = new ObligationWizard(obligationValue);
              ObligationsType obligations = ObligationsHelper.build();
              obligations.getObligations().add(owiz.getXACML());
              actionPolicy.setObligations(obligations);
            }
           
          }else{
           
            PolicySetType resourcePolicySet = findResourcePolicySet(papContainer);
            if (!PolicySetHelper.hasObligationWithId(resourcePolicySet, obligationValue)){
              ObligationWizard owiz = new ObligationWizard(obligationValue);
              ObligationsType obligations = ObligationsHelper.build();
              obligations.getObligations().add(owiz.getXACML());
              resourcePolicySet.setObligations(obligations);
            }
           
          }
        }
       
        int index = 0;

        if (ruleId != null) {

            index = PolicyHelper.indexOfRule(actionPolicy, ruleId);

            if (index == -1) {
                throw new XACMLPolicyManagementServiceException("ruleId not found: " + ruleId);
            }

            if (after) {
                index++;
            }
        }

        if ((ruleId == null) && (after)) {
            index = -1;
        }

       
        PolicyHelper.addRule(actionPolicy, index, ruleWizard.getXACML());

        String version = actionPolicy.getVersion();

        PolicyWizard.increaseVersion(actionPolicy);
       

        TypeStringUtils.releaseUnneededMemory(actionPolicy);
View Full Code Here

        }
       
               
        List<String> policyIdList = PolicySetHelper.getPolicyIdReferencesValues(targetPolicySet);
       
        PolicyType targetPolicy = null;
       
        for (String policyId : policyIdList) {
            PolicyType policy = papContainer.getPolicy(policyId);
           
            if (actionValue.equals(PolicyWizard.getActionValue(policy))) {
                if (targetPolicy != null) {
                    throw new HighLevelPolicyManagementServiceException("More than one action with the same value");
                }
View Full Code Here

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

        int index = 0;

        if (bottom) {
            index = -1;
View Full Code Here

        if (!papContainer.hasPolicy(policyId)) {
            throw new NotFoundException("Policy '" + policyId + "' not found.");
        }

        PolicyType policy = papContainer.getPolicy(policyId);

        return policy;
    }
View Full Code Here

TOP

Related Classes of org.opensaml.xacml.policy.PolicyType

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.