Package org.apache.neethi

Examples of org.apache.neethi.ExactlyOne


        if (addressingNamespace == null) {
            addressingNamespace = "http://www.w3.org/2005/08/addressing";
        }

        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);
View Full Code Here


        if (boi == null) {
            attachTokenDirectly = false;
            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);
View Full Code Here

        if (addressingNamespace == null) {
            addressingNamespace = "http://www.w3.org/2005/08/addressing";
        }

        Policy validatePolicy = new Policy();
        ExactlyOne one = new ExactlyOne();
        validatePolicy.addPolicyComponent(one);
        All all = new All();
        SymmetricBinding binding = new SymmetricBinding();
        all.addAssertion(binding);
        one.addPolicyComponent(all);
        all.addAssertion(getAddressingAssertion());
        ProtectionToken ptoken = new ProtectionToken();
        binding.setProtectionToken(ptoken);
        binding.setIncludeTimestamp(true);
        binding.setEntireHeadersAndBodySignatures(true);
View Full Code Here

        if (addressingNamespace == null) {
            addressingNamespace = "http://www.w3.org/2005/08/addressing";
        }
        Policy cancelPolicy = new Policy();
        ExactlyOne one = new ExactlyOne();
        cancelPolicy.addPolicyComponent(one);
        All all = new All();
        one.addPolicyComponent(all);
        SymmetricBinding binding = new SymmetricBinding();
        all.addAssertion(binding);
        all.addAssertion(getAddressingAssertion());
        ProtectionToken ptoken = new ProtectionToken();
        binding.setProtectionToken(ptoken);
