Examples of All


Examples of org.apache.neethi.All

        PolicyAssertion a1 =
            new CustomPrimitiveAssertion(new QName("abc"), 1);
        PolicyAssertion a2 =
            new CustomPrimitiveAssertion(new QName("abc"), 2);
        Policy nested = new Policy();
        All all = new All();
        all.addAssertion(a2);
        nested.addPolicyComponent(all);
       
        NestedPrimitiveAssertion na = new NestedPrimitiveAssertion(new QName("nested"),
                                         false,
                                         nested,
                                         true,
                                         null);
        List<PolicyAssertion> ais =
            new ArrayList<PolicyAssertion>();
       
        ais.add(a1);
        ais.add(a2);
        ais.add(na);
               
        AssertionInfoMap aim = new AssertionInfoMap(ais);
       
        assertFalse("Assertion has been asserted even though nether na nor a2 have been",
                    na.isAsserted(aim));
       
        assertAssertion(aim, new QName("nested"), true, true);
        assertFalse("Assertion has been asserted even though a2 has not been",
                    na.isAsserted(aim));
       
        // assert a1 only
        assertAssertion(aim, new QName("abc"), true, false);
        assertFalse("Assertion has been asserted even though a2 has not been",
                    na.isAsserted(aim));
        // assert a2 tpp
        assertAssertion(aim, new QName("abc"), true, true);
        assertTrue("Assertion has not been asserted even though both na nad a2 have been",
                    na.isAsserted(aim));
       
        PolicyAssertion a3 = new CustomPrimitiveAssertion(new QName("abc"), 3);
        all.addAssertion(a3);
        aim.getAssertionInfo(new QName("abc")).add(new AssertionInfo(a3));
       
        assertFalse("Assertion has been asserted even though a3 has not been",
                    na.isAsserted(aim));
       
View Full Code Here

Examples of org.apache.neethi.All

       
        Policy p = new Policy();
        ExactlyOne ea = new ExactlyOne();
        p.addPolicyComponent(ea);
        if (isOptional()) {
            ea.addPolicyComponent(new All());
        }
        // for all alternatives in normalised nested policy
        Iterator alternatives = normalisedNested.getAlternatives();
        while (alternatives.hasNext()) {
            All all = new All();
            List<PolicyAssertion> alternative =
                CastUtils.cast((List)alternatives.next(), PolicyAssertion.class);
            NestedPrimitiveAssertion a = new NestedPrimitiveAssertion(getName(), false, builder);
            a.nested = new Policy();
            ExactlyOne nea = new ExactlyOne();
            a.nested.addPolicyComponent(nea);
            All na = new All();
            nea.addPolicyComponent(na);
            na.addPolicyComponents(alternative);
            all.addPolicyComponent(a);
            ea.addPolicyComponent(all);           
        }
        return p;     
    }
View Full Code Here

Examples of org.apache.neethi.All

    private ExactlyOne getExactlyOneOperator(Element element) {
        return (ExactlyOne) processOperationElement(element, new ExactlyOne());
    }

    private All getAllOperator(Element element) {
        return (All) processOperationElement(element, new All());
    }
View Full Code Here

