@Override
protected void handleEncryptedContent(
InputProcessorChain inputProcessorChain, XMLSecStartElement parentStartXMLEvent,
InboundSecurityToken inboundSecurityToken, EncryptedDataType encryptedDataType) throws XMLSecurityException {
final DocumentContext documentContext = inputProcessorChain.getDocumentContext();
List<QName> elementPath = parentStartXMLEvent.getElementPath();
if (elementPath.size() == 2 && WSSUtils.isInSOAPBody(elementPath)) {
//soap:body content encryption counts as EncryptedPart
EncryptedPartSecurityEvent encryptedPartSecurityEvent =
new EncryptedPartSecurityEvent(inboundSecurityToken, true, documentContext.getProtectionOrder());
encryptedPartSecurityEvent.setElementPath(elementPath);
encryptedPartSecurityEvent.setXmlSecEvent(parentStartXMLEvent);
encryptedPartSecurityEvent.setCorrelationID(encryptedDataType.getId());
inputProcessorChain.getSecurityContext().registerSecurityEvent(encryptedPartSecurityEvent);
} else {
ContentEncryptedElementSecurityEvent contentEncryptedElementSecurityEvent =
new ContentEncryptedElementSecurityEvent(inboundSecurityToken, true, documentContext.getProtectionOrder());
contentEncryptedElementSecurityEvent.setElementPath(elementPath);
contentEncryptedElementSecurityEvent.setXmlSecEvent(parentStartXMLEvent);
contentEncryptedElementSecurityEvent.setCorrelationID(encryptedDataType.getId());
inputProcessorChain.getSecurityContext().registerSecurityEvent(contentEncryptedElementSecurityEvent);
}