View Full Code Here

                            boolean endorse) {
        client.setTrust(getTrust10(aim));
        client.setTrust(getTrust13(aim));
        Policy pol = itok.getBootstrapPolicy();
        Policy p = new Policy();
        ExactlyOne ea = new ExactlyOne();
        p.addPolicyComponent(ea);
        All all = new All();
        all.addPolicyComponent(getAddressingPolicy(aim, false));
        ea.addPolicyComponent(all);
       
        if (endorse) {
            SupportingToken st = new SupportingToken(SupportTokenType.SUPPORTING_TOKEN_ENDORSING,
                                                     SP12Constants.INSTANCE);
            st.addToken(itok);
View Full Code Here

                    .next().getAssertion();
                Policy pol = tok.getBootstrapPolicy();
                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();
                    PolicyAssertion ass = SecureConversationTokenInterceptorProvider
                        .getAddressingPolicy(aim, false);
                    all.addPolicyComponent(ass);
                    ea.addPolicyComponent(all);
                    SymmetricBinding binding = new SymmetricBinding(SP12Constants.INSTANCE);
                    binding.setIncludeTimestamp(true);
                    ProtectionToken token = new ProtectionToken(SP12Constants.INSTANCE);
                    token.setToken(new SecureConversationToken(SP12Constants.INSTANCE));
                    binding.setProtectionToken(token);
                    binding.setEntireHeadersAndBodySignatures(true);
                   
                    Binding origBinding = getBinding(aim);
                    binding.setAlgorithmSuite(origBinding.getAlgorithmSuite());
                    all.addPolicyComponent(binding);
                   
                    SignedEncryptedParts parts = new SignedEncryptedParts(true,
                                                                          SP12Constants.INSTANCE);
                    parts.setBody(true);
                    if (addNs != null) {
                        parts.addHeader(new Header("To", addNs));
                        parts.addHeader(new Header("From", addNs));
                        parts.addHeader(new Header("FaultTo", addNs));
                        parts.addHeader(new Header("ReplyTO", addNs));
                        parts.addHeader(new Header("MessageID", addNs));
                        parts.addHeader(new Header("RelatesTo", addNs));
                        parts.addHeader(new Header("Action", addNs));
                    }
                    all.addPolicyComponent(parts);
                    pol = p;
                    message.getInterceptorChain().add(SecureConversationTokenFinderInterceptor.INSTANCE);
                } else {
                    Policy p = new Policy();
                    ExactlyOne ea = new ExactlyOne();
                    p.addPolicyComponent(ea);
                    All all = new All();
                    PolicyAssertion ass = SecureConversationTokenInterceptorProvider
                        .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

            if (topLevelAssertionObject instanceof Policy) {
                Policy policy = (Policy) topLevelAssertionObject;
                Collection policyComponents = policy.getPolicyComponents();
                handlePolicyComponents(cacheConfig, policyComponents);
            } else if (topLevelAssertionObject instanceof ExactlyOne) {
                ExactlyOne eo = (ExactlyOne) topLevelAssertionObject;
                handlePolicyComponents(cacheConfig, eo.getPolicyComponents());
            } else if (topLevelAssertionObject instanceof All) {
                All all = (All) topLevelAssertionObject;
                handlePolicyComponents(cacheConfig, all.getPolicyComponents());
            } else if (topLevelAssertionObject instanceof XmlPrimtiveAssertion) {
                // Validating the policy
View Full Code Here

                //  // To track default cn for all ips
                CallerConfiguration cn = null; // To create a
                //configurationbean object
                boolean isIPRangeFound = false;
                boolean isExactlyOneFound = false;
                ExactlyOne cp = null;
                List cL = ((All) tp).getAssertions();
                if (cL != null) {
                    for (Iterator ci =
                            cL.iterator(); ci.hasNext();) {
                        Object ca = ci.next();
                        if (ca instanceof XmlPrimtiveAssertion) {
                            XmlPrimtiveAssertion id = (XmlPrimtiveAssertion) ca;
                            OMElement el = id.getValue();

                            String t = el.getAttributeValue(
                                    ThrottleConstants.THROTTLE_TYPE_ATTRIBUTE_QNAME);
                            if (t == null) {
                                handleException("Type of Throtle " +
                                        "in the policy cannot be null");
                            }
                            if (t.equals("IP")) {
                                // create a ip based throttle context and configuration
                                tc = th.getThrottleConfiguration
                                        (ThrottleConstants.IP_BASED_THROTTLE_KEY);
                                if (tc == null) {
                                    tc =
                                            ThrottleConfigurationFactory.
                                                    createThrottleConfiguration(
                                                            ThrottleConstants.IP_BASE);
                                    th.addThrottleContext(
                                            ThrottleConstants.IP_BASED_THROTTLE_KEY,
                                            ThrottleContextFactory.createThrottleContext(
                                                    ThrottleConstants.IP_BASE, tc));
                                    th.addThrottleConfiguration(
                                            ThrottleConstants.IP_BASED_THROTTLE_KEY, tc);
                                }
                                //create a callercontext for ip based throttle
                                cn = CallerConfigurationFactory.
                                        createCallerConfiguration(
                                                ThrottleConstants.IP_BASE);
                            } else if (t.equals("DOMAIN")) {
                                // create a domain based throttle context and configuration
                                tc = th.getThrottleConfiguration(
                                        ThrottleConstants.DOMAIN_BASED_THROTTLE_KEY);
                                if (tc == null) {
                                    tc =
                                            ThrottleConfigurationFactory.
                                                    createThrottleConfiguration(
                                                            ThrottleConstants.DOMAIN_BASE);
                                    th.addThrottleContext(
                                            ThrottleConstants.DOMAIN_BASED_THROTTLE_KEY,
                                            ThrottleContextFactory.createThrottleContext(
                                                    ThrottleConstants.DOMAIN_BASE, tc));
                                    th.addThrottleConfiguration(
                                            ThrottleConstants.DOMAIN_BASED_THROTTLE_KEY, tc);
                                }
                                //create a callercontext for domain based throttl
                                cn =
                                        CallerConfigurationFactory.
                                                createCallerConfiguration(
                                                        ThrottleConstants.DOMAIN_BASE);
                            } else {
                                handleException("Unsupported throttle type : " + t);
                            }
                            if (cn != null) {

                                // Name of the policy assertion
                                String n = el.getLocalName();
                                // Value of the policy assertion
                                String v = el.getText();

                                // If Value and Name  are null,
                                // then it is a invalid policy config
                                if (n == null || v == null) {
                                    handleException("Either Value or" +
                                            " Name of the policy cannot be null");
                                } else if (n.equals(ThrottleConstants.ID_PARAMETER_NAME)) {

                                    if (!v.equals("")) {

                                        isIPRangeFound = true;
                                        cn.setID(v);
                                    } else {
                                        handleException("Value of ID cannot find " +
                                                "- invalid configuration");
                                    }
                                } else {
                                    handleException("Undefined pocilcy property for" +
                                            " throttle - Expect ID  ");
                                }
                            }

                        } else if (ca instanceof ExactlyOne) {
                            cp = (ExactlyOne) ca;
                        }
                    }
                }
                if (cn != null) {
                    if (cp != null) {
                        List cal = cp.getPolicyComponents();
                        boolean haveSelectOneFromExactlyOne = false;
                        for (Iterator ci = cal.iterator(); ci.hasNext()
                                && !haveSelectOneFromExactlyOne;) {
                            Object co = ci.next();
                            if (co instanceof All) {
View Full Code Here

                    .next().getAssertion();
                Policy pol = tok.getBootstrapPolicy();
                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);
                    PolicyBuilder pbuilder = message.getExchange().getBus()
                        .getExtension(PolicyBuilder.class);
                    SymmetricBinding binding = new SymmetricBinding(SP12Constants.INSTANCE, pbuilder);
                    binding.setIncludeTimestamp(true);
                    ProtectionToken token = new ProtectionToken(SP12Constants.INSTANCE, pbuilder);
                   
                    SecureConversationToken scToken =
                        new SecureConversationToken(SP12Constants.INSTANCE);
                    scToken.setInclusion(SP12Constants.IncludeTokenType.INCLUDE_TOKEN_ALWAYS_TO_RECIPIENT);
                    token.setToken(scToken);
                    binding.setProtectionToken(token);
                    binding.setEntireHeadersAndBodySignatures(true);
                   
                    Binding origBinding = getBinding(aim);
                    binding.setAlgorithmSuite(origBinding.getAlgorithmSuite());
                    all.addPolicyComponent(binding);
                   
                    SignedEncryptedParts parts = new SignedEncryptedParts(true,
                                                                          SP12Constants.INSTANCE);
                    parts.setBody(true);
                    if (addNs != null) {
                        parts.addHeader(new Header("To", addNs));
                        parts.addHeader(new Header("From", addNs));
                        parts.addHeader(new Header("FaultTo", addNs));
                        parts.addHeader(new Header("ReplyTO", addNs));
                        parts.addHeader(new Header("MessageID", addNs));
                        parts.addHeader(new Header("RelatesTo", addNs));
                        parts.addHeader(new Header("Action", addNs));
                    }
                    all.addPolicyComponent(parts);
                    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

                    .next().getAssertion();
                Policy pol = tok.getBootstrapPolicy();
                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);
                    PolicyBuilder pbuilder = message.getExchange().getBus()
                        .getExtension(PolicyBuilder.class);
                    SymmetricBinding binding = new SymmetricBinding(SP12Constants.INSTANCE, pbuilder);
                    binding.setIncludeTimestamp(true);
                    ProtectionToken token = new ProtectionToken(SP12Constants.INSTANCE, pbuilder);
                    token.setToken(new SecureConversationToken(SP12Constants.INSTANCE));
                    binding.setProtectionToken(token);
                    binding.setEntireHeadersAndBodySignatures(true);
                   
                    Binding origBinding = getBinding(aim);
                    binding.setAlgorithmSuite(origBinding.getAlgorithmSuite());
                    all.addPolicyComponent(binding);
                   
                    SignedEncryptedParts parts = new SignedEncryptedParts(true,
                                                                          SP12Constants.INSTANCE);
                    parts.setBody(true);
                    if (addNs != null) {
                        parts.addHeader(new Header("To", addNs));
                        parts.addHeader(new Header("From", addNs));
                        parts.addHeader(new Header("FaultTo", addNs));
                        parts.addHeader(new Header("ReplyTO", addNs));
                        parts.addHeader(new Header("MessageID", addNs));
                        parts.addHeader(new Header("RelatesTo", addNs));
                        parts.addHeader(new Header("Action", addNs));
                    }
                    all.addPolicyComponent(parts);
                    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

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.