use of org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion in project cxf by apache.
the class RM12AssertionBuilder 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 (RM11Constants.WSRMP_NAMESPACE_URI.equals(elem.getNamespaceURI())) {
boolean optional = XMLPrimitiveAssertionBuilder.isOptional(elem);
String lname = elem.getLocalName();
if (RMConstants.RMASSERTION_NAME.equals(lname)) {
// top-level RMAssertion, with nested policy
XMLPrimitiveAssertionBuilder nesting = new XMLPrimitiveAssertionBuilder() {
public Assertion newPrimitiveAssertion(Element element, Map<QName, String> mp) {
return new PrimitiveAssertion(RM11Constants.WSRMP_RMASSERTION_QNAME, isOptional(element), isIgnorable(element), mp);
}
public Assertion newPolicyContainingAssertion(Element element, Map<QName, String> mp, Policy policy) {
return new PolicyContainingPrimitiveAssertion(RM11Constants.WSRMP_RMASSERTION_QNAME, isOptional(element), isIgnorable(element), mp, policy);
}
};
assertion = nesting.build(elem, factory);
} else if (SEQUENCESTR_NAME.equals(lname)) {
assertion = new PrimitiveAssertion(SEQSTR_QNAME, optional);
} else if (SEQUENCETRANSEC_NAME.equals(lname)) {
assertion = new PrimitiveAssertion(SEQTRANSSEC_QNAME, optional);
} else if (DELIVERYASSURANCE_NAME.equals(lname)) {
// DeliveryAssurance, with nested policy
XMLPrimitiveAssertionBuilder nesting = new XMLPrimitiveAssertionBuilder() {
public Assertion newPrimitiveAssertion(Element element, Map<QName, String> mp) {
return new PrimitiveAssertion(DELIVERYASSURANCE_QNAME, isOptional(element), isIgnorable(element), mp);
}
public Assertion newPolicyContainingAssertion(Element element, Map<QName, String> mp, Policy policy) {
return new PolicyContainingPrimitiveAssertion(DELIVERYASSURANCE_QNAME, isOptional(element), isIgnorable(element), mp, policy);
}
};
assertion = nesting.build(elem, factory);
} else if (EXACTLYONCE_NAME.equals(lname)) {
assertion = new PrimitiveAssertion(EXACTLYONCE_QNAME, optional);
} else if (ATLEASTONCE_NAME.equals(lname)) {
assertion = new PrimitiveAssertion(ATLEASTONCE_QNAME, optional);
} else if (ATMOSTONCE_NAME.equals(lname)) {
assertion = new PrimitiveAssertion(ATMOSTONCE_QNAME, optional);
} else if (INORDER_NAME.equals(lname)) {
assertion = new PrimitiveAssertion(INORDER_QNAME, optional);
}
}
return assertion;
}
use of org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion in project cxf by apache.
the class MGF256AlgorithmSuiteLoader method getAlgorithmSuite.
public AlgorithmSuite getAlgorithmSuite(Bus bus, SPConstants.SPVersion version, Policy nestedPolicy) {
AssertionBuilderRegistry reg = bus.getExtension(AssertionBuilderRegistry.class);
if (reg != null) {
String ns = "http://cxf.apache.org/custom/security-policy";
final Map<QName, Assertion> assertions = new HashMap<>();
QName qName = new QName(ns, "Basic256GCMMGFSHA256");
assertions.put(qName, new PrimitiveAssertion(qName));
reg.registerBuilder(new PrimitiveAssertionBuilder(assertions.keySet()) {
public Assertion build(Element element, AssertionBuilderFactory fact) {
if (XMLPrimitiveAssertionBuilder.isOptional(element) || XMLPrimitiveAssertionBuilder.isIgnorable(element)) {
return super.build(element, fact);
}
QName q = new QName(element.getNamespaceURI(), element.getLocalName());
return assertions.get(q);
}
});
}
return new GCMAlgorithmSuite(version, nestedPolicy);
}
Aggregations