Package org.apache.cxf.ws.policy.builder.primitive

Examples of org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion


    }
   
    Policy getOneOptionalAssertion() {
        String uri = "http://www.w3.org/2007/01/addressing/metadata";
        Policy p = new Policy();
        p.addAssertion(new PrimitiveAssertion(new QName(uri, "AnonymousResponses"), true));
        return p;
    }
View Full Code Here


    }
   
    Policy getTwoOptionalAssertions() {
        String uri = "http://www.w3.org/2007/01/addressing/metadata";
        Policy p = new Policy();
        p.addAssertion(new PrimitiveAssertion(new QName(uri, "AnonymousResponses"), true));
        p.addAssertion(new PrimitiveAssertion(new QName(uri, "NonAnonymousResponses"), true));
        return p;
    }
View Full Code Here

    void setUpAttachment(Object subject, boolean applies) {
        attachments.clear();
        attachment = control.createMock(PolicyAttachment.class);
        attachments.add(attachment);
        policy = new Policy();
        assertion = new PrimitiveAssertion(TEST_ASSERTION_TYPE);
        policy.addAssertion(assertion);
        eap.setAttachments(attachments);
        if (subject instanceof ServiceInfo) {
            EasyMock.expect(attachment.appliesTo((ServiceInfo)subject)).andReturn(applies);
        } else if (subject instanceof EndpointInfo) {
View Full Code Here

        assertSame(a, assertions.iterator().next());       
        control.verify();
       
        assertions.clear();
        Policy p = new Policy();
        a = new PrimitiveAssertion(new QName("http://x.y.z", "a"));
        p.addAssertion(a);
        PolicyReference pr = new PolicyReference();
        pr.setURI("a#b");
        engine.getRegistry().register("a#b", p);
       
View Full Code Here

        String local = "UsingAddressing";
        if ("http://www.w3.org/2005/08/addressing".equals(addressingNamespace)) {
            ns = "http://www.w3.org/2007/02/addressing/metadata";
            local = "Addressing";
        }
        return new PrimitiveAssertion(new QName(ns, local), true);
    }
View Full Code Here

        // Add Addressing policy
        Policy p = new Policy();
        ExactlyOne ea = new ExactlyOne();
        p.addPolicyComponent(ea);
        All all = new All();
        all.addPolicyComponent(new PrimitiveAssertion(MetadataConstants.USING_ADDRESSING_2006_QNAME,
                                                      false));
        ea.addPolicyComponent(all);
       
        stsClient.setPolicy(p);
       
View Full Code Here

        // Add Addressing policy
        Policy p = new Policy();
        ExactlyOne ea = new ExactlyOne();
        p.addPolicyComponent(ea);
        All all = new All();
        all.addPolicyComponent(new PrimitiveAssertion(MetadataConstants.USING_ADDRESSING_2006_QNAME,
                                                      false));
        ea.addPolicyComponent(all);
       
        // X509 Token
        final X509Token x509Token =
            new X509Token(
                SPConstants.SPVersion.SP12,
                SPConstants.IncludeTokenType.INCLUDE_TOKEN_NEVER,
                null,
                null,
                null,
                new Policy()
            );
       
        Policy x509Policy = new Policy();
        ExactlyOne x509PolicyEa = new ExactlyOne();
        x509Policy.addPolicyComponent(x509PolicyEa);
        All x509PolicyAll = new All();
        x509PolicyAll.addPolicyComponent(x509Token);
        x509PolicyEa.addPolicyComponent(x509PolicyAll);
       
        // AlgorithmSuite
        Policy algSuitePolicy = new Policy();
        ExactlyOne algSuitePolicyEa = new ExactlyOne();
        algSuitePolicy.addPolicyComponent(algSuitePolicyEa);
        All algSuitePolicyAll = new All();
        algSuitePolicyAll.addAssertion(
            new PrimitiveAssertion(new QName(SP12Constants.SP_NS, SP12Constants.ALGO_SUITE_BASIC128)));
        algSuitePolicyEa.addPolicyComponent(algSuitePolicyAll);
        AlgorithmSuite algorithmSuite = new AlgorithmSuite(SPConstants.SPVersion.SP12, algSuitePolicy);
       
        // Symmetric Binding
        Policy bindingPolicy = new Policy();
        ExactlyOne bindingPolicyEa = new ExactlyOne();
        bindingPolicy.addPolicyComponent(bindingPolicyEa);
        All bindingPolicyAll = new All();
       
        bindingPolicyAll.addPolicyComponent(new ProtectionToken(SPConstants.SPVersion.SP12, x509Policy));
        bindingPolicyAll.addPolicyComponent(algorithmSuite);
        bindingPolicyAll.addAssertion(
            new PrimitiveAssertion(SP12Constants.INCLUDE_TIMESTAMP));
        bindingPolicyAll.addAssertion(
            new PrimitiveAssertion(SP12Constants.ONLY_SIGN_ENTIRE_HEADERS_AND_BODY));
        bindingPolicyEa.addPolicyComponent(bindingPolicyAll);
       
        DefaultSymmetricBinding binding =
            new DefaultSymmetricBinding(SPConstants.SPVersion.SP12, bindingPolicy);
        binding.setOnlySignEntireHeadersAndBody(true);
View Full Code Here

        AssertionBuilderRegistry reg = bus.getExtension(AssertionBuilderRegistry.class);
        if (reg != null) {
            String ns = "http://cxf.apache.org/custom/security-policy";
            final Map<QName, Assertion> assertions = new HashMap<QName, Assertion>();
            QName qName = new QName(ns, "Basic128GCM");
            assertions.put(qName, new PrimitiveAssertion(qName));
            qName = new QName(ns, "Basic192GCM");
            assertions.put(qName, new PrimitiveAssertion(qName));
            qName = new QName(ns, "Basic256GCM");
            assertions.put(qName, new PrimitiveAssertion(qName));
           
            reg.registerBuilder(new PrimitiveAssertionBuilder(assertions.keySet()) {
                public Assertion build(Element element, AssertionBuilderFactory fact) {
                    if (XMLPrimitiveAssertionBuilder.isOptional(element)
                        || XMLPrimitiveAssertionBuilder.isIgnorable(element)) {
View Full Code Here

            if (null != lst && !lst.isEmpty()) {
                assertion = lst.iterator().next().getAssertion();
            }
        }
        if (assertion == null) {
            return new PrimitiveAssertion(MetadataConstants.USING_ADDRESSING_2006_QNAME,
                                          optional);
        } else if (optional) {
            return new PrimitiveAssertion(assertion.getName(),
                                          optional);           
        }
        return assertion;
    }
View Full Code Here

                   
                    AbstractBinding origBinding = getBinding(aim);
                    bindingPolicyAll.addPolicyComponent(origBinding.getAlgorithmSuite());
                    bindingPolicyAll.addPolicyComponent(new ProtectionToken(SPConstants.SPVersion.SP12, sctPolicy));
                    bindingPolicyAll.addAssertion(
                        new PrimitiveAssertion(SP12Constants.INCLUDE_TIMESTAMP));
                    bindingPolicyAll.addAssertion(
                        new PrimitiveAssertion(SP12Constants.ONLY_SIGN_ENTIRE_HEADERS_AND_BODY));
                    bindingPolicyEa.addPolicyComponent(bindingPolicyAll);
                   
                    DefaultSymmetricBinding binding =
                        new DefaultSymmetricBinding(SPConstants.SPVersion.SP12, bindingPolicy);
                    binding.setOnlySignEntireHeadersAndBody(true);
View Full Code Here

TOP

Related Classes of org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion

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.