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;
}
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);
}
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;
}
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);
}
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;
}
Aggregations