ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1771307 [1/2] - in /webservices/wss4j/trunk: integration/src/test/java/org/apache/wss4j/integration/test/kerberos/ ws-security-dom/src/test/java/org/apache/wss4j/dom/message/ ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/ ws-secu...
Date Fri, 25 Nov 2016 12:30:49 GMT
Author: coheigea
Date: Fri Nov 25 12:30:49 2016
New Revision: 1771307

URL: http://svn.apache.org/viewvc?rev=1771307&view=rev
Log:
Finished first refactor

Modified:
    webservices/wss4j/trunk/integration/src/test/java/org/apache/wss4j/integration/test/kerberos/KerberosTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionPartsTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignaturePartsTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlTokenHOKTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlTokenTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SignedSamlTokenHOKTest.java
    webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/AttachmentTest.java
    webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/DerivedKeyTokenTest.java
    webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/EncDecryptionTest.java
    webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/SecurityContextTokenTest.java
    webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/SignatureEncryptionTest.java
    webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/SignatureTest.java
    webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/XOPAttachmentTest.java
    webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLCallbackHandlerImpl.java
    webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLTokenHOKTest.java
    webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLTokenReferenceTest.java
    webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLTokenTest.java
    webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SamlTokenDerivedTest.java

Modified: webservices/wss4j/trunk/integration/src/test/java/org/apache/wss4j/integration/test/kerberos/KerberosTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/integration/src/test/java/org/apache/wss4j/integration/test/kerberos/KerberosTest.java?rev=1771307&r1=1771306&r2=1771307&view=diff
==============================================================================
--- webservices/wss4j/trunk/integration/src/test/java/org/apache/wss4j/integration/test/kerberos/KerberosTest.java (original)
+++ webservices/wss4j/trunk/integration/src/test/java/org/apache/wss4j/integration/test/kerberos/KerberosTest.java Fri Nov 25 12:30:49 2016
@@ -236,7 +236,7 @@ public class KerberosTest extends Abstra
             }
         };
         bst.retrieveServiceTicket("alice", callbackHandler, "bob@service.ws.apache.org");
-        WSSecurityUtil.prependChildElement(secHeader.getSecurityHeader(), bst.getElement());
+        WSSecurityUtil.prependChildElement(secHeader.getSecurityHeaderElement(), bst.getElement());
 
         if (LOG.isDebugEnabled()) {
             String outputString =
@@ -378,9 +378,9 @@ public class KerberosTest extends Abstra
         };
         bst.retrieveServiceTicket("alice", callbackHandler, "bob@service.ws.apache.org");
         bst.setID("Id-" + bst.hashCode());
-        WSSecurityUtil.prependChildElement(secHeader.getSecurityHeader(), bst.getElement());
+        WSSecurityUtil.prependChildElement(secHeader.getSecurityHeaderElement(), bst.getElement());
 
-        WSSecSignature sign = new WSSecSignature();
+        WSSecSignature sign = new WSSecSignature(secHeader);
         sign.setSignatureAlgorithm(SignatureMethod.HMAC_SHA1);
         sign.setKeyIdentifierType(WSConstants.CUSTOM_SYMM_SIGNING);
         sign.setCustomTokenId(bst.getID());
@@ -389,7 +389,7 @@ public class KerberosTest extends Abstra
         SecretKey secretKey = bst.getSecretKey();
         sign.setSecretKey(secretKey.getEncoded());
 
