};
}
@Override
public boolean assertEvent(SecurityEvent securityEvent) throws WSSPolicyException {
AbstractSecuredElementSecurityEvent encryptedElementSecurityEvent =
(AbstractSecuredElementSecurityEvent) securityEvent;
Iterator<List<QName>> pathElementIterator = pathElements.iterator();
while (pathElementIterator.hasNext()) {
List<QName> pathElements = pathElementIterator.next();
if (WSSUtils.pathMatches(pathElements, encryptedElementSecurityEvent.getElementPath(), true, false)) {
if (encryptedElementSecurityEvent.isEncrypted()) {
setAsserted(true);
policyAsserter.assertPolicy(getAssertion());
return true;
} else {
//an element must be encrypted but isn't
setAsserted(false);
setErrorMessage("Element " + WSSUtils.pathAsString(encryptedElementSecurityEvent.getElementPath()) + " must be encrypted");
policyAsserter.unassertPolicy(getAssertion(), getErrorMessage());
return false;
}
}
}