Search in sources :

Example 1 with Layout

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

the class LayoutPolicyValidator method validatePolicies.

/**
 * Validate policies.
 */
public void validatePolicies(PolicyValidatorParameters parameters, Collection<AssertionInfo> ais) {
    for (AssertionInfo ai : ais) {
        Layout layout = (Layout) ai.getAssertion();
        ai.setAsserted(true);
        assertToken(layout, parameters.getAssertionInfoMap());
        if (!validatePolicy(layout, parameters.getResults().getResults(), parameters.getSignedResults())) {
            String error = "Layout does not match the requirements";
            ai.setNotAsserted(error);
        }
    }
}
Also used : AssertionInfo(org.apache.cxf.ws.policy.AssertionInfo) Layout(org.apache.wss4j.policy.model.Layout)

Example 2 with Layout

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

the class AbstractStaxBindingHandler method configureLayout.

protected void configureLayout(AssertionInfoMap aim) {
    AssertionInfo ai = PolicyUtils.getFirstAssertionByLocalname(aim, SPConstants.LAYOUT);
    Layout layout = null;
    if (ai != null) {
        layout = (Layout) ai.getAssertion();
        ai.setAsserted(true);
    }
    if (layout != null && layout.getLayoutType() != null) {
        assertPolicy(new QName(layout.getName().getNamespaceURI(), layout.getLayoutType().name()));
    }
    if (!timestampAdded) {
        return;
    }
    boolean timestampLast = layout != null && layout.getLayoutType() == LayoutType.LaxTsLast;
    WSSConstants.Action actionToPerform = WSSConstants.TIMESTAMP;
    List<WSSConstants.Action> actionList = properties.getActions();
    if (timestampLast) {
        actionList.add(0, actionToPerform);
    } else {
        actionList.add(actionToPerform);
    }
}
Also used : AssertionInfo(org.apache.cxf.ws.policy.AssertionInfo) WSSConstants(org.apache.wss4j.stax.ext.WSSConstants) Layout(org.apache.wss4j.policy.model.Layout) QName(javax.xml.namespace.QName)

Aggregations

AssertionInfo (org.apache.cxf.ws.policy.AssertionInfo)2 Layout (org.apache.wss4j.policy.model.Layout)2 QName (javax.xml.namespace.QName)1 WSSConstants (org.apache.wss4j.stax.ext.WSSConstants)1