Package org.apache.neethi

Examples of org.apache.neethi.Assertion


   
    @Test
    public void testBuildAssertion() throws Exception {
        HTTPServerAssertionBuilder ab = new HTTPServerAssertionBuilder();
        Assertion a = ab.buildAssertion();
        assertTrue(a instanceof JaxbAssertion);
        assertTrue(a instanceof HTTPServerAssertionBuilder.HTTPServerPolicyAssertion);
        assertEquals(PolicyUtils.HTTPSERVERPOLICY_ASSERTION_QNAME, a.getName());
        assertTrue(!a.isOptional());
    }
View Full Code Here


    Collection<Assertion> getAssertions(PolicyComponent pc, boolean includeOptional) {
   
        Collection<Assertion> assertions = new ArrayList<Assertion>();
   
        if (Constants.TYPE_ASSERTION == pc.getType()) {
            Assertion a = (Assertion)pc;
            if (includeOptional || !a.isOptional()) {
                assertions.add(a);
            }
        } else {  
            addAssertions(pc, includeOptional, assertions);
        }
View Full Code Here

    void addAssertions(PolicyComponent pc, boolean includeOptional,
                       Collection<Assertion> assertions) {
  
        if (Constants.TYPE_ASSERTION == pc.getType()) {
            Assertion a = (Assertion)pc;
            if (includeOptional || !a.isOptional()) {
                assertions.add((Assertion)pc);           
            }
            return;
        }
   
View Full Code Here

                                       Assertor assertor) {
        PolicyInterceptorProviderRegistry pipr =
            bus.getExtension(PolicyInterceptorProviderRegistry.class);
        for (PolicyComponent pc : alternative) {
            if (pc instanceof Assertion) {
                Assertion a = (Assertion)pc;
                if (!(a.isOptional()
                    || (null != pipr.get(a.getName()))
                    || (null != assertor && assertor.canAssert(a.getName())))) {
               
                    LOG.fine("Alternative " + a.getName() + " is not supported");
                    return false;
                }
            } else {
                return false;
            }
View Full Code Here

        return symmetricBinding;
    }


    private void processAlternatives(List assertions, SymmetricBinding symmetricBinding, SPConstants consts) {
        Assertion assertion;
        QName name;

        for (Iterator iterator = assertions.iterator(); iterator.hasNext();) {
            assertion = (Assertion)iterator.next();
            name = assertion.getName();

            if (!consts.getNamespace().equals(name.getNamespaceURI())
                && !SP12Constants.INSTANCE.getNamespace().equals(name.getNamespaceURI())) {
                continue;
            }
View Full Code Here

        }
    }
   
    static Assertion getAddressingPolicy(AssertionInfoMap aim, boolean optional) {
        Collection<AssertionInfo> lst = aim.get(MetadataConstants.USING_ADDRESSING_2004_QNAME);
        Assertion assertion = null;
        if (null != lst && !lst.isEmpty()) {
            assertion = lst.iterator().next().getAssertion();
        }
        if (assertion == null) {
            lst = aim.get(MetadataConstants.USING_ADDRESSING_2005_QNAME);
            if (null != lst && !lst.isEmpty()) {
                assertion = lst.iterator().next().getAssertion();
            }
        }
        if (assertion == null) {
            lst = aim.get(MetadataConstants.USING_ADDRESSING_2006_QNAME);
            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

    private void processAlternative(List assertions, SupportingToken supportingToken) {

        for (Iterator iterator = assertions.iterator(); iterator.hasNext();) {

            Assertion primitive = (Assertion)iterator.next();
            QName qname = primitive.getName();

            if (SP11Constants.ALGORITHM_SUITE.equals(qname)) {
                supportingToken.setAlgorithmSuite((AlgorithmSuite)primitive);

            } else if (SP11Constants.SIGNED_PARTS.equals(qname)) {
View Full Code Here

        if (attribute != null) {
            optional = Boolean.valueOf(attribute.getValue());
        }
        if (MetadataConstants.ADDRESSING_ASSERTION_QNAME.equals(qn)
            || MetadataConstants.ADDRESSING_ASSERTION_QNAME_0705.equals(qn)) {
            Assertion nap = new XMLPrimitiveAssertionBuilder() {
                public Assertion newPrimitiveAssertion(Element element, Map<QName, String> mp) {
                    return new PrimitiveAssertion(MetadataConstants.ADDRESSING_ASSERTION_QNAME,
                                                  isOptional(element), isIgnorable(element), mp);       
                }
                public Assertion newPolicyContainingAssertion(Element element,
View Full Code Here

        }
        return x509Token;
    }

    private void processAlternative(List assertions, X509Token parent, SPConstants consts) {
        Assertion assertion;
        QName name;

        for (Iterator iterator = assertions.iterator(); iterator.hasNext();) {
            assertion = (Assertion)iterator.next();
            name = assertion.getName();
           
            if (!consts.getNamespace().equals(name.getNamespaceURI())) {
                continue;
            }
View Full Code Here

                    //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 = SecureConversationTokenInterceptorProvider
                        .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 = SecureConversationTokenInterceptorProvider
                        .getAddressingPolicy(aim, false);
                    all.addPolicyComponent(ass);
                    ea.addPolicyComponent(all);
                    pol = p.merge(pol);
                }
View Full Code Here

TOP

Related Classes of org.apache.neethi.Assertion

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.