use of com.helger.phase4.http.HttpXMLEntity in project phase4 by phax.
the class UserMessageFailureForgeryTest method testUserMessageWrongSigningDigestAlgorithm.
@Test
public void testUserMessageWrongSigningDigestAlgorithm() throws Exception {
final DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
// never forget this!
domFactory.setNamespaceAware(true);
final DocumentBuilder builder = domFactory.newDocumentBuilder();
final Document aDoc = builder.parse(new ClassPathResource("testfiles/WrongSigningDigestAlgorithm.xml").getInputStream());
sendPlainMessage(new HttpXMLEntity(aDoc, m_eSoapVersion.getMimeType()), false, EEbmsError.EBMS_FAILED_AUTHENTICATION.getErrorCode());
}
use of com.helger.phase4.http.HttpXMLEntity in project phase4 by phax.
the class UserMessageFailureForgeryTest method testPayloadChangedAfterSigningShouldFail.
@Test
public void testPayloadChangedAfterSigningShouldFail() throws Exception {
final Node aPayload = DOMReader.readXMLDOM(new ClassPathResource(AS4TestConstants.TEST_SOAP_BODY_PAYLOAD_XML));
final ICommonsList<WSS4JAttachment> aAttachments = new CommonsArrayList<>();
final Document aDoc = MockMessages.createUserMessageSigned(m_eSoapVersion, aPayload, aAttachments, s_aResMgr);
final NodeList nList = aDoc.getElementsByTagName(m_eSoapVersion.getNamespacePrefix() + ":Body");
for (int i = 0; i < nList.getLength(); i++) {
final Node nNode = nList.item(i);
final Element eElement = (Element) nNode;
eElement.setAttribute("INVALID", "INVALID");
}
sendPlainMessage(new HttpXMLEntity(aDoc, m_eSoapVersion.getMimeType()), false, EEbmsError.EBMS_FAILED_DECRYPTION.getErrorCode());
}
use of com.helger.phase4.http.HttpXMLEntity in project phase4 by phax.
the class UserMessageFailureForgeryTest method testUserMessageNoSOAPBodyPayloadNoAttachmentSignedSuccess.
// Tinkering with the signature
@Test
public void testUserMessageNoSOAPBodyPayloadNoAttachmentSignedSuccess() throws Exception {
final Document aDoc = MockMessages.createUserMessageSigned(m_eSoapVersion, null, null, s_aResMgr);
sendPlainMessage(new HttpXMLEntity(aDoc, m_eSoapVersion.getMimeType()), true, null);
}
use of com.helger.phase4.http.HttpXMLEntity in project phase4 by phax.
the class UserMessageFailureForgeryTest method testUserMessageWithBodyPayloadOnlyNoInfo.
@Test
public void testUserMessageWithBodyPayloadOnlyNoInfo() throws Exception {
final Node aPayload = DOMReader.readXMLDOM(new ClassPathResource(AS4TestConstants.TEST_SOAP_BODY_PAYLOAD_XML));
final Document aDoc = MockMessages.createUserMessageNotSigned(m_eSoapVersion, aPayload, null).getAsSoapDocument(aPayload);
// Delete the added Payload in the soap body to confirm right behaviour when
// the payload is missing
Element aNext = XMLHelper.getFirstChildElementOfName(aDoc, "Envelope");
aNext = XMLHelper.getFirstChildElementOfName(aNext, "Header");
aNext = XMLHelper.getFirstChildElementOfName(aNext, CAS4.EBMS_NS, "Messaging");
aNext = XMLHelper.getFirstChildElementOfName(aNext, CAS4.EBMS_NS, AS4TestConstants.USERMESSAGE_ASSERTCHECK);
aNext = XMLHelper.getFirstChildElementOfName(aNext, CAS4.EBMS_NS, "PayloadInfo");
aNext.getParentNode().removeChild(aNext);
sendPlainMessage(new HttpXMLEntity(aDoc, m_eSoapVersion.getMimeType()), false, EEbmsError.EBMS_VALUE_INCONSISTENT.getErrorCode());
}
use of com.helger.phase4.http.HttpXMLEntity in project phase4 by phax.
the class UserMessageFailureForgeryTest method testUserMessageWrongSigningAlgorithm.
@Test
public void testUserMessageWrongSigningAlgorithm() throws Exception {
final DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
// never forget this!
domFactory.setNamespaceAware(true);
final DocumentBuilder builder = domFactory.newDocumentBuilder();
final Document aDoc = builder.parse(new ClassPathResource("testfiles/WrongSigningAlgorithm.xml").getInputStream());
sendPlainMessage(new HttpXMLEntity(aDoc, m_eSoapVersion.getMimeType()), false, EEbmsError.EBMS_FAILED_AUTHENTICATION.getErrorCode());
}
Aggregations