use of org.apache.neethi.Assertion in project cxf by apache.
the class SHA512PolicyLoader 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, "Basic128RsaSha512");
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 SHA512AlgorithmSuite(version, nestedPolicy);
}
use of org.apache.neethi.Assertion in project cxf by apache.
the class AddressingAssertionBuilder method build.
public Assertion build(Element elem, AssertionBuilderFactory factory) {
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.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, Map<QName, String> mp, Policy policy) {
return new PolicyContainingPrimitiveAssertion(MetadataConstants.ADDRESSING_ASSERTION_QNAME, isOptional(element), isIgnorable(element), mp, policy);
}
}.build(elem, factory);
if (!(nap instanceof PolicyContainingPrimitiveAssertion || nap instanceof org.apache.neethi.builders.PrimitiveAssertion)) {
// this happens when neethi fails to recognize the specified addressing policy element
LOG.warning("Unable to recognize the addressing policy");
}
return nap;
} else if (MetadataConstants.ANON_RESPONSES_ASSERTION_QNAME.equals(qn) || MetadataConstants.ANON_RESPONSES_ASSERTION_QNAME_0705.equals(qn)) {
return new PrimitiveAssertion(MetadataConstants.ANON_RESPONSES_ASSERTION_QNAME, optional);
} else if (MetadataConstants.NON_ANON_RESPONSES_ASSERTION_QNAME.getLocalPart().equals(localName) || MetadataConstants.NON_ANON_RESPONSES_ASSERTION_QNAME_0705.getLocalPart().equals(localName)) {
return new PrimitiveAssertion(MetadataConstants.NON_ANON_RESPONSES_ASSERTION_QNAME, optional);
}
return null;
}
use of org.apache.neethi.Assertion 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.neethi.Assertion in project cxf by apache.
the class MC11AssertionBuilder 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 (WSMC_NAMESPACE.equals(elem.getNamespaceURI()) && MCSUPPORTED_NAME.equals(elem.getLocalName())) {
boolean optional = XMLPrimitiveAssertionBuilder.isOptional(elem);
assertion = new PrimitiveAssertion(MCSUPPORTED_QNAME, optional);
}
return assertion;
}
use of org.apache.neethi.Assertion in project cxf by apache.
the class PolicyLoggingInterceptor method handleMessage.
public void handleMessage(Message message) throws Fault {
EndpointInfo ei = message.getExchange().getEndpoint().getEndpointInfo();
BindingOperationInfo boi = message.getExchange().getBindingOperationInfo();
LOG.fine("Getting effective server request policy for endpoint " + ei + " and binding operation " + boi);
EffectivePolicy ep = bus.getExtension(PolicyEngine.class).getEffectiveServerRequestPolicy(ei, boi, message);
for (Iterator<List<Assertion>> it = ep.getPolicy().getAlternatives(); it.hasNext(); ) {
Collection<Assertion> as = it.next();
LOG.fine("Checking alternative with " + as.size() + " assertions.");
for (Assertion a : as) {
LOG.fine("Assertion: " + a.getClass().getName());
HTTPServerPolicy p = (JaxbAssertion.cast(a, HTTPServerPolicy.class)).getData();
LOG.fine("server policy: " + ServerPolicyCalculator.toString(p));
}
}
}
Aggregations