Package org.apache.neethi

Examples of org.apache.neethi.ExactlyOne


                    .next().getAssertion();
                Policy pol = tok.getBootstrapPolicy().getPolicy();
                if (s.endsWith("Cancel") || s.endsWith("/Renew")) {
                    //Cancel and Renew just sign with the token
                    Policy p = new Policy();
                    ExactlyOne ea = new ExactlyOne();
                    p.addPolicyComponent(ea);
                    All all = new All();
                    Assertion ass = NegotiationUtils.getAddressingPolicy(aim, false);
                    all.addPolicyComponent(ass);
                    ea.addPolicyComponent(all);
                   
                    final SecureConversationToken secureConversationToken =
                        new SecureConversationToken(
                            SPConstants.SPVersion.SP12,
                            SPConstants.IncludeTokenType.INCLUDE_TOKEN_NEVER,
                            null,
                            null,
                            null,
                            new Policy()
                        );
                   
                    Policy sctPolicy = new Policy();
                    ExactlyOne sctPolicyEa = new ExactlyOne();
                    sctPolicy.addPolicyComponent(sctPolicyEa);
                    All sctPolicyAll = new All();
                    sctPolicyAll.addPolicyComponent(secureConversationToken);
                    sctPolicyEa.addPolicyComponent(sctPolicyAll);
                   
                    Policy bindingPolicy = new Policy();
                    ExactlyOne bindingPolicyEa = new ExactlyOne();
                    bindingPolicy.addPolicyComponent(bindingPolicyEa);
                    All bindingPolicyAll = new All();
                   
                    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);
                    binding.setProtectTokens(false);
                   
                    all.addPolicyComponent(binding);
                   
                    SignedParts signedParts = getSignedParts(aim, addNs);
                    all.addPolicyComponent(signedParts);
                    pol = p;
                    message.getInterceptorChain().add(SecureConversationTokenFinderInterceptor.INSTANCE);
                } else {
                    Policy p = new Policy();
                    ExactlyOne ea = new ExactlyOne();
                    p.addPolicyComponent(ea);
                    All all = new All();
                    Assertion ass = NegotiationUtils.getAddressingPolicy(aim, false);
                    all.addPolicyComponent(ass);
                    ea.addPolicyComponent(all);
                    pol = p.merge(pol);
                }
               
                //setup SCT endpoint and forward to it.
                unmapSecurityProps(message);
View Full Code Here


                && s.contains("/RST/Issue")
                && (s.startsWith(STSUtils.WST_NS_05_02)
                    || s.startsWith(STSUtils.WST_NS_05_12))) {

                Policy p = new Policy();
                ExactlyOne ea = new ExactlyOne();
                p.addPolicyComponent(ea);
                All all = new All();
                Assertion ass = NegotiationUtils.getAddressingPolicy(aim, false);
                all.addPolicyComponent(ass);
                ea.addPolicyComponent(all);
               
                //setup endpoint and forward to it.
                unmapSecurityProps(message);
                String ns = STSUtils.WST_NS_05_12;
                if (s.startsWith(STSUtils.WST_NS_05_02)) {
View Full Code Here

       
        client.setTrust(NegotiationUtils.getTrust10(aim));
        client.setTrust(NegotiationUtils.getTrust13(aim));
        Policy pol = itok.getBootstrapPolicy().getPolicy();
        Policy p = new Policy();
        ExactlyOne ea = new ExactlyOne();
        p.addPolicyComponent(ea);
        All all = new All();
        all.addPolicyComponent(NegotiationUtils.getAddressingPolicy(aim, false));
        ea.addPolicyComponent(all);
       
        if (endorse) {
            SupportingTokens st =
                new SupportingTokens(SPConstants.SPVersion.SP12,
                                     SP12Constants.SupportingTokenTypes.EndorsingSupportingTokens,
View Full Code Here

        All alt1 = new All();
        alt1.addAssertion(a);
        alt1.addAssertion(b);
        All alt2 = new All();
        alt2.addAssertion(c);
        ExactlyOne ea = new ExactlyOne();
        ea.addPolicyComponent(alt1);
        ea.addPolicyComponent(alt2);
        p.addPolicyComponent(ea);  
        AssertionInfoMap aim = new AssertionInfoMap(CastUtils.cast(Collections.EMPTY_LIST,
                                                                   PolicyAssertion.class));
        AssertionInfo ai = new AssertionInfo(a);
        AssertionInfo bi = new AssertionInfo(b);
View Full Code Here

        alt1.addAssertion(a1);
        alt1.addAssertion(b);
        All alt2 = new All();
        alt1.addAssertion(a2);
        alt2.addAssertion(c);
        ExactlyOne ea = new ExactlyOne();
        ea.addPolicyComponent(alt1);
        ea.addPolicyComponent(alt2);
        p.addPolicyComponent(ea)
       
        AssertionInfoMap aim = new AssertionInfoMap(p);
       
        Collection<AssertionInfo> listA =
View Full Code Here

        p[i] = new Policy();
        a = new NestedPrimitiveAssertion(TEST_NAME1, false,
                                         null);
        nested = new Policy();
        a.setPolicy(nested);
        ExactlyOne eo = new ExactlyOne();
        nested.addPolicyComponent(eo);
        eo.addPolicyComponent(new PrimitiveAssertion(TEST_NAME2));
        eo.addPolicyComponent(new PrimitiveAssertion(TEST_NAME3))
        p[i++].addPolicyComponent(a);
       
        p[i] = new Policy();
        a = new NestedPrimitiveAssertion(TEST_NAME1, false,
                                         null);
View Full Code Here

        Policy normalisedNested
            = (Policy)nested.normalize(builder == null ? null : builder.getPolicyRegistry(),
                                       true);
       
        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

    private Policy getPolicyOperator(Element element) {
        return (Policy) processOperationElement(element, new Policy());
    }

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

    public PolicyComponent normalize() {
        return this;
    }
    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;
        } else {
            p = new Policy();
View Full Code Here

    }
   
    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 {
                p = new Policy();
View Full Code Here

TOP

Related Classes of org.apache.neethi.ExactlyOne

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.