-        Document signedDoc = sign.build(doc, null, secHeader);
+        Document signedDoc = sign.build(doc, null);
 
         if (LOG.isDebugEnabled()) {
             String outputString =
@@ -453,7 +453,7 @@ public class KerberosTest extends Abstra
         bst.retrieveServiceTicket("alice", callbackHandler, "bob@service.ws.apache.org");
         bst.setID("Id-" + bst.hashCode());
 
-        WSSecSignature sign = new WSSecSignature();
+        WSSecSignature sign = new WSSecSignature(secHeader);
         sign.setSignatureAlgorithm(SignatureMethod.HMAC_SHA1);
         sign.setKeyIdentifierType(WSConstants.CUSTOM_KEY_IDENTIFIER);
         sign.setCustomTokenValueType(WSConstants.WSS_KRB_KI_VALUE_TYPE);
@@ -465,9 +465,9 @@ public class KerberosTest extends Abstra
         byte[] digestBytes = KeyUtils.generateDigest(bst.getToken());
         sign.setCustomTokenId(Base64.getMimeEncoder().encodeToString(digestBytes));
 
-        Document signedDoc = sign.build(doc, null, secHeader);
+        Document signedDoc = sign.build(doc, null);
 
-        WSSecurityUtil.prependChildElement(secHeader.getSecurityHeader(), bst.getElement());
+        WSSecurityUtil.prependChildElement(secHeader.getSecurityHeaderElement(), bst.getElement());
 
         if (LOG.isDebugEnabled()) {
             String outputString =
@@ -530,9 +530,9 @@ public class KerberosTest extends Abstra
         };
         bst.retrieveServiceTicket("alice", callbackHandler, "bob@service.ws.apache.org");
         bst.setID("Id-" + bst.hashCode());
-        WSSecurityUtil.prependChildElement(secHeader.getSecurityHeader(), bst.getElement());
+        WSSecurityUtil.prependChildElement(secHeader.getSecurityHeaderElement(), bst.getElement());
 
-        WSSecEncrypt builder = new WSSecEncrypt();
+        WSSecEncrypt builder = new WSSecEncrypt(secHeader);
         builder.setSymmetricEncAlgorithm(WSConstants.AES_128);
         SecretKey secretKey = bst.getSecretKey();
         builder.setSymmetricKey(secretKey);
@@ -540,7 +540,7 @@ public class KerberosTest extends Abstra
         builder.setCustomReferenceValue(WSConstants.WSS_GSS_KRB_V5_AP_REQ);
         builder.setEncKeyId(bst.getID());
 
-        Document encryptedDoc = builder.build(doc, null, secHeader);
+        Document encryptedDoc = builder.build(doc, null);
 
         if (LOG.isDebugEnabled()) {
             String outputString =
@@ -603,7 +603,7 @@ public class KerberosTest extends Abstra
         bst.retrieveServiceTicket("alice", callbackHandler, "bob@service.ws.apache.org");
         bst.setID("Id-" + bst.hashCode());
 
-        WSSecEncrypt builder = new WSSecEncrypt();
+        WSSecEncrypt builder = new WSSecEncrypt(secHeader);
         builder.setSymmetricEncAlgorithm(WSConstants.AES_128);
         SecretKey secretKey = bst.getSecretKey();
         builder.setSymmetricKey(secretKey);
@@ -611,9 +611,9 @@ public class KerberosTest extends Abstra
         builder.setCustomReferenceValue(WSConstants.WSS_GSS_KRB_V5_AP_REQ);
         builder.setEncKeyId(bst.getID());
 
-        Document encryptedDoc = builder.build(doc, null, secHeader);
+        Document encryptedDoc = builder.build(doc, null);
 
-        WSSecurityUtil.prependChildElement(secHeader.getSecurityHeader(), bst.getElement());
+        WSSecurityUtil.prependChildElement(secHeader.getSecurityHeaderElement(), bst.getElement());
 
         if (LOG.isDebugEnabled()) {
             String outputString =
@@ -676,7 +676,7 @@ public class KerberosTest extends Abstra
         bst.retrieveServiceTicket("alice", callbackHandler, "bob@service.ws.apache.org");
         bst.setID("Id-" + bst.hashCode());
 
-        WSSecEncrypt builder = new WSSecEncrypt();
+        WSSecEncrypt builder = new WSSecEncrypt(secHeader);
         builder.setSymmetricEncAlgorithm(WSConstants.AES_128);
         SecretKey secretKey = bst.getSecretKey();
         builder.setSymmetricKey(secretKey);
@@ -686,9 +686,9 @@ public class KerberosTest extends Abstra
         byte[] digestBytes = KeyUtils.generateDigest(bst.getToken());
         builder.setEncKeyId(Base64.getMimeEncoder().encodeToString(digestBytes));
 
-        Document encryptedDoc = builder.build(doc, null, secHeader);
+        Document encryptedDoc = builder.build(doc, null);
 
-        WSSecurityUtil.prependChildElement(secHeader.getSecurityHeader(), bst.getElement());
+        WSSecurityUtil.prependChildElement(secHeader.getSecurityHeaderElement(), bst.getElement());
 
         if (LOG.isDebugEnabled()) {
             String outputString =
@@ -830,7 +830,7 @@ public class KerberosTest extends Abstra
             bst.retrieveServiceTicket("alice", callbackHandler, "bob@service.ws.apache.org");
             bst.setID("Id-" + bst.hashCode());
 
-            WSSecSignature sign = new WSSecSignature();
+            WSSecSignature sign = new WSSecSignature(secHeader);
             sign.setSignatureAlgorithm(SignatureMethod.HMAC_SHA1);
             sign.setKeyIdentifierType(WSConstants.CUSTOM_SYMM_SIGNING);
             sign.setCustomTokenId(bst.getID());
@@ -839,8 +839,8 @@ public class KerberosTest extends Abstra
             SecretKey secretKey = bst.getSecretKey();
             sign.setSecretKey(secretKey.getEncoded());
 
-            sign.build(doc, null, secHeader);
-            WSSecurityUtil.prependChildElement(secHeader.getSecurityHeader(), bst.getElement());
+            sign.build(doc, null);
+            WSSecurityUtil.prependChildElement(secHeader.getSecurityHeaderElement(), bst.getElement());
 
             javax.xml.transform.Transformer transformer = TRANSFORMER_FACTORY.newTransformer();
             transformer.transform(new DOMSource(doc), new StreamResult(baos));
@@ -923,7 +923,7 @@ public class KerberosTest extends Abstra
             bst.retrieveServiceTicket("alice", callbackHandler, "bob@service.ws.apache.org");
             bst.setID("Id-" + bst.hashCode());
 
-            WSSecSignature sign = new WSSecSignature();
+            WSSecSignature sign = new WSSecSignature(secHeader);
             sign.setSignatureAlgorithm(SignatureMethod.HMAC_SHA1);
             sign.setKeyIdentifierType(WSConstants.CUSTOM_KEY_IDENTIFIER);
             sign.setCustomTokenValueType(WSConstants.WSS_KRB_KI_VALUE_TYPE);
@@ -935,9 +935,9 @@ public class KerberosTest extends Abstra
             byte[] digestBytes = KeyUtils.generateDigest(bst.getToken());
             sign.setCustomTokenId(Base64.getMimeEncoder().encodeToString(digestBytes));
 
-            sign.build(doc, null, secHeader);
+            sign.build(doc, null);
 
-            WSSecurityUtil.prependChildElement(secHeader.getSecurityHeader(), bst.getElement());
+            WSSecurityUtil.prependChildElement(secHeader.getSecurityHeaderElement(), bst.getElement());
 
             javax.xml.transform.Transformer transformer = TRANSFORMER_FACTORY.newTransformer();
             transformer.transform(new DOMSource(doc), new StreamResult(baos));
@@ -1096,15 +1096,15 @@ public class KerberosTest extends Abstra
             bst.retrieveServiceTicket("alice", callbackHandler, "bob@service.ws.apache.org");
             bst.setID("Id-" + bst.hashCode());
 
-            WSSecEncrypt builder = new WSSecEncrypt();
+            WSSecEncrypt builder = new WSSecEncrypt(secHeader);
             builder.setSymmetricEncAlgorithm(WSConstants.AES_256);
             SecretKey secretKey = bst.getSecretKey();
             builder.setSymmetricKey(secretKey);
             builder.setEncryptSymmKey(false);
             builder.setCustomReferenceValue(WSConstants.WSS_GSS_KRB_V5_AP_REQ);
             builder.setEncKeyId(bst.getID());
-            builder.build(doc, null, secHeader);
-            WSSecurityUtil.prependChildElement(secHeader.getSecurityHeader(), bst.getElement());
+            builder.build(doc, null);
+            WSSecurityUtil.prependChildElement(secHeader.getSecurityHeaderElement(), bst.getElement());
 
             javax.xml.transform.Transformer transformer = TRANSFORMER_FACTORY.newTransformer();
             transformer.transform(new DOMSource(doc), new StreamResult(baos));
@@ -1187,7 +1187,7 @@ public class KerberosTest extends Abstra
             bst.retrieveServiceTicket("alice", callbackHandler, "bob@service.ws.apache.org");
             bst.setID("Id-" + bst.hashCode());
 
-            WSSecEncrypt builder = new WSSecEncrypt();
+            WSSecEncrypt builder = new WSSecEncrypt(secHeader);
             builder.setSymmetricEncAlgorithm(WSConstants.AES_128);
             SecretKey secretKey = bst.getSecretKey();
             builder.setSymmetricKey(secretKey);
@@ -1197,9 +1197,9 @@ public class KerberosTest extends Abstra
             byte[] digestBytes = KeyUtils.generateDigest(bst.getToken());
             builder.setEncKeyId(Base64.getMimeEncoder().encodeToString(digestBytes));
 
-            builder.build(doc, null, secHeader);
+            builder.build(doc, null);
 
-            WSSecurityUtil.prependChildElement(secHeader.getSecurityHeader(), bst.getElement());
+            WSSecurityUtil.prependChildElement(secHeader.getSecurityHeaderElement(), bst.getElement());
 
             javax.xml.transform.Transformer transformer = TRANSFORMER_FACTORY.newTransformer();
             transformer.transform(new DOMSource(doc), new StreamResult(baos));

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionPartsTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionPartsTest.java?rev=1771307&r1=1771306&r2=1771307&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionPartsTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionPartsTest.java Fri Nov 25 12:30:49 2016
@@ -180,7 +180,7 @@ public class EncryptionPartsTest extends
 
     @Test
     public void testOptionalSOAPHeaderNotPresent() throws Exception {
-        Document doc = SOAPUtil.toSOAPPart(SOAPMSG);
+        Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
         
@@ -217,7 +217,7 @@ public class EncryptionPartsTest extends
 
     @Test
     public void testRequiredSOAPHeaderNotPresent() throws Exception {
-        Document doc = SOAPUtil.toSOAPPart(SOAPMSG);
+        Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
         

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionTest.java?rev=1771307&r1=1771306&r2=1771307&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionTest.java Fri Nov 25 12:30:49 2016
@@ -139,6 +139,12 @@ public class EncryptionTest extends org.
          * This tests if several runs of different algorithms on same builder/cipher
          * setup are ok.
          */
+        doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
+        secHeader = new WSSecHeader(doc);
+        secHeader.insertSecurityHeader();
+        
+        builder = new WSSecEncrypt(secHeader);
+        builder.setUserInfo("wss40");
         builder.setKeyIdentifierType(WSConstants.ISSUER_SERIAL);
         builder.setSymmetricEncAlgorithm(WSConstants.AES_128);
         builder.setSymmetricKey(null);
@@ -149,9 +155,6 @@ public class EncryptionTest extends org.
             );
         builder.getParts().add(encP);
 
-        doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
-        secHeader = new WSSecHeader(doc);
-        secHeader.insertSecurityHeader();
         LOG.info("Before Encryption AES 128/RSA-15....");
         encryptedDoc = builder.build(doc, crypto);
         LOG.info("After Encryption AES 128/RSA-15....");

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignaturePartsTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignaturePartsTest.java?rev=1771307&r1=1771306&r2=1771307&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignaturePartsTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignaturePartsTest.java Fri Nov 25 12:30:49 2016
@@ -193,7 +193,7 @@ public class SignaturePartsTest extends
 
     @Test
     public void testOptionalSOAPHeaderNotPresent() throws Exception {
-        Document doc = SOAPUtil.toSOAPPart(SOAPMSG);
+        Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
         
@@ -230,7 +230,7 @@ public class SignaturePartsTest extends
 
     @Test
     public void testRequiredSOAPHeaderNotPresent() throws Exception {
-        Document doc = SOAPUtil.toSOAPPart(SOAPMSG);
+        Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
         

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlTokenHOKTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlTokenHOKTest.java?rev=1771307&r1=1771306&r2=1771307&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlTokenHOKTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlTokenHOKTest.java Fri Nov 25 12:30:49 2016
@@ -82,13 +82,13 @@ public class SamlTokenHOKTest extends or
 
         samlAssertion.signAssertion("16c73ab6-b892-458f-abf5-2f875f74882e", "security", crypto, false);
 
-        WSSecSAMLToken wsSign = new WSSecSAMLToken();
-
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
+        
+        WSSecSAMLToken wsSign = new WSSecSAMLToken(secHeader);
 
-        Document signedDoc = wsSign.build(doc, samlAssertion, secHeader);
+        Document signedDoc = wsSign.build(doc, samlAssertion);
 
         if (LOG.isDebugEnabled()) {
             LOG.debug("SAML 1.1 Authn Assertion (holder-of-key):");
@@ -123,13 +123,13 @@ public class SamlTokenHOKTest extends or
 
         samlAssertion.signAssertion("16c73ab6-b892-458f-abf5-2f875f74882e", "security", crypto, false);
 
-        WSSecSAMLToken wsSign = new WSSecSAMLToken();
-
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
+        
+        WSSecSAMLToken wsSign = new WSSecSAMLToken(secHeader);
 
-        Document signedDoc = wsSign.build(doc, samlAssertion, secHeader);
+        Document signedDoc = wsSign.build(doc, samlAssertion);
 
         if (LOG.isDebugEnabled()) {
             LOG.debug("SAML 1.1 Attr Assertion (holder-of-key):");
@@ -174,13 +174,13 @@ public class SamlTokenHOKTest extends or
 
         samlAssertion.signAssertion("16c73ab6-b892-458f-abf5-2f875f74882e", "security", crypto, false);
 
-        WSSecSAMLToken wsSign = new WSSecSAMLToken();
-
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
+        
+        WSSecSAMLToken wsSign = new WSSecSAMLToken(secHeader);
 
-        Document unsignedDoc = wsSign.build(doc, samlAssertion, secHeader);
+        Document unsignedDoc = wsSign.build(doc, samlAssertion);
 
         if (LOG.isDebugEnabled()) {
             LOG.debug("SAML 2 Authn Assertion (holder-of-key):");
@@ -214,14 +214,13 @@ public class SamlTokenHOKTest extends or
 
         samlAssertion.signAssertion("16c73ab6-b892-458f-abf5-2f875f74882e", "security", crypto, false);
 
-
-        WSSecSAMLToken wsSign = new WSSecSAMLToken();
-
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
+        
+        WSSecSAMLToken wsSign = new WSSecSAMLToken(secHeader);
 
-        Document unsignedDoc = wsSign.build(doc, samlAssertion, secHeader);
+        Document unsignedDoc = wsSign.build(doc, samlAssertion);
 
         if (LOG.isDebugEnabled()) {
             LOG.debug("SAML 2 Attr Assertion (holder-of-key):");

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlTokenTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlTokenTest.java?rev=1771307&r1=1771306&r2=1771307&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlTokenTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlTokenTest.java Fri Nov 25 12:30:49 2016
@@ -336,13 +336,13 @@ public class SamlTokenTest extends org.j
         SAMLUtil.doSAMLCallback(callbackHandler, samlCallback);
         SamlAssertionWrapper samlAssertion = new SamlAssertionWrapper(samlCallback);
 
-        WSSecSAMLToken wsSign = new WSSecSAMLToken();
-
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
+        
+        WSSecSAMLToken wsSign = new WSSecSAMLToken(secHeader);
 
-        Document unsignedDoc = wsSign.build(doc, samlAssertion, secHeader);
+        Document unsignedDoc = wsSign.build(doc, samlAssertion);
 
         String outputString =
             XMLUtils.prettyDocumentToString(unsignedDoc);
@@ -377,13 +377,13 @@ public class SamlTokenTest extends org.j
         SAMLUtil.doSAMLCallback(callbackHandler, samlCallback);
         SamlAssertionWrapper samlAssertion = new SamlAssertionWrapper(samlCallback);
 
-        WSSecSAMLToken wsSign = new WSSecSAMLToken();
-
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
+        
+        WSSecSAMLToken wsSign = new WSSecSAMLToken(secHeader);
 
-        Document unsignedDoc = wsSign.build(doc, samlAssertion, secHeader);
+        Document unsignedDoc = wsSign.build(doc, samlAssertion);
 
         String outputString =
             XMLUtils.prettyDocumentToString(unsignedDoc);
@@ -418,13 +418,13 @@ public class SamlTokenTest extends org.j
         SAMLUtil.doSAMLCallback(callbackHandler, samlCallback);
         SamlAssertionWrapper samlAssertion = new SamlAssertionWrapper(samlCallback);
 
-        WSSecSAMLToken wsSign = new WSSecSAMLToken();
-
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
+        
+        WSSecSAMLToken wsSign = new WSSecSAMLToken(secHeader);
 
-        Document unsignedDoc = wsSign.build(doc, samlAssertion, secHeader);
+        Document unsignedDoc = wsSign.build(doc, samlAssertion);
 
         String outputString =
             XMLUtils.prettyDocumentToString(unsignedDoc);
@@ -460,13 +460,13 @@ public class SamlTokenTest extends org.j
         SAMLUtil.doSAMLCallback(callbackHandler, samlCallback);
         SamlAssertionWrapper samlAssertion = new SamlAssertionWrapper(samlCallback);
 
-        WSSecSAMLToken wsSign = new WSSecSAMLToken();
-
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
+        
+        WSSecSAMLToken wsSign = new WSSecSAMLToken(secHeader);
 
-        Document unsignedDoc = wsSign.build(doc, samlAssertion, secHeader);
+        Document unsignedDoc = wsSign.build(doc, samlAssertion);
 
         String outputString =
             XMLUtils.prettyDocumentToString(unsignedDoc);
@@ -500,14 +500,14 @@ public class SamlTokenTest extends org.j
         SAMLCallback samlCallback = new SAMLCallback();
         SAMLUtil.doSAMLCallback(callbackHandler, samlCallback);
         SamlAssertionWrapper samlAssertion = new SamlAssertionWrapper(samlCallback);
-
-        WSSecSAMLToken wsSign = new WSSecSAMLToken();
-
+        
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
 
-        Document unsignedDoc = wsSign.build(doc, samlAssertion, secHeader);
+        WSSecSAMLToken wsSign = new WSSecSAMLToken(secHeader);
+
+        Document unsignedDoc = wsSign.build(doc, samlAssertion);
 
         String outputString =
             XMLUtils.prettyDocumentToString(unsignedDoc);
@@ -543,13 +543,13 @@ public class SamlTokenTest extends org.j
         SAMLUtil.doSAMLCallback(callbackHandler, samlCallback);
         SamlAssertionWrapper samlAssertion = new SamlAssertionWrapper(samlCallback);
 
-        WSSecSAMLToken wsSign = new WSSecSAMLToken();
-
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
+        
+        WSSecSAMLToken wsSign = new WSSecSAMLToken(secHeader);
 
-        Document unsignedDoc = wsSign.build(doc, samlAssertion, secHeader);
+        Document unsignedDoc = wsSign.build(doc, samlAssertion);
 
         String outputString =
             XMLUtils.prettyDocumentToString(unsignedDoc);
@@ -604,13 +604,13 @@ public class SamlTokenTest extends org.j
         SAMLUtil.doSAMLCallback(callbackHandler, samlCallback);
         SamlAssertionWrapper samlAssertion = new SamlAssertionWrapper(samlCallback);
 
-        WSSecSAMLToken wsSign = new WSSecSAMLToken();
-
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
+        
+        WSSecSAMLToken wsSign = new WSSecSAMLToken(secHeader);
 
-        Document unsignedDoc = wsSign.build(doc, samlAssertion, secHeader);
+        Document unsignedDoc = wsSign.build(doc, samlAssertion);
 
         if (LOG.isDebugEnabled()) {
             LOG.debug("SAML 2 Attr Assertion (sender vouches):");
@@ -684,13 +684,13 @@ public class SamlTokenTest extends org.j
         SAMLUtil.doSAMLCallback(callbackHandler, samlCallback);
         SamlAssertionWrapper samlAssertion = new SamlAssertionWrapper(samlCallback);
 
-        WSSecSAMLToken wsSign = new WSSecSAMLToken();
-
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
+        
+        WSSecSAMLToken wsSign = new WSSecSAMLToken(secHeader);
 
-        Document unsignedDoc = wsSign.build(doc, samlAssertion, secHeader);
+        Document unsignedDoc = wsSign.build(doc, samlAssertion);
 
         String outputString =
             XMLUtils.prettyDocumentToString(unsignedDoc);
@@ -724,11 +724,11 @@ public class SamlTokenTest extends org.j
         SAMLUtil.doSAMLCallback(callbackHandler, samlCallback);
         SamlAssertionWrapper samlAssertion = new SamlAssertionWrapper(samlCallback);
 
-        WSSecSAMLToken wsSign = new WSSecSAMLToken();
-
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
+        
+        WSSecSAMLToken wsSign = new WSSecSAMLToken(secHeader);
 
         wsSign.prepare(doc, samlAssertion);
 
@@ -737,7 +737,7 @@ public class SamlTokenTest extends org.j
         Element encryptedAssertionElement =
             doc.createElementNS(WSConstants.SAML2_NS, WSConstants.ENCRYPED_ASSERTION_LN);
         encryptedAssertionElement.appendChild(assertionElement);
-        secHeader.getSecurityHeader().appendChild(encryptedAssertionElement);
+        secHeader.getSecurityHeaderElement().appendChild(encryptedAssertionElement);
 
         // Encrypt the Assertion
         KeyGenerator keygen = KeyGenerator.getInstance("AES");
@@ -788,11 +788,11 @@ public class SamlTokenTest extends org.j
         SAMLUtil.doSAMLCallback(callbackHandler, samlCallback);
         SamlAssertionWrapper samlAssertion = new SamlAssertionWrapper(samlCallback);
 
-        WSSecSAMLToken wsSign = new WSSecSAMLToken();
-
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
+        
+        WSSecSAMLToken wsSign = new WSSecSAMLToken(secHeader);
 
         wsSign.prepare(doc, samlAssertion);
 
@@ -801,7 +801,7 @@ public class SamlTokenTest extends org.j
         Element encryptedAssertionElement =
             doc.createElementNS(WSConstants.SAML2_NS, WSConstants.ENCRYPED_ASSERTION_LN);
         encryptedAssertionElement.appendChild(assertionElement);
-        secHeader.getSecurityHeader().appendChild(encryptedAssertionElement);
+        secHeader.getSecurityHeaderElement().appendChild(encryptedAssertionElement);
 
         // Encrypt the Assertion
         KeyGenerator keygen = KeyGenerator.getInstance("AES");
@@ -901,11 +901,11 @@ public class SamlTokenTest extends org.j
         SAMLUtil.doSAMLCallback(callbackHandler, samlCallback);
         SamlAssertionWrapper samlAssertion = new SamlAssertionWrapper(samlCallback);
 
-        WSSecSAMLToken wsSign = new WSSecSAMLToken();
-
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
+        
+        WSSecSAMLToken wsSign = new WSSecSAMLToken(secHeader);
 
         wsSign.prepare(doc, samlAssertion);
 
@@ -914,7 +914,7 @@ public class SamlTokenTest extends org.j
         Element encryptedAssertionElement =
             doc.createElementNS(WSConstants.SAML2_NS, WSConstants.ENCRYPED_ASSERTION_LN);
         encryptedAssertionElement.appendChild(assertionElement);
-        secHeader.getSecurityHeader().appendChild(encryptedAssertionElement);
+        secHeader.getSecurityHeaderElement().appendChild(encryptedAssertionElement);
 
         // Encrypt the Assertion
         KeyGenerator keygen = KeyGenerator.getInstance("AES");
@@ -1025,13 +1025,13 @@ public class SamlTokenTest extends org.j
         SAMLUtil.doSAMLCallback(callbackHandler, samlCallback);
         SamlAssertionWrapper samlAssertion = new SamlAssertionWrapper(samlCallback);
 
-        WSSecSAMLToken wsSign = new WSSecSAMLToken();
-
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
+        
+        WSSecSAMLToken wsSign = new WSSecSAMLToken(secHeader);
 
-        Document unsignedDoc = wsSign.build(doc, samlAssertion, secHeader);
+        Document unsignedDoc = wsSign.build(doc, samlAssertion);
 
         WSSConfig config = WSSConfig.getNewInstance();
         SamlAssertionValidator assertionValidator = new SamlAssertionValidator();
@@ -1053,13 +1053,13 @@ public class SamlTokenTest extends org.j
         SAMLUtil.doSAMLCallback(callbackHandler, samlCallback);
         samlAssertion = new SamlAssertionWrapper(samlCallback);
 
-        wsSign = new WSSecSAMLToken();
-
         doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
         secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
+        
+        wsSign = new WSSecSAMLToken(secHeader);
 
-        unsignedDoc = wsSign.build(doc, samlAssertion, secHeader);
+        unsignedDoc = wsSign.build(doc, samlAssertion);
         try {
             newEngine.processSecurityHeader(unsignedDoc, null, null, null);
             fail("Failure expected on an incorrect subject confirmation method");
@@ -1079,13 +1079,13 @@ public class SamlTokenTest extends org.j
         SAMLUtil.doSAMLCallback(callbackHandler, samlCallback);
         SamlAssertionWrapper samlAssertion = new SamlAssertionWrapper(samlCallback);
 
-        WSSecSAMLToken wsSign = new WSSecSAMLToken();
-
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
+        
+        WSSecSAMLToken wsSign = new WSSecSAMLToken(secHeader);
 
-        Document unsignedDoc = wsSign.build(doc, samlAssertion, secHeader);
+        Document unsignedDoc = wsSign.build(doc, samlAssertion);
 
         WSSecurityEngine newEngine = new WSSecurityEngine();
         try {
@@ -1121,13 +1121,13 @@ public class SamlTokenTest extends org.j
         SAMLUtil.doSAMLCallback(callbackHandler, samlCallback);
         SamlAssertionWrapper samlAssertion = new SamlAssertionWrapper(samlCallback);
 
-        WSSecSAMLToken wsSign = new WSSecSAMLToken();
-
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
+        
+        WSSecSAMLToken wsSign = new WSSecSAMLToken(secHeader);
 
-        Document unsignedDoc = wsSign.build(doc, samlAssertion, secHeader);
+        Document unsignedDoc = wsSign.build(doc, samlAssertion);
 
         WSSecurityEngine newEngine = new WSSecurityEngine();
         try {
@@ -1176,12 +1176,12 @@ public class SamlTokenTest extends org.j
         SAMLUtil.doSAMLCallback(callbackHandler, samlCallback);
         samlAssertion = new SamlAssertionWrapper(samlCallback);
 
-        WSSecSAMLToken wsSign = new WSSecSAMLToken();
-
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
+        
+        WSSecSAMLToken wsSign = new WSSecSAMLToken(secHeader);
 
-        Document unsignedDoc = wsSign.build(doc, samlAssertion, secHeader);
+        Document unsignedDoc = wsSign.build(doc, samlAssertion);
 
         String outputString =
             XMLUtils.prettyDocumentToString(unsignedDoc);
@@ -1216,13 +1216,13 @@ public class SamlTokenTest extends org.j
         SAMLUtil.doSAMLCallback(callbackHandler, samlCallback);
         SamlAssertionWrapper samlAssertion = new SamlAssertionWrapper(samlCallback);
 
-        WSSecSAMLToken wsSign = new WSSecSAMLToken();
-
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
+        
+        WSSecSAMLToken wsSign = new WSSecSAMLToken(secHeader);
 
-        Document unsignedDoc = wsSign.build(doc, samlAssertion, secHeader);
+        Document unsignedDoc = wsSign.build(doc, samlAssertion);
 
         String outputString = XMLUtils.prettyDocumentToString(unsignedDoc);
         // assertTrue(outputString.contains("j\u00f6e") && outputString.contains("j\u00f6an"));
@@ -1256,13 +1256,13 @@ public class SamlTokenTest extends org.j
         SAMLUtil.doSAMLCallback(callbackHandler, samlCallback);
         SamlAssertionWrapper samlAssertion = new SamlAssertionWrapper(samlCallback);
 
-        WSSecSAMLToken wsSign = new WSSecSAMLToken();
-
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
+        
+        WSSecSAMLToken wsSign = new WSSecSAMLToken(secHeader);
 
-        Document unsignedDoc = wsSign.build(doc, samlAssertion, secHeader);
+        Document unsignedDoc = wsSign.build(doc, samlAssertion);
 
         String outputString =
             XMLUtils.prettyDocumentToString(unsignedDoc);
@@ -1346,13 +1346,13 @@ public class SamlTokenTest extends org.j
         SAMLUtil.doSAMLCallback(samlCallbackHandler, samlCallback);
         SamlAssertionWrapper samlAssertion = new SamlAssertionWrapper(samlCallback);
 
-        WSSecSAMLToken wsSign = new WSSecSAMLToken();
-
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
+        
+        WSSecSAMLToken wsSign = new WSSecSAMLToken(secHeader);
 
-        Document unsignedDoc = wsSign.build(doc, samlAssertion, secHeader);
+        Document unsignedDoc = wsSign.build(doc, samlAssertion);
 
         if (LOG.isDebugEnabled()) {
             String outputString =

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SignedSamlTokenHOKTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SignedSamlTokenHOKTest.java?rev=1771307&r1=1771306&r2=1771307&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SignedSamlTokenHOKTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SignedSamlTokenHOKTest.java Fri Nov 25 12:30:49 2016
@@ -110,18 +110,18 @@ public class SignedSamlTokenHOKTest exte
 
         samlAssertion.signAssertion("wss40_server", "security", issuerCrypto, false);
 
-        WSSecSignatureSAML wsSign = new WSSecSignatureSAML();
+        Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
+        WSSecHeader secHeader = new WSSecHeader(doc);
+        secHeader.insertSecurityHeader();
+        
+        WSSecSignatureSAML wsSign = new WSSecSignatureSAML(secHeader);
         wsSign.setUserInfo("wss40", "security");
         wsSign.setDigestAlgo("http://www.w3.org/2001/04/xmlenc#sha256");
         wsSign.setSignatureAlgorithm("http://www.w3.org/2001/04/xmldsig-more#rsa-sha256");
         wsSign.setKeyIdentifierType(WSConstants.BST_DIRECT_REFERENCE);
 
-        Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
-        WSSecHeader secHeader = new WSSecHeader(doc);
-        secHeader.insertSecurityHeader();
-
         Document signedDoc =
-            wsSign.build(doc, userCrypto, samlAssertion, null, null, null, secHeader);
+            wsSign.build(doc, userCrypto, samlAssertion, null, null, null);
 
         String outputString =
             XMLUtils.prettyDocumentToString(signedDoc);
@@ -181,18 +181,19 @@ public class SignedSamlTokenHOKTest exte
         samlAssertion.signAssertion("wss40_server", "security", issuerCrypto, false);
         byte[] ephemeralKey = callbackHandler.getEphemeralKey();
 
-        WSSecSignatureSAML wsSign = new WSSecSignatureSAML();
+        Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
+        WSSecHeader secHeader = new WSSecHeader(doc);
+        secHeader.insertSecurityHeader();
+        
+        WSSecSignatureSAML wsSign = new WSSecSignatureSAML(secHeader);
         wsSign.setUserInfo("wss40", "security");
         wsSign.setDigestAlgo("http://www.w3.org/2001/04/xmlenc#sha256");
         wsSign.setSignatureAlgorithm(WSConstants.HMAC_SHA256);
         wsSign.setKeyIdentifierType(WSConstants.X509_KEY_IDENTIFIER);
         wsSign.setSecretKey(ephemeralKey);
 
-        Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
-        WSSecHeader secHeader = new WSSecHeader(doc);
-        secHeader.insertSecurityHeader();
         Document signedDoc =
-            wsSign.build(doc, userCrypto, samlAssertion, null, null, null, secHeader);
+            wsSign.build(doc, userCrypto, samlAssertion, null, null, null);
 
         String outputString =
             XMLUtils.prettyDocumentToString(signedDoc);
@@ -243,18 +244,18 @@ public class SignedSamlTokenHOKTest exte
 
         samlAssertion.signAssertion("wss40_server", "security", issuerCrypto, false);
 
-        WSSecSignatureSAML wsSign = new WSSecSignatureSAML();
+        Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
+        WSSecHeader secHeader = new WSSecHeader(doc);
+        secHeader.insertSecurityHeader();
+        
+        WSSecSignatureSAML wsSign = new WSSecSignatureSAML(secHeader);
         wsSign.setUserInfo("wss40", "security");
         wsSign.setDigestAlgo("http://www.w3.org/2001/04/xmlenc#sha256");
         wsSign.setSignatureAlgorithm("http://www.w3.org/2001/04/xmldsig-more#rsa-sha256");
         wsSign.setKeyIdentifierType(WSConstants.BST_DIRECT_REFERENCE);
 
-        Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
-        WSSecHeader secHeader = new WSSecHeader(doc);
-        secHeader.insertSecurityHeader();
-
         Document signedDoc =
-            wsSign.build(doc, userCrypto, samlAssertion, null, null, null, secHeader);
+            wsSign.build(doc, userCrypto, samlAssertion, null, null, null);
 
         String outputString =
             XMLUtils.prettyDocumentToString(signedDoc);
@@ -305,19 +306,19 @@ public class SignedSamlTokenHOKTest exte
         samlAssertion.signAssertion("wss40_server", "security", issuerCrypto, false);
         byte[] ephemeralKey = callbackHandler.getEphemeralKey();
 
-        WSSecSignatureSAML wsSign = new WSSecSignatureSAML();
+        Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
+        WSSecHeader secHeader = new WSSecHeader(doc);
+        secHeader.insertSecurityHeader();
+        
+        WSSecSignatureSAML wsSign = new WSSecSignatureSAML(secHeader);
         wsSign.setUserInfo("wss40", "security");
         wsSign.setDigestAlgo("http://www.w3.org/2001/04/xmlenc#sha256");
         wsSign.setSignatureAlgorithm(WSConstants.HMAC_SHA256);
         wsSign.setKeyIdentifierType(WSConstants.X509_KEY_IDENTIFIER);
         wsSign.setSecretKey(ephemeralKey);
 
-        Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
-        WSSecHeader secHeader = new WSSecHeader(doc);
-        secHeader.insertSecurityHeader();
-
         Document signedDoc =
-            wsSign.build(doc, userCrypto, samlAssertion, null, null, null, secHeader);
+            wsSign.build(doc, userCrypto, samlAssertion, null, null, null);
 
         String outputString =
             XMLUtils.prettyDocumentToString(signedDoc);
@@ -370,18 +371,18 @@ public class SignedSamlTokenHOKTest exte
 
         samlAssertion.signAssertion("wss40_server", "security", issuerCrypto, false);
 
-        WSSecSignatureSAML wsSign = new WSSecSignatureSAML();
+        Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
+        WSSecHeader secHeader = new WSSecHeader(doc);
+        secHeader.insertSecurityHeader();
+        
+        WSSecSignatureSAML wsSign = new WSSecSignatureSAML(secHeader);
         wsSign.setUserInfo("wss40", "security");
         wsSign.setDigestAlgo("http://www.w3.org/2001/04/xmlenc#sha256");
         wsSign.setSignatureAlgorithm("http://www.w3.org/2001/04/xmldsig-more#rsa-sha256");
         wsSign.setKeyIdentifierType(WSConstants.BST_DIRECT_REFERENCE);
 
-        Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
-        WSSecHeader secHeader = new WSSecHeader(doc);
-        secHeader.insertSecurityHeader();
-
         Document signedDoc =
-            wsSign.build(doc, userCrypto, samlAssertion, null, null, null, secHeader);
+            wsSign.build(doc, userCrypto, samlAssertion, null, null, null);
 
         String outputString =
             XMLUtils.prettyDocumentToString(signedDoc);
@@ -431,18 +432,18 @@ public class SignedSamlTokenHOKTest exte
 
         samlAssertion.signAssertion("wss40_server", "security", issuerCrypto, false);
 
-        WSSecSignatureSAML wsSign = new WSSecSignatureSAML();
+        Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
+        WSSecHeader secHeader = new WSSecHeader(doc);
+        secHeader.insertSecurityHeader();
+        
+        WSSecSignatureSAML wsSign = new WSSecSignatureSAML(secHeader);
         wsSign.setUserInfo("wss40", "security");
         wsSign.setDigestAlgo("http://www.w3.org/2001/04/xmlenc#sha256");
         wsSign.setSignatureAlgorithm("http://www.w3.org/2001/04/xmldsig-more#rsa-sha256");
         wsSign.setKeyIdentifierType(WSConstants.BST_DIRECT_REFERENCE);
 
-        Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
-        WSSecHeader secHeader = new WSSecHeader(doc);
-        secHeader.insertSecurityHeader();
-
         Document signedDoc =
-            wsSign.build(doc, userCrypto, samlAssertion, null, null, null, secHeader);
+            wsSign.build(doc, userCrypto, samlAssertion, null, null, null);
 
         String outputString =
             XMLUtils.prettyDocumentToString(signedDoc);
@@ -492,18 +493,18 @@ public class SignedSamlTokenHOKTest exte
 
         samlAssertion.signAssertion("wss40_server", "security", issuerCrypto, false);
 
-        WSSecSignatureSAML wsSign = new WSSecSignatureSAML();
+        Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
+        WSSecHeader secHeader = new WSSecHeader(doc);
+        secHeader.insertSecurityHeader();
+        
+        WSSecSignatureSAML wsSign = new WSSecSignatureSAML(secHeader);
         wsSign.setUserInfo("wss40", "security");
         wsSign.setDigestAlgo("http://www.w3.org/2001/04/xmlenc#sha256");
         wsSign.setSignatureAlgorithm("http://www.w3.org/2001/04/xmldsig-more#rsa-sha256");
         wsSign.setKeyIdentifierType(WSConstants.BST_DIRECT_REFERENCE);
 
-        Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
-        WSSecHeader secHeader = new WSSecHeader(doc);
-        secHeader.insertSecurityHeader();
-
         Document signedDoc =
-            wsSign.build(doc, userCrypto, samlAssertion, null, null, null, secHeader);
+            wsSign.build(doc, userCrypto, samlAssertion, null, null, null);
 
         String outputString =
             XMLUtils.prettyDocumentToString(signedDoc);
@@ -558,18 +559,18 @@ public class SignedSamlTokenHOKTest exte
 
         samlAssertion.signAssertion("wss40_server", "security", issuerCrypto, false);
 
-        WSSecSignatureSAML wsSign = new WSSecSignatureSAML();
+        Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
+        WSSecHeader secHeader = new WSSecHeader(doc);
+        secHeader.insertSecurityHeader();
+        
+        WSSecSignatureSAML wsSign = new WSSecSignatureSAML(secHeader);
         wsSign.setUserInfo("16c73ab6-b892-458f-abf5-2f875f74882e", "security");
         wsSign.setDigestAlgo("http://www.w3.org/2001/04/xmlenc#sha256");
         wsSign.setSignatureAlgorithm("http://www.w3.org/2001/04/xmldsig-more#rsa-sha256");
         wsSign.setKeyIdentifierType(WSConstants.BST_DIRECT_REFERENCE);
 
-        Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
-        WSSecHeader secHeader = new WSSecHeader(doc);
-        secHeader.insertSecurityHeader();
-
         Document signedDoc =
-            wsSign.build(doc, crypto, samlAssertion, null, null, null, secHeader);
+            wsSign.build(doc, crypto, samlAssertion, null, null, null);
 
         String outputString =
             XMLUtils.prettyDocumentToString(signedDoc);
@@ -634,18 +635,18 @@ public class SignedSamlTokenHOKTest exte
 
         byte[] ephemeralKey = callbackHandler.getEphemeralKey();
 
-        WSSecSignatureSAML wsSign = new WSSecSignatureSAML();
+        WSSecHeader secHeader = new WSSecHeader(doc);
+        secHeader.insertSecurityHeader();
+        
+        WSSecSignatureSAML wsSign = new WSSecSignatureSAML(secHeader);
         wsSign.setUserInfo("wss40", "security");
         wsSign.setDigestAlgo("http://www.w3.org/2001/04/xmlenc#sha256");
         wsSign.setSignatureAlgorithm(WSConstants.HMAC_SHA256);
         wsSign.setKeyIdentifierType(WSConstants.X509_KEY_IDENTIFIER);
         wsSign.setSecretKey(ephemeralKey);
 
-        WSSecHeader secHeader = new WSSecHeader(doc);
-        secHeader.insertSecurityHeader();
-
         Document signedDoc =
-            wsSign.build(doc, userCrypto, samlAssertion, null, null, null, secHeader);
+            wsSign.build(doc, userCrypto, samlAssertion, null, null, null);
 
         String outputString =
             XMLUtils.prettyDocumentToString(signedDoc);

Modified: webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/AttachmentTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/AttachmentTest.java?rev=1771307&r1=1771306&r2=1771307&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/AttachmentTest.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/AttachmentTest.java Fri Nov 25 12:30:49 2016
@@ -634,12 +634,12 @@ public class AttachmentTest extends Abst
     public void testXMLAttachmentContentEncryptionExternalReferenceList() throws Exception {
 
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
-        WSSecEncrypt encrypt = new WSSecEncrypt();
-        encrypt.setUserInfo("receiver", "default");
-        encrypt.setKeyIdentifierType(WSConstants.ISSUER_SERIAL);
-
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
+        
+        WSSecEncrypt encrypt = new WSSecEncrypt(secHeader);
+        encrypt.setUserInfo("receiver", "default");
+        encrypt.setKeyIdentifierType(WSConstants.ISSUER_SERIAL);
 
         encrypt.getParts().add(new WSEncryptionPart("Body", "http://schemas.xmlsoap.org/soap/envelope/", "Content"));
         encrypt.getParts().add(new WSEncryptionPart("cid:Attachments", "Content"));
@@ -658,9 +658,9 @@ public class AttachmentTest extends Abst
 
         encrypt.prepare(doc, CryptoFactory.getInstance("transmitter-crypto.properties"));
         Element refs = encrypt.encrypt();
-        encrypt.addAttachmentEncryptedDataElements(secHeader);
-        encrypt.addExternalRefElement(refs, secHeader);
-        encrypt.prependToHeader(secHeader);
+        encrypt.addAttachmentEncryptedDataElements();
+        encrypt.addExternalRefElement(refs);
+        encrypt.prependToHeader();
 
         NodeList references = doc.getElementsByTagNameNS(WSConstants.ENC_NS, "DataReference");
         Assert.assertEquals(2, references.getLength());

Modified: webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/DerivedKeyTokenTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/DerivedKeyTokenTest.java?rev=1771307&r1=1771306&r2=1771307&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/DerivedKeyTokenTest.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/DerivedKeyTokenTest.java Fri Nov 25 12:30:49 2016
@@ -135,13 +135,13 @@ public class DerivedKeyTokenTest extends
             WSSecHeader secHeader = new WSSecHeader(doc);
             secHeader.insertSecurityHeader();
 
-            WSSecSecurityContextToken sctBuilder = new WSSecSecurityContextToken();
+            WSSecSecurityContextToken sctBuilder = new WSSecSecurityContextToken(secHeader, null);
             Crypto crypto = CryptoFactory.getInstance("transmitter-crypto.properties");
             sctBuilder.setWscVersion(version);
             sctBuilder.prepare(doc, crypto);
 
             //EncryptedKey
-            WSSecEncryptedKey encrKeyBuilder = new WSSecEncryptedKey();
+            WSSecEncryptedKey encrKeyBuilder = new WSSecEncryptedKey(secHeader);
             encrKeyBuilder.setUserInfo("receiver");
             encrKeyBuilder.setKeyIdentifierType(WSConstants.THUMBPRINT_IDENTIFIER);
             encrKeyBuilder.prepare(doc, crypto);
@@ -151,14 +151,14 @@ public class DerivedKeyTokenTest extends
             String tokenIdentifier = encrKeyBuilder.getId();
 
             //Derived key encryption
-            WSSecDKEncrypt encrBuilder = new WSSecDKEncrypt();
+            WSSecDKEncrypt encrBuilder = new WSSecDKEncrypt(secHeader);
             encrBuilder.setWscVersion(version);
             encrBuilder.setSymmetricEncAlgorithm(WSConstants.TRIPLE_DES);
             encrBuilder.setExternalKey(ek, tokenIdentifier);
-            encrBuilder.build(doc, secHeader);
+            encrBuilder.build(doc);
 
-            encrKeyBuilder.prependToHeader(secHeader);
-            encrKeyBuilder.prependBSTElementToHeader(secHeader);
+            encrKeyBuilder.prependToHeader();
+            encrKeyBuilder.prependBSTElementToHeader();
 
             NodeList nodeList = doc.getElementsByTagNameNS(WSSConstants.TAG_xenc_EncryptedData.getNamespaceURI(), WSSConstants.TAG_xenc_EncryptedData.getLocalPart());
             Assert.assertEquals(nodeList.getLength(), 1);
@@ -336,13 +336,13 @@ public class DerivedKeyTokenTest extends
             WSSecHeader secHeader = new WSSecHeader(doc);
             secHeader.insertSecurityHeader();
 
-            WSSecSecurityContextToken sctBuilder = new WSSecSecurityContextToken();
+            WSSecSecurityContextToken sctBuilder = new WSSecSecurityContextToken(secHeader, null);
             sctBuilder.setWscVersion(version);
             Crypto crypto = CryptoFactory.getInstance("transmitter-crypto.properties");
             sctBuilder.prepare(doc, crypto);
 
             //EncryptedKey
-            WSSecEncryptedKey encrKeyBuilder = new WSSecEncryptedKey();
+            WSSecEncryptedKey encrKeyBuilder = new WSSecEncryptedKey(secHeader);
             encrKeyBuilder.setUserInfo("receiver");
             encrKeyBuilder.setKeyIdentifierType(WSConstants.BST_DIRECT_REFERENCE);
             encrKeyBuilder.prepare(doc, crypto);
@@ -352,14 +352,14 @@ public class DerivedKeyTokenTest extends
             String tokenIdentifier = encrKeyBuilder.getId();
 
             //Derived key encryption
-            WSSecDKEncrypt encrBuilder = new WSSecDKEncrypt();
+            WSSecDKEncrypt encrBuilder = new WSSecDKEncrypt(secHeader);
             encrBuilder.setWscVersion(version);
             encrBuilder.setSymmetricEncAlgorithm(WSConstants.AES_128);
             encrBuilder.setExternalKey(ek, tokenIdentifier);
-            encrBuilder.build(doc, secHeader);
+            encrBuilder.build(doc);
 
-            encrKeyBuilder.prependToHeader(secHeader);
-            encrKeyBuilder.prependBSTElementToHeader(secHeader);
+            encrKeyBuilder.prependToHeader();
+            encrKeyBuilder.prependBSTElementToHeader();
 
             NodeList nodeList = doc.getElementsByTagNameNS(WSSConstants.TAG_xenc_EncryptedData.getNamespaceURI(), WSSConstants.TAG_xenc_EncryptedData.getLocalPart());
             Assert.assertEquals(nodeList.getLength(), 1);
@@ -465,7 +465,7 @@ public class DerivedKeyTokenTest extends
             secHeader.insertSecurityHeader();
 
             //EncryptedKey
-            WSSecEncryptedKey encrKeyBuilder = new WSSecEncryptedKey();
+            WSSecEncryptedKey encrKeyBuilder = new WSSecEncryptedKey(secHeader);
             encrKeyBuilder.setUserInfo("receiver");
             encrKeyBuilder.setKeyIdentifierType(WSConstants.THUMBPRINT_IDENTIFIER);
             Crypto crypto = CryptoFactory.getInstance("transmitter-crypto.properties");
@@ -476,14 +476,14 @@ public class DerivedKeyTokenTest extends
             String tokenIdentifier = encrKeyBuilder.getId();
 
             //Derived key encryption
-            WSSecDKSign sigBuilder = new WSSecDKSign();
+            WSSecDKSign sigBuilder = new WSSecDKSign(secHeader);
             sigBuilder.setWscVersion(version);
             sigBuilder.setExternalKey(ek, tokenIdentifier);
             sigBuilder.setSignatureAlgorithm(WSConstants.HMAC_SHA1);
-            sigBuilder.build(doc, secHeader);
+            sigBuilder.build(doc);
 
-            encrKeyBuilder.prependToHeader(secHeader);
-            encrKeyBuilder.prependBSTElementToHeader(secHeader);
+            encrKeyBuilder.prependToHeader();
+            encrKeyBuilder.prependBSTElementToHeader();
 
             NodeList nodeList = doc.getElementsByTagNameNS(WSSConstants.TAG_dsig_Signature.getNamespaceURI(), WSSConstants.TAG_dsig_Signature.getLocalPart());
             Assert.assertEquals(nodeList.getLength(), 1);
@@ -607,14 +607,14 @@ public class DerivedKeyTokenTest extends
             X509Certificate[] certs = crypto.getX509Certificates(cryptoType);
             secToken.setKeyIdentifierThumb(certs[0]);
 
-            WSSecDKSign sigBuilder = new WSSecDKSign();
+            WSSecDKSign sigBuilder = new WSSecDKSign(secHeader);
             sigBuilder.setWscVersion(version);
             java.security.Key key = crypto.getPrivateKey("transmitter", "default");
             sigBuilder.setExternalKey(key.getEncoded(), secToken.getElement());
             sigBuilder.setSignatureAlgorithm(WSConstants.HMAC_SHA1);
-            sigBuilder.build(doc, secHeader);
+            sigBuilder.build(doc);
 
-            sigBuilder.prependDKElementToHeader(secHeader);
+            sigBuilder.prependDKElementToHeader();
 
             NodeList nodeList = doc.getElementsByTagNameNS(WSSConstants.TAG_dsig_Signature.getNamespaceURI(), WSSConstants.TAG_dsig_Signature.getLocalPart());
             Assert.assertEquals(nodeList.getLength(), 1);
@@ -738,14 +738,14 @@ public class DerivedKeyTokenTest extends
             X509Certificate[] certs = crypto.getX509Certificates(cryptoType);
             secToken.setKeyIdentifierSKI(certs[0], crypto);
 
-            WSSecDKSign sigBuilder = new WSSecDKSign();
+            WSSecDKSign sigBuilder = new WSSecDKSign(secHeader);
             sigBuilder.setWscVersion(version);
             java.security.Key key = crypto.getPrivateKey("transmitter", "default");
             sigBuilder.setExternalKey(key.getEncoded(), secToken.getElement());
             sigBuilder.setSignatureAlgorithm(WSConstants.HMAC_SHA1);
-            sigBuilder.build(doc, secHeader);
+            sigBuilder.build(doc);
 
-            sigBuilder.prependDKElementToHeader(secHeader);
+            sigBuilder.prependDKElementToHeader();
 
             NodeList nodeList = doc.getElementsByTagNameNS(WSSConstants.TAG_dsig_Signature.getNamespaceURI(), WSSConstants.TAG_dsig_Signature.getLocalPart());
             Assert.assertEquals(nodeList.getLength(), 1);
@@ -864,7 +864,7 @@ public class DerivedKeyTokenTest extends
             Crypto crypto = CryptoFactory.getInstance("transmitter-crypto.properties");
 
             //EncryptedKey
-            WSSecEncryptedKey encrKeyBuilder = new WSSecEncryptedKey();
+            WSSecEncryptedKey encrKeyBuilder = new WSSecEncryptedKey(secHeader);
             encrKeyBuilder.setUserInfo("receiver");
             encrKeyBuilder.setKeyIdentifierType(WSConstants.THUMBPRINT_IDENTIFIER);
             encrKeyBuilder.prepare(doc, crypto);
@@ -874,21 +874,21 @@ public class DerivedKeyTokenTest extends
             String tokenIdentifier = encrKeyBuilder.getId();
 
             //Derived key encryption
-            WSSecDKSign sigBuilder = new WSSecDKSign();
+            WSSecDKSign sigBuilder = new WSSecDKSign(secHeader);
             sigBuilder.setWscVersion(version);
             sigBuilder.setExternalKey(ek, tokenIdentifier);
             sigBuilder.setSignatureAlgorithm(WSConstants.HMAC_SHA1);
-            Document signedDoc = sigBuilder.build(doc, secHeader);
+            Document signedDoc = sigBuilder.build(doc);
 
             //Derived key signature
-            WSSecDKEncrypt encrBuilder = new WSSecDKEncrypt();
+            WSSecDKEncrypt encrBuilder = new WSSecDKEncrypt(secHeader);
             encrBuilder.setWscVersion(version);
             encrBuilder.setSymmetricEncAlgorithm(WSConstants.AES_128);
             encrBuilder.setExternalKey(ek, tokenIdentifier);
-            encrBuilder.build(signedDoc, secHeader);
+            encrBuilder.build(signedDoc);
 
-            encrKeyBuilder.prependToHeader(secHeader);
-            encrKeyBuilder.prependBSTElementToHeader(secHeader);
+            encrKeyBuilder.prependToHeader();
+            encrKeyBuilder.prependBSTElementToHeader();
 
             NodeList nodeList = doc.getElementsByTagNameNS(WSSConstants.TAG_dsig_Signature.getNamespaceURI(), WSSConstants.TAG_dsig_Signature.getLocalPart());
             Assert.assertEquals(nodeList.getLength(), 1);
@@ -987,7 +987,7 @@ public class DerivedKeyTokenTest extends
             Crypto crypto = CryptoFactory.getInstance("transmitter-crypto.properties");
 
             //EncryptedKey
-            WSSecEncryptedKey encrKeyBuilder = new WSSecEncryptedKey();
+            WSSecEncryptedKey encrKeyBuilder = new WSSecEncryptedKey(secHeader);
             encrKeyBuilder.setUserInfo("receiver");
             encrKeyBuilder.setKeyIdentifierType(WSConstants.THUMBPRINT_IDENTIFIER);
             encrKeyBuilder.prepare(doc, crypto);
@@ -997,21 +997,21 @@ public class DerivedKeyTokenTest extends
             String tokenIdentifier = encrKeyBuilder.getId();
 
             //Derived key signature
-            WSSecDKEncrypt encrBuilder = new WSSecDKEncrypt();
+            WSSecDKEncrypt encrBuilder = new WSSecDKEncrypt(secHeader);
             encrBuilder.setWscVersion(version);
             encrBuilder.setSymmetricEncAlgorithm(WSConstants.AES_128);
             encrBuilder.setExternalKey(ek, tokenIdentifier);
-            encrBuilder.build(doc, secHeader);
+            encrBuilder.build(doc);
 
             //Derived key encryption
-            WSSecDKSign sigBuilder = new WSSecDKSign();
+            WSSecDKSign sigBuilder = new WSSecDKSign(secHeader);
             sigBuilder.setWscVersion(version);
             sigBuilder.setExternalKey(ek, tokenIdentifier);
             sigBuilder.setSignatureAlgorithm(WSConstants.HMAC_SHA1);
-            sigBuilder.build(doc, secHeader);
+            sigBuilder.build(doc);
 
-            encrKeyBuilder.prependToHeader(secHeader);
-            encrKeyBuilder.prependBSTElementToHeader(secHeader);
+            encrKeyBuilder.prependToHeader();
+            encrKeyBuilder.prependBSTElementToHeader();
 
             NodeList nodeList = doc.getElementsByTagNameNS(WSSConstants.TAG_dsig_Signature.getNamespaceURI(), WSSConstants.TAG_dsig_Signature.getLocalPart());
             Assert.assertEquals(nodeList.getLength(), 1);

Modified: webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/EncDecryptionTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/EncDecryptionTest.java?rev=1771307&r1=1771306&r2=1771307&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/EncDecryptionTest.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/EncDecryptionTest.java Fri Nov 25 12:30:49 2016
@@ -1568,11 +1568,11 @@ public class EncDecryptionTest extends A
             WSSecHeader secHeader = new WSSecHeader(doc);
             secHeader.insertSecurityHeader();
 
-            WSSecEncrypt builder = new WSSecEncrypt();
+            WSSecEncrypt builder = new WSSecEncrypt(secHeader);
             builder.setKeyIdentifierType(WSConstants.ENCRYPTED_KEY_SHA1_IDENTIFIER);
             builder.setSymmetricKey(key);
             builder.setEncryptSymmKey(false);
-            Document securedDocument = builder.build(doc, null, secHeader);
+            Document securedDocument = builder.build(doc, null);
 
             XPathExpression xPathExpression = getXPath("/soap:Envelope/soap:Body/xenc:EncryptedData/dsig:KeyInfo/wsse:SecurityTokenReference/wsse:KeyIdentifier[@ValueType='http://docs.oasis-open.org/wss/oasis-wss-soap-message-security-1.1#EncryptedKeySHA1']");
             Node node = (Node) xPathExpression.evaluate(securedDocument, XPathConstants.NODE);
@@ -2560,10 +2560,10 @@ public class EncDecryptionTest extends A
 
             WSSecHeader secHeader = new WSSecHeader(doc);
             secHeader.insertSecurityHeader();
-            Element securityHeaderElement = secHeader.getSecurityHeader();
+            Element securityHeaderElement = secHeader.getSecurityHeaderElement();
             securityHeaderElement.appendChild(doc.getElementsByTagNameNS("http://schemas.xmlsoap.org/wsdl/", "definitions").item(0));
 
-            WSSecEncrypt builder = new WSSecEncrypt();
+            WSSecEncrypt builder = new WSSecEncrypt(secHeader);
             builder.setKeyIdentifierType(WSConstants.THUMBPRINT_IDENTIFIER);
             builder.setUserInfo("receiver");
             Crypto crypto = CryptoFactory.getInstance("transmitter-crypto.properties");
@@ -2574,8 +2574,8 @@ public class EncDecryptionTest extends A
             encryptionParts.add(encP);
             Element ref = builder.encryptForRef(null, encryptionParts);
             ref.removeChild(ref.getElementsByTagNameNS("http://www.w3.org/2001/04/xmlenc#", "DataReference").item(0));
-            builder.addExternalRefElement(ref, secHeader);
-            builder.prependToHeader(secHeader);
+            builder.addExternalRefElement(ref);
+            builder.prependToHeader();
 
             Transformer transformer = TRANSFORMER_FACTORY.newTransformer();
             transformer.transform(new DOMSource(doc), new StreamResult(baos));
@@ -2604,10 +2604,10 @@ public class EncDecryptionTest extends A
 
             WSSecHeader secHeader = new WSSecHeader(doc);
             secHeader.insertSecurityHeader();
-            Element securityHeaderElement = secHeader.getSecurityHeader();
+            Element securityHeaderElement = secHeader.getSecurityHeaderElement();
             securityHeaderElement.appendChild(doc.getElementsByTagNameNS("http://schemas.xmlsoap.org/wsdl/", "definitions").item(0));
 
-            WSSecEncrypt builder = new WSSecEncrypt();
+            WSSecEncrypt builder = new WSSecEncrypt(secHeader);
             builder.setKeyIdentifierType(WSConstants.THUMBPRINT_IDENTIFIER);
             builder.setUserInfo("receiver");
             Crypto crypto = CryptoFactory.getInstance("transmitter-crypto.properties");
@@ -2617,8 +2617,8 @@ public class EncDecryptionTest extends A
             List<WSEncryptionPart> encryptionParts = new ArrayList<WSEncryptionPart>();
             encryptionParts.add(encP);
             Element ref = builder.encryptForRef(null, encryptionParts);
-            builder.addExternalRefElement(ref, secHeader);
-            builder.prependToHeader(secHeader);
+            builder.addExternalRefElement(ref);
+            builder.prependToHeader();
 
             Transformer transformer = TRANSFORMER_FACTORY.newTransformer();
             transformer.transform(new DOMSource(doc), new StreamResult(baos));
@@ -2647,10 +2647,10 @@ public class EncDecryptionTest extends A
 
             WSSecHeader secHeader = new WSSecHeader(doc);
             secHeader.insertSecurityHeader();
-            Element securityHeaderElement = secHeader.getSecurityHeader();
+            Element securityHeaderElement = secHeader.getSecurityHeaderElement();
             securityHeaderElement.appendChild(doc.getElementsByTagNameNS("http://schemas.xmlsoap.org/wsdl/", "definitions").item(0));
 
-            WSSecEncrypt builder = new WSSecEncrypt();
+            WSSecEncrypt builder = new WSSecEncrypt(secHeader);
             builder.setKeyIdentifierType(WSConstants.THUMBPRINT_IDENTIFIER);
             builder.setUserInfo("receiver");
             Crypto crypto = CryptoFactory.getInstance("transmitter-crypto.properties");
@@ -2660,7 +2660,7 @@ public class EncDecryptionTest extends A
             List<WSEncryptionPart> encryptionParts = new ArrayList<WSEncryptionPart>();
             encryptionParts.add(encP);
             Element ref = builder.encryptForRef(null, encryptionParts);
-            builder.prependToHeader(secHeader);
+            builder.prependToHeader();
             //builder.addExternalRefElement(ref, secHeader);
             securityHeaderElement.appendChild(ref);
 

Modified: webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/SecurityContextTokenTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/SecurityContextTokenTest.java?rev=1771307&r1=1771306&r2=1771307&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/SecurityContextTokenTest.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/SecurityContextTokenTest.java Fri Nov 25 12:30:49 2016
@@ -146,7 +146,7 @@ public class SecurityContextTokenTest ex
             WSSecHeader secHeader = new WSSecHeader(doc);
             secHeader.insertSecurityHeader();
 
-            WSSecSecurityContextToken sctBuilder = new WSSecSecurityContextToken();
+            WSSecSecurityContextToken sctBuilder = new WSSecSecurityContextToken(secHeader, null);
             sctBuilder.setWscVersion(version);
             Crypto crypto = CryptoFactory.getInstance("transmitter-crypto.properties");
             sctBuilder.prepare(doc, crypto);
@@ -158,13 +158,13 @@ public class SecurityContextTokenTest ex
             String tokenId = sctBuilder.getSctId();
 
             // Derived key encryption
-            WSSecDKEncrypt encrBuilder = new WSSecDKEncrypt();
+            WSSecDKEncrypt encrBuilder = new WSSecDKEncrypt(secHeader);
             encrBuilder.setWscVersion(version);
             encrBuilder.setSymmetricEncAlgorithm(WSConstants.AES_128);
             encrBuilder.setExternalKey(tempSecret, tokenId);
-            encrBuilder.build(doc, secHeader);
+            encrBuilder.build(doc);
 
-            sctBuilder.prependSCTElementToHeader(doc, secHeader);
+            sctBuilder.prependSCTElementToHeader(doc);
 
             javax.xml.transform.Transformer transformer = TRANSFORMER_FACTORY.newTransformer();
             transformer.transform(new DOMSource(doc), new StreamResult(baos));
@@ -356,7 +356,7 @@ public class SecurityContextTokenTest ex
             WSSecHeader secHeader = new WSSecHeader(doc);
             secHeader.insertSecurityHeader();
 
-            WSSecSecurityContextToken sctBuilder = new WSSecSecurityContextToken();
+            WSSecSecurityContextToken sctBuilder = new WSSecSecurityContextToken(secHeader, null);
             sctBuilder.setWscVersion(version);
             Crypto crypto = CryptoFactory.getInstance("transmitter-crypto.properties");
             sctBuilder.prepare(doc, crypto);
@@ -368,13 +368,13 @@ public class SecurityContextTokenTest ex
             String tokenId = sctBuilder.getSctId();
 
             // Derived key signature
-            WSSecDKSign sigBuilder = new WSSecDKSign();
+            WSSecDKSign sigBuilder = new WSSecDKSign(secHeader);
             sigBuilder.setWscVersion(version);
             sigBuilder.setExternalKey(tempSecret, tokenId);
             sigBuilder.setSignatureAlgorithm(WSConstants.HMAC_SHA1);
-            sigBuilder.build(doc, secHeader);
+            sigBuilder.build(doc);
 
-            sctBuilder.prependSCTElementToHeader(doc, secHeader);
+            sctBuilder.prependSCTElementToHeader(doc);
 
             javax.xml.transform.Transformer transformer = TRANSFORMER_FACTORY.newTransformer();
             transformer.transform(new DOMSource(doc), new StreamResult(baos));
@@ -539,7 +539,7 @@ public class SecurityContextTokenTest ex
             WSSecHeader secHeader = new WSSecHeader(doc);
             secHeader.insertSecurityHeader();
 
-            WSSecSecurityContextToken sctBuilder = new WSSecSecurityContextToken();
+            WSSecSecurityContextToken sctBuilder = new WSSecSecurityContextToken(secHeader, null);
             sctBuilder.setWscVersion(version);
             Crypto crypto = CryptoFactory.getInstance("transmitter-crypto.properties");
             sctBuilder.prepare(doc, crypto);
@@ -549,14 +549,14 @@ public class SecurityContextTokenTest ex
             callbackHandler.addSecretKey(sctBuilder.getIdentifier(), tempSecret);
 
             // Derived key signature
-            WSSecDKSign sigBuilder = new WSSecDKSign();
+            WSSecDKSign sigBuilder = new WSSecDKSign(secHeader);
             sigBuilder.setWscVersion(version);
             sigBuilder.setExternalKey(tempSecret, sctBuilder.getIdentifier());
             sigBuilder.setTokenIdDirectId(true);
             sigBuilder.setSignatureAlgorithm(WSConstants.HMAC_SHA1);
-            sigBuilder.build(doc, secHeader);
+            sigBuilder.build(doc);
 
-            sctBuilder.prependSCTElementToHeader(doc, secHeader);
+            sctBuilder.prependSCTElementToHeader(doc);
 
             javax.xml.transform.Transformer transformer = TRANSFORMER_FACTORY.newTransformer();
             transformer.transform(new DOMSource(doc), new StreamResult(baos));
@@ -586,7 +586,7 @@ public class SecurityContextTokenTest ex
             WSSecHeader secHeader = new WSSecHeader(doc);
             secHeader.insertSecurityHeader();
 
-            WSSecSecurityContextToken sctBuilder = new WSSecSecurityContextToken();
+            WSSecSecurityContextToken sctBuilder = new WSSecSecurityContextToken(secHeader, null);
             sctBuilder.setWscVersion(version);
             Crypto crypto = CryptoFactory.getInstance("transmitter-crypto.properties");
             sctBuilder.prepare(doc, crypto);
@@ -598,7 +598,7 @@ public class SecurityContextTokenTest ex
             String tokenId = sctBuilder.getSctId();
 
             // Derived key signature
-            WSSecDKSign sigBuilder = new WSSecDKSign();
+            WSSecDKSign sigBuilder = new WSSecDKSign(secHeader);
             sigBuilder.setWscVersion(version);
             if (version == ConversationConstants.VERSION_05_12) {
                 sigBuilder.setCustomValueType(WSConstants.WSC_SCT_05_12);
@@ -607,10 +607,10 @@ public class SecurityContextTokenTest ex
             }
             sigBuilder.setExternalKey(tempSecret, tokenId);
             sigBuilder.setSignatureAlgorithm(WSConstants.HMAC_SHA1);
-            sigBuilder.build(doc, secHeader);
+            sigBuilder.build(doc);
 
             // Derived key encryption
-            WSSecDKEncrypt encrBuilder = new WSSecDKEncrypt();
+            WSSecDKEncrypt encrBuilder = new WSSecDKEncrypt(secHeader);
             encrBuilder.setWscVersion(version);
             if (version == ConversationConstants.VERSION_05_12) {
                 encrBuilder.setCustomValueType(WSConstants.WSC_SCT_05_12);
@@ -619,9 +619,9 @@ public class SecurityContextTokenTest ex
             }
             encrBuilder.setSymmetricEncAlgorithm(WSConstants.AES_128);
             encrBuilder.setExternalKey(tempSecret, tokenId);
-            encrBuilder.build(doc, secHeader);
+            encrBuilder.build(doc);
 
-            sctBuilder.prependSCTElementToHeader(doc, secHeader);
+            sctBuilder.prependSCTElementToHeader(doc);
 
             javax.xml.transform.Transformer transformer = TRANSFORMER_FACTORY.newTransformer();
             transformer.transform(new DOMSource(doc), new StreamResult(baos));
@@ -809,7 +809,7 @@ public class SecurityContextTokenTest ex
             WSSecHeader secHeader = new WSSecHeader(doc);
             secHeader.insertSecurityHeader();
 
-            WSSecSecurityContextToken sctBuilder = new WSSecSecurityContextToken();
+            WSSecSecurityContextToken sctBuilder = new WSSecSecurityContextToken(secHeader, null);
             sctBuilder.setWscVersion(version);
             Crypto crypto = CryptoFactory.getInstance("transmitter-crypto.properties");
             sctBuilder.prepare(doc, crypto);
@@ -821,7 +821,7 @@ public class SecurityContextTokenTest ex
             String tokenId = sctBuilder.getSctId();
 
             // Derived key encryption
-            WSSecDKEncrypt encrBuilder = new WSSecDKEncrypt();
+            WSSecDKEncrypt encrBuilder = new WSSecDKEncrypt(secHeader);
             encrBuilder.setWscVersion(version);
             if (version == ConversationConstants.VERSION_05_12) {
                 encrBuilder.setCustomValueType(WSConstants.WSC_SCT_05_12);
@@ -830,10 +830,10 @@ public class SecurityContextTokenTest ex
             }
             encrBuilder.setSymmetricEncAlgorithm(WSConstants.AES_128);
             encrBuilder.setExternalKey(tempSecret, tokenId);
-            encrBuilder.build(doc, secHeader);
+            encrBuilder.build(doc);
 
             // Derived key signature
-            WSSecDKSign sigBuilder = new WSSecDKSign();
+            WSSecDKSign sigBuilder = new WSSecDKSign(secHeader);
             sigBuilder.setWscVersion(version);
             if (version == ConversationConstants.VERSION_05_12) {
                 sigBuilder.setCustomValueType(WSConstants.WSC_SCT_05_12);
@@ -842,9 +842,9 @@ public class SecurityContextTokenTest ex
             }
             sigBuilder.setExternalKey(tempSecret, tokenId);
             sigBuilder.setSignatureAlgorithm(WSConstants.HMAC_SHA1);
-            sigBuilder.build(doc, secHeader);
+            sigBuilder.build(doc);
 
-            sctBuilder.prependSCTElementToHeader(doc, secHeader);
+            sctBuilder.prependSCTElementToHeader(doc);
 
             javax.xml.transform.Transformer transformer = TRANSFORMER_FACTORY.newTransformer();
             transformer.transform(new DOMSource(doc), new StreamResult(baos));
@@ -1033,7 +1033,7 @@ public class SecurityContextTokenTest ex
             WSSecHeader secHeader = new WSSecHeader(doc);
             secHeader.insertSecurityHeader();
 
-            WSSecSecurityContextToken sctBuilder = new WSSecSecurityContextToken();
+            WSSecSecurityContextToken sctBuilder = new WSSecSecurityContextToken(secHeader, null);
             sctBuilder.setWscVersion(version);
             Crypto crypto = CryptoFactory.getInstance("transmitter-crypto.properties");
             sctBuilder.prepare(doc, crypto);
@@ -1044,15 +1044,15 @@ public class SecurityContextTokenTest ex
 
             String tokenId = sctBuilder.getSctId();
 
-            WSSecSignature builder = new WSSecSignature();
+            WSSecSignature builder = new WSSecSignature(secHeader);
             builder.setSecretKey(tempSecret);
             builder.setKeyIdentifierType(WSConstants.CUSTOM_SYMM_SIGNING);
             builder.setCustomTokenValueType(WSConstants.WSC_SCT);
             builder.setCustomTokenId(tokenId);
             builder.setSignatureAlgorithm(SignatureMethod.HMAC_SHA1);
-            builder.build(doc, crypto, secHeader);
+            builder.build(doc, crypto);
 
-            sctBuilder.prependSCTElementToHeader(doc, secHeader);
+            sctBuilder.prependSCTElementToHeader(doc);
 
             javax.xml.transform.Transformer transformer = TRANSFORMER_FACTORY.newTransformer();
             transformer.transform(new DOMSource(doc), new StreamResult(baos));

Modified: webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/SignatureEncryptionTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/SignatureEncryptionTest.java?rev=1771307&r1=1771306&r2=1771307&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/SignatureEncryptionTest.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/SignatureEncryptionTest.java Fri Nov 25 12:30:49 2016
@@ -392,15 +392,15 @@ public class SignatureEncryptionTest ext
             WSSecHeader secHeader = new WSSecHeader(doc);
             secHeader.insertSecurityHeader();
 
-            WSSecSignature sign = new WSSecSignature();
+            WSSecSignature sign = new WSSecSignature(secHeader);
             sign.setUserInfo("transmitter", "default");
             sign.setKeyIdentifierType(WSConstants.BST_DIRECT_REFERENCE);
 
             Crypto crypto = CryptoFactory.getInstance("transmitter-crypto.properties");
 
-            sign.build(doc, crypto, secHeader);
+            sign.build(doc, crypto);
 
-            WSSecEncrypt builder = new WSSecEncrypt();
+            WSSecEncrypt builder = new WSSecEncrypt(secHeader);
             builder.setKeyIdentifierType(WSConstants.THUMBPRINT_IDENTIFIER);
             builder.setUserInfo("receiver");
             builder.prepare(doc, crypto);
@@ -412,8 +412,8 @@ public class SignatureEncryptionTest ext
             encryptionParts.add(def);
             Element ref = builder.encryptForRef(null, encryptionParts);
             ref.removeChild(ref.getElementsByTagNameNS("http://www.w3.org/2001/04/xmlenc#", "DataReference").item(0));
-            builder.addExternalRefElement(ref, secHeader);
-            builder.prependToHeader(secHeader);
+            builder.addExternalRefElement(ref);
+            builder.prependToHeader();
 
             javax.xml.transform.Transformer transformer = TRANSFORMER_FACTORY.newTransformer();
             transformer.transform(new DOMSource(doc), new StreamResult(baos));

Modified: webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/SignatureTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/SignatureTest.java?rev=1771307&r1=1771306&r2=1771307&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/SignatureTest.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/SignatureTest.java Fri Nov 25 12:30:49 2016
@@ -1164,12 +1164,12 @@ public class SignatureTest extends Abstr
             WSSecHeader secHeader = new WSSecHeader(doc);
             secHeader.insertSecurityHeader();
 
-            WSSecSignature sign = new WSSecSignature();
+            WSSecSignature sign = new WSSecSignature(secHeader);
             sign.setKeyIdentifierType(WSConstants.ENCRYPTED_KEY_SHA1_IDENTIFIER);
             sign.setSecretKey(key.getEncoded());
             sign.setSignatureAlgorithm(SignatureMethod.HMAC_SHA1);
 
-            Document securedDocument = sign.build(doc, null, secHeader);
+            Document securedDocument = sign.build(doc, null);
 
             //some test that we can really sure we get what we want from WSS4J
             XPathExpression xPathExpression =

Modified: webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/XOPAttachmentTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/XOPAttachmentTest.java?rev=1771307&r1=1771306&r2=1771307&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/XOPAttachmentTest.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/XOPAttachmentTest.java Fri Nov 25 12:30:49 2016
@@ -113,12 +113,12 @@ public class XOPAttachmentTest extends A
     }
 
     private List<Attachment> createEncryptedBodyInAttachment(Document doc) throws Exception {
-        WSSecEncrypt encrypt = new WSSecEncrypt();
-        encrypt.setUserInfo("receiver", "default");
-        encrypt.setKeyIdentifierType(WSConstants.ISSUER_SERIAL);
-
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
+        
+        WSSecEncrypt encrypt = new WSSecEncrypt(secHeader);
+        encrypt.setUserInfo("receiver", "default");
+        encrypt.setKeyIdentifierType(WSConstants.ISSUER_SERIAL);
 
         encrypt.getParts().add(new WSEncryptionPart("Body", "http://schemas.xmlsoap.org/soap/envelope/", "Content"));
         encrypt.getParts().add(new WSEncryptionPart("cid:Attachments", "Content"));
@@ -138,7 +138,7 @@ public class XOPAttachmentTest extends A
         sigProperties.setProperty("org.apache.wss4j.crypto.merlin.keystore.file", "transmitter.jks");
         sigProperties.setProperty("org.apache.wss4j.crypto.merlin.keystore.password", "default");
         Crypto crypto = new Merlin(sigProperties, this.getClass().getClassLoader(), null);
-        Document encryptedDoc = encrypt.build(doc, crypto, secHeader);
+        Document encryptedDoc = encrypt.build(doc, crypto);
 
         // Find the SOAP Body + replace with a xop:Include to the attachment!
         Element soapBody = WSSecurityUtil.findBodyElement(encryptedDoc);

Modified: webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLCallbackHandlerImpl.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLCallbackHandlerImpl.java?rev=1771307&r1=1771306&r2=1771307&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLCallbackHandlerImpl.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLCallbackHandlerImpl.java Fri Nov 25 12:30:49 2016
@@ -198,7 +198,7 @@ public class SAMLCallbackHandlerImpl imp
             Document doc = docBuilder.newDocument();
 
             // Create an Encrypted Key
-            WSSecEncryptedKey encrKey = new WSSecEncryptedKey();
+            WSSecEncryptedKey encrKey = new WSSecEncryptedKey(null);
             encrKey.setKeyIdentifierType(WSConstants.ISSUER_SERIAL);
             encrKey.setUseThisCert(certs[0]);
             encrKey.prepare(doc, null);

Modified: webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLTokenHOKTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLTokenHOKTest.java?rev=1771307&r1=1771306&r2=1771307&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLTokenHOKTest.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLTokenHOKTest.java Fri Nov 25 12:30:49 2016
@@ -483,13 +483,13 @@ public class SAMLTokenHOKTest extends Ab
             Crypto crypto = CryptoFactory.getInstance("saml/saml-signed.properties");
             samlAssertion.signAssertion("transmitter", "default", crypto, false);
 
-            WSSecSAMLToken wsSign = new WSSecSAMLToken();
-
             Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
             WSSecHeader secHeader = new WSSecHeader(doc);
             secHeader.insertSecurityHeader();
+            
+            WSSecSAMLToken wsSign = new WSSecSAMLToken(secHeader);
 
-            Document securedDocument = wsSign.build(doc, samlAssertion, secHeader);
+            Document securedDocument = wsSign.build(doc, samlAssertion);
 
             //some test that we can really sure we get what we want from WSS4J
             NodeList nodeList = securedDocument.getElementsByTagNameNS(WSSConstants.TAG_dsig_Signature.getNamespaceURI(), WSSConstants.TAG_dsig_Signature.getLocalPart());
@@ -983,13 +983,13 @@ public class SAMLTokenHOKTest extends Ab
             Crypto crypto = CryptoFactory.getInstance("saml/saml-signed.properties");
             samlAssertion.signAssertion("transmitter", "default", crypto, false);
 
-            WSSecSAMLToken wsSign = new WSSecSAMLToken();
-
             Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
             WSSecHeader secHeader = new WSSecHeader(doc);
             secHeader.insertSecurityHeader();
+            
+            WSSecSAMLToken wsSign = new WSSecSAMLToken(secHeader);
 
-            Document securedDocument = wsSign.build(doc, samlAssertion, secHeader);
+            Document securedDocument = wsSign.build(doc, samlAssertion);
 
             //some test that we can really sure we get what we want from WSS4J
             NodeList nodeList = securedDocument.getElementsByTagNameNS(WSSConstants.TAG_dsig_Signature.getNamespaceURI(), WSSConstants.TAG_dsig_Signature.getLocalPart());




Mime
View raw message