Examples of org.apache.neethi.All

    }
    public Policy getPolicy() {
        Policy p = new Policy();
        ExactlyOne ea = new ExactlyOne();
        p.addPolicyComponent(ea);
        All all = new All();
       
        /*
        asymmetricBinding.setAlgorithmSuite(algorithmSuite);
        asymmetricBinding.setProtectionOrder(getProtectionOrder());
        asymmetricBinding.setSignatureProtection(isSignatureProtection());
        asymmetricBinding.setSignedEndorsingSupportingTokens(getSignedEndorsingSupportingTokens());
        asymmetricBinding.setTokenProtection(isTokenProtection());
        */
        if (getInitiatorToken() != null) {
            all.addPolicyComponent(getInitiatorToken());
        }
        if (getRecipientToken() != null) {
            all.addPolicyComponent(getRecipientToken());
        }
        /*
        if (isEntireHeadersAndBodySignatures()) {
            all.addPolicyComponent(new PrimitiveAssertion(SP12Constants.ONLY_SIGN_ENTIRE_HEADERS_AND_BODY));
        }
        */
        if (isIncludeTimestamp()) {
            all.addPolicyComponent(new PrimitiveAssertion(SP12Constants.INCLUDE_TIMESTAMP));
        }
        if (getLayout() != null) {
            all.addPolicyComponent(getLayout());
        }
        ea.addPolicyComponent(all);
        PolicyComponent pc = p.normalize(builder.getPolicyRegistry(), true);
        if (pc instanceof Policy) {
            return (Policy)pc;
View Full Code Here

Examples of org.apache.neethi.All

        return token;
    }
   
    public PolicyComponent normalize() {
        if (token != null) {
            All all = new All();
            all.addPolicyComponent(token.normalize());
            all.addPolicyComponent(this);
            return all;
        }
        return this;
    }
View Full Code Here

Examples of org.apache.neethi.All

    public Policy getPolicy() {
        if (token != null) {
            Policy p = new Policy();
            ExactlyOne ea = new ExactlyOne();
            p.addPolicyComponent(ea);
            All all = new All();
            all.addPolicyComponent(token);
            ea.addPolicyComponent(all);
            PolicyComponent pc = p.normalize(builder.getPolicyRegistry(), true);
            if (pc instanceof Policy) {
                return (Policy)pc;
            } else {
View Full Code Here

Examples of org.apache.neethi.All

        }

        Policy validatePolicy = new Policy();
        ExactlyOne one = new ExactlyOne();
        validatePolicy.addPolicyComponent(one);
        All all = new All();
        one.addPolicyComponent(all);
        all.addAssertion(getAddressingAssertion());

        client.getRequestContext().clear();
        client.getRequestContext().putAll(ctx);
        client.getRequestContext().put(SecurityConstants.TOKEN, tok);
        BindingOperationInfo boi = findOperation("/RST/Validate");
View Full Code Here

Examples of org.apache.neethi.All

            boi = findOperation("/RST/Issue");
           
            Policy cancelPolicy = new Policy();
            ExactlyOne one = new ExactlyOne();
            cancelPolicy.addPolicyComponent(one);
            All all = new All();
            one.addPolicyComponent(all);
            all.addAssertion(getAddressingAssertion());
           
            PolicyBuilder pbuilder = bus.getExtension(PolicyBuilder.class);
            SymmetricBinding binding = new SymmetricBinding(pbuilder);
            all.addAssertion(binding);
            all.addAssertion(getAddressingAssertion());
            ProtectionToken ptoken = new ProtectionToken(pbuilder);
            binding.setProtectionToken(ptoken);
            binding.setIncludeTimestamp(true);
            binding.setEntireHeadersAndBodySignatures(true);
            binding.setTokenProtection(false);
            AlgorithmSuite suite = new AlgorithmSuite();
            binding.setAlgorithmSuite(suite);
            SecureConversationToken sct = new SecureConversationToken();
            sct.setOptional(true);
            ptoken.setToken(sct);
           
            SignedEncryptedParts parts = new SignedEncryptedParts(true);
            parts.setOptional(true);
            parts.setBody(true);
            parts.addHeader(new Header("To", addressingNamespace));
            parts.addHeader(new Header("From", addressingNamespace));
            parts.addHeader(new Header("FaultTo", addressingNamespace));
            parts.addHeader(new Header("ReplyTo", addressingNamespace));
            parts.addHeader(new Header("Action", addressingNamespace));
            parts.addHeader(new Header("MessageID", addressingNamespace));
            parts.addHeader(new Header("RelatesTo", addressingNamespace));
            all.addPolicyComponent(parts);
           
            client.getRequestContext().put(PolicyConstants.POLICY_OVERRIDE, cancelPolicy);
        }
       
        if (isSecureConv) {
View Full Code Here

Examples of org.apache.neethi.All

        PolicyEngine engine = control.createMock(PolicyEngine.class);
        Assertor assertor = control.createMock(Assertor.class);
              
        Policy policy = new Policy();
        ExactlyOne ea = new ExactlyOne();
        All all = new All();
        PolicyAssertion a1 = new TestAssertion();
        all.addAssertion(a1);
        ea.addPolicyComponent(all);
        Collection<PolicyAssertion> maxAlternative =
            CastUtils.cast(all.getPolicyComponents(), PolicyAssertion.class);
        all = new All();
        ea.addPolicyComponent(all);
        Collection<PolicyAssertion> minAlternative =
            CastUtils.cast(all.getPolicyComponents(), PolicyAssertion.class);
        policy.addPolicyComponent(ea)
        EasyMock.expect(engine.supportsAlternative(maxAlternative, assertor)).andReturn(true);
        EasyMock.expect(engine.supportsAlternative(minAlternative, assertor)).andReturn(true);
       
        control.replay();       
View Full Code Here

Examples of org.apache.neethi.All

        PolicyEngine engine = control.createMock(PolicyEngine.class);
        Assertor assertor = control.createMock(Assertor.class);
              
        Policy policy = new Policy();
        ExactlyOne ea = new ExactlyOne();
        All all = new All();
        PolicyAssertion a1 = new TestAssertion();
        all.addAssertion(a1);
        ea.addPolicyComponent(all);
        Collection<PolicyAssertion> maxAlternative =
            CastUtils.cast(all.getPolicyComponents(), PolicyAssertion.class);
        all = new All();
        ea.addPolicyComponent(all);
        Collection<PolicyAssertion> minAlternative =
            CastUtils.cast(all.getPolicyComponents(), PolicyAssertion.class);
        policy.addPolicyComponent(ea)
        EasyMock.expect(engine.supportsAlternative(maxAlternative, assertor)).andReturn(true);
        EasyMock.expect(engine.supportsAlternative(minAlternative, assertor)).andReturn(true);
       
        control.replay();       
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.