You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by co...@apache.org on 2015/07/07 18:05:30 UTC
svn commit: r1689707 -
/webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/XOPAttachmentTest.java
Author: coheigea
Date: Tue Jul 7 16:05:30 2015
New Revision: 1689707
URL: http://svn.apache.org/r1689707
Log:
[WSS-544] - Added a signed cert test
Modified:
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/XOPAttachmentTest.java
Modified: webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/XOPAttachmentTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/XOPAttachmentTest.java?rev=1689707&r1=1689706&r2=1689707&view=diff
==============================================================================
--- webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/XOPAttachmentTest.java (original)
+++ webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/XOPAttachmentTest.java Tue Jul 7 16:05:30 2015
@@ -259,6 +259,39 @@ public class XOPAttachmentTest extends o
}
@org.junit.Test
+ public void testSignedSOAPBodyAndBinarySecurityToken() throws Exception {
+ WSSecSignature builder = new WSSecSignature();
+ builder.setUserInfo("16c73ab6-b892-458f-abf5-2f875f74882e", "security");
+ builder.setKeyIdentifierType(WSConstants.ISSUER_SERIAL);
+ builder.setIncludeSignatureToken(true);
+
+ Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
+ WSSecHeader secHeader = new WSSecHeader(doc);
+ secHeader.insertSecurityHeader();
+
+ AttachmentCallbackHandler outboundAttachmentCallback = new AttachmentCallbackHandler();
+ builder.setAttachmentCallbackHandler(outboundAttachmentCallback);
+ builder.setStoreBytesInAttachment(true);
+
+ Document signedDoc = builder.build(doc, crypto, secHeader);
+
+ List<Attachment> signedAttachments = outboundAttachmentCallback.getResponseAttachments();
+ assertNotNull(signedAttachments);
+ assertTrue(signedAttachments.size() == 1);
+
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("After Signing....");
+ String outputString =
+ XMLUtils.PrettyDocumentToString(signedDoc);
+ LOG.debug(outputString);
+ }
+
+ AttachmentCallbackHandler inboundAttachmentCallback =
+ new AttachmentCallbackHandler(signedAttachments);
+ verify(signedDoc, inboundAttachmentCallback);
+ }
+
+ @org.junit.Test
public void testEncryptedHeaderAsEncryptedData() throws Exception {
Document doc = SOAPUtil.toSOAPPart(SOAP_HEADER_MSG);
WSSecEncrypt encrypt = new WSSecEncrypt();