Search in sources :

Example 11 with PrimitiveAssertion

use of org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion in project cxf by apache.

the class RSPAssertionBuilder method build.

/**
 * @see org.apache.neethi.builders.AssertionBuilder#build(org.w3c.dom.Element,
 *  org.apache.neethi.AssertionBuilderFactory)
 */
public Assertion build(Element elem, AssertionBuilderFactory factory) throws IllegalArgumentException {
    Assertion assertion = null;
    if (RSP_NAMESPACE.equals(elem.getNamespaceURI()) && CONFORMANT_NAME.equals(elem.getLocalName())) {
        boolean optional = XMLPrimitiveAssertionBuilder.isOptional(elem);
        assertion = new PrimitiveAssertion(CONFORMANT_QNAME, optional);
    }
    return assertion;
}
Also used : PrimitiveAssertion(org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion) PrimitiveAssertion(org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion) Assertion(org.apache.neethi.Assertion)

Example 12 with PrimitiveAssertion

use of org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion in project cxf by apache.

the class AbstractSTSClient method getAddressingAssertion.

protected PrimitiveAssertion getAddressingAssertion() {
    String ns = "http://schemas.xmlsoap.org/ws/2004/08/addressing/policy";
    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);
}
Also used : PrimitiveAssertion(org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion) QName(javax.xml.namespace.QName)

Example 13 with PrimitiveAssertion

use of org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion in project cxf by apache.

the class MTOMAssertionBuilder method build.

public Assertion build(Element elem, AssertionBuilderFactory f) {
    String localName = elem.getLocalName();
    QName qn = new QName(elem.getNamespaceURI(), localName);
    boolean optional = false;
    Attr attribute = PolicyConstants.findOptionalAttribute(elem);
    if (attribute != null) {
        optional = Boolean.valueOf(attribute.getValue());
    }
    if (MetadataConstants.MTOM_ASSERTION_QNAME.equals(qn)) {
        return new PrimitiveAssertion(MetadataConstants.MTOM_ASSERTION_QNAME, optional);
    }
    return null;
}
Also used : QName(javax.xml.namespace.QName) PrimitiveAssertion(org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion) Attr(org.w3c.dom.Attr)

Example 14 with PrimitiveAssertion

use of org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion in project cxf by apache.

the class SimpleBatchSTSClient method getAddressingAssertion.

protected PrimitiveAssertion getAddressingAssertion() {
    String ns = "http://schemas.xmlsoap.org/ws/2004/08/addressing/policy";
    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);
}
Also used : PrimitiveAssertion(org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion) QName(javax.xml.namespace.QName)

Example 15 with PrimitiveAssertion

use of org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion in project cxf by apache.

the class WSSCUnitTest method createSymmetricBindingPolicy.

// mock up a SymmetricBinding policy to talk to the STS
private Policy createSymmetricBindingPolicy() {
    // 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, SPConstants.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);
    binding.setProtectTokens(false);
    all.addPolicyComponent(binding);
    List<Header> headers = new ArrayList<>();
    SignedParts signedParts = new SignedParts(SPConstants.SPVersion.SP12, true, null, headers, false);
    all.addPolicyComponent(signedParts);
    return p;
}
Also used : Policy(org.apache.neethi.Policy) All(org.apache.neethi.All) PrimitiveAssertion(org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion) QName(javax.xml.namespace.QName) ArrayList(java.util.ArrayList) DefaultSymmetricBinding(org.apache.cxf.ws.security.trust.DefaultSymmetricBinding) ExactlyOne(org.apache.neethi.ExactlyOne) AlgorithmSuite(org.apache.wss4j.policy.model.AlgorithmSuite) X509Token(org.apache.wss4j.policy.model.X509Token) Header(org.apache.wss4j.policy.model.Header) SignedParts(org.apache.wss4j.policy.model.SignedParts) ProtectionToken(org.apache.wss4j.policy.model.ProtectionToken)

Aggregations

PrimitiveAssertion (org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion)22 QName (javax.xml.namespace.QName)15 Assertion (org.apache.neethi.Assertion)15 Policy (org.apache.neethi.Policy)10 All (org.apache.neethi.All)6 ExactlyOne (org.apache.neethi.ExactlyOne)6 XMLPrimitiveAssertionBuilder (org.apache.neethi.builders.xml.XMLPrimitiveAssertionBuilder)6 Element (org.w3c.dom.Element)6 PolicyContainingPrimitiveAssertion (org.apache.neethi.builders.PolicyContainingPrimitiveAssertion)5 Test (org.junit.Test)5 HashMap (java.util.HashMap)4 AssertionBuilderRegistry (org.apache.cxf.ws.policy.AssertionBuilderRegistry)4 PrimitiveAssertionBuilder (org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertionBuilder)4 AssertionBuilderFactory (org.apache.neethi.AssertionBuilderFactory)4 ArrayList (java.util.ArrayList)3 AbstractSecurityAssertion (org.apache.wss4j.policy.model.AbstractSecurityAssertion)3 DefaultSymmetricBinding (org.apache.cxf.ws.security.trust.DefaultSymmetricBinding)2 ProtectionToken (org.apache.wss4j.policy.model.ProtectionToken)2 SignedParts (org.apache.wss4j.policy.model.SignedParts)2 URL (java.net.URL)1