Package org.apache.neethi

Examples of org.apache.neethi.PolicyComponent


        if (policyComponent instanceof PolicyOperator) {
            PolicyOperator policyOperator = (PolicyOperator) policyComponent;
            List<PolicyComponent> policyComponents = policyOperator.getPolicyComponents();
            Iterator<PolicyComponent> policyComponentIterator = policyComponents.iterator();
            while (policyComponentIterator.hasNext()) {
                PolicyComponent curPolicyComponent = policyComponentIterator.next();
                buildAssertionStateMap(curPolicyComponent, assertionStateMap, alternative);
            }
        } else if (policyComponent instanceof AbstractSecurityAssertion) {
            AbstractSecurityAssertion abstractSecurityAssertion = (AbstractSecurityAssertion) policyComponent;
View Full Code Here


                java.util.Collection policies = binding.getPolicySubject()
                        .getAttachedPolicyComponents();
                Iterator policyComponents = policies.iterator();
                String policyId = "";
                while (policyComponents.hasNext()) {
                    PolicyComponent currentPolicyComponent = (PolicyComponent) policyComponents
                            .next();
                    if (currentPolicyComponent instanceof Policy) {
                        policyId = ((Policy) currentPolicyComponent).getId();
                    } else if (currentPolicyComponent instanceof PolicyReference) {
                        policyId = ((PolicyReference) currentPolicyComponent).getURI().substring(1);
                    }

                    // Check whether this is a security scenario
                    scenario = SecurityScenarioDatabase.getByWsuId(policyId);
                }

                // If a scenario is NOT applied to at least one non HTTP
                // binding,
                // we consider the service unsecured.
                if ((scenario == null)
                        && (!binding.getName().getLocalPart().contains("HttpBinding"))) {
                    break;
                }
            }

            // If the binding level policies are not present, check whether there is a policy attached
            // at the service level. This is a fix for Securing Proxy Services.
            if(scenario == null){
                java.util.Collection policies = service.getPolicySubject()
                        .getAttachedPolicyComponents();
                Iterator policyComponents = policies.iterator();
                String policyId = "";
                while (policyComponents.hasNext()) {
                    PolicyComponent currentPolicyComponent = (PolicyComponent) policyComponents
                            .next();
                    if (currentPolicyComponent instanceof Policy) {
                        policyId = ((Policy) currentPolicyComponent).getId();
                    } else if (currentPolicyComponent instanceof PolicyReference) {
                        policyId = ((PolicyReference) currentPolicyComponent).getURI().substring(1);
View Full Code Here

    private void removeAssertionsByNamespace(Policy policy, String namespace) {
        List lst = policy.getAssertions();
        Iterator itePolices = lst.iterator();
        while (itePolices.hasNext()) {
            PolicyComponent comp = (PolicyComponent) itePolices.next();
            if (comp instanceof Assertion) {
                Assertion assertion = (Assertion) comp;
                if (assertion.getName().getNamespaceURI().equals(namespace)) {
                    itePolices.remove();
                }
View Full Code Here

                    key = key.substring(1);
                } else if (pos > 0) {
                    key = key.substring(0, pos);
                }

                PolicyComponent attachedPolicyComponent = modulePolicySubject
                        .getAttachedPolicyComponent(key);

                if (attachedPolicyComponent != null
                    && attachedPolicyComponent instanceof Policy) {
                    policy = (Policy) attachedPolicyComponent;
View Full Code Here

            for (Iterator policyElements = attachmentElement
                    .getChildrenWithName(new QName(
                            DeploymentConstants.POLICY_NS_URI,
                            DeploymentConstants.TAG_POLICY)); policyElements
                    .hasNext();) {
                PolicyComponent policy = PolicyUtil
                        .getPolicyFromOMElement((OMElement)policyElements
                                .next());
                policyComponents.add(policy);
            }

            // process <wsp:PolicyReference> elements ..
            for (Iterator policyRefElements = attachmentElement
                    .getChildrenWithName(new QName(
                            DeploymentConstants.POLICY_NS_URI,
                            DeploymentConstants.TAG_POLICY_REF)); policyRefElements
                    .hasNext();) {
                PolicyComponent policyRef = PolicyUtil
                        .getPolicyReferenceFromOMElement((OMElement)policyRefElements
                                .next());
                policyComponents.add(policyRef);
            }
View Full Code Here

                    key = key.substring(1);
                } else if (pos > 0) {
                    key = key.substring(0, pos);
                }

                PolicyComponent attachedPolicyComponent = modulePolicySubject
                        .getAttachedPolicyComponent(key);

                if (attachedPolicyComponent != null && attachedPolicyComponent instanceof Policy) {
                    policy = (Policy) attachedPolicyComponent;
                }
View Full Code Here

   * @deprecated As of 1.4 release, replaced by
   *             {@link PolicySubject #getAttachedPolicyComponent(String)}
   */
    public Policy getPolicy(String key) {
      if (description != null) {
      PolicyComponent result = description.getPolicySubject()
          .getAttachedPolicyComponent(key);
      if (result != null && result instanceof Policy) {
        return (Policy) result;
      }
    }
View Full Code Here

      for (Iterator policyElements = attachmentElement
          .getChildrenWithName(new QName(
              DeploymentConstants.POLICY_NS_URI,
              DeploymentConstants.TAG_POLICY)); policyElements
          .hasNext();) {
        PolicyComponent policy = PolicyUtil
            .getPolicyFromOMElement((OMElement) policyElements
                .next());
        policyComponents.add(policy);
      }

      // process <wsp:PolicyReference> elements ..
      for (Iterator policyRefElements = attachmentElement
          .getChildrenWithName(new QName(
              DeploymentConstants.POLICY_NS_URI,
              DeploymentConstants.TAG_POLICY_REF)); policyRefElements
          .hasNext();) {
        PolicyComponent policyRef = PolicyUtil
            .getPolicyReferenceFromOMElement((OMElement) policyRefElements
                .next());
        policyComponents.add(policyRef);
      }
View Full Code Here

            PolicyOperator policyOperator = (PolicyOperator) policyComponent;
            List<PolicyComponent> policyComponents = policyOperator.getPolicyComponents();
            int alternative = 0;
            Iterator<PolicyComponent> policyComponentIterator = policyComponents.iterator();
            while (policyComponentIterator.hasNext()) {
                PolicyComponent curPolicyComponent = policyComponentIterator.next();
                if (policyOperator instanceof ExactlyOne) {
                    assertionStateMap.add(new HashMap<SecurityEventConstants.Event, Map<Assertion, List<Assertable>>>());
                    buildAssertionStateMap(curPolicyComponent, assertionStateMap, alternative++);
                } else {
                    buildAssertionStateMap(curPolicyComponent, assertionStateMap);
View Full Code Here

        if (policyComponent instanceof PolicyOperator) {
            PolicyOperator policyOperator = (PolicyOperator) policyComponent;
            List<PolicyComponent> policyComponents = policyOperator.getPolicyComponents();
            Iterator<PolicyComponent> policyComponentIterator = policyComponents.iterator();
            while (policyComponentIterator.hasNext()) {
                PolicyComponent curPolicyComponent = policyComponentIterator.next();
                buildAssertionStateMap(curPolicyComponent, assertionStateMap, alternative);
            }
        } else if (policyComponent instanceof AbstractSecurityAssertion) {
            AbstractSecurityAssertion abstractSecurityAssertion = (AbstractSecurityAssertion) policyComponent;
View Full Code Here

TOP

Related Classes of org.apache.neethi.PolicyComponent

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.