Search in sources :

Example 1 with RequiredParts

use of org.apache.wss4j.policy.model.RequiredParts in project cxf by apache.

the class RequiredPartsPolicyValidator method validatePolicies.

/**
 * Validate policies.
 */
public void validatePolicies(PolicyValidatorParameters parameters, Collection<AssertionInfo> ais) {
    Element header = parameters.getSoapHeader();
    for (AssertionInfo ai : ais) {
        RequiredParts rp = (RequiredParts) ai.getAssertion();
        ai.setAsserted(true);
        for (Header h : rp.getHeaders()) {
            QName qName = new QName(h.getNamespace(), h.getName());
            if (header == null || DOMUtils.getFirstChildWithName(header, qName) == null) {
                ai.setNotAsserted("No header element of name " + qName + " found.");
            }
        }
    }
}
Also used : AssertionInfo(org.apache.cxf.ws.policy.AssertionInfo) Header(org.apache.wss4j.policy.model.Header) QName(javax.xml.namespace.QName) Element(org.w3c.dom.Element) RequiredParts(org.apache.wss4j.policy.model.RequiredParts)

Aggregations

QName (javax.xml.namespace.QName)1 AssertionInfo (org.apache.cxf.ws.policy.AssertionInfo)1 Header (org.apache.wss4j.policy.model.Header)1 RequiredParts (org.apache.wss4j.policy.model.RequiredParts)1 Element (org.w3c.dom.Element)1