ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gi...@apache.org
Subject svn commit: r1311068 - in /webservices/wss4j/branches/swssf: streaming-ws-security/src/main/java/org/swssf/wss/ext/ streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/ streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/ stre...
Date Sun, 08 Apr 2012 18:42:35 GMT
Author: giger
Date: Sun Apr  8 18:42:34 2012
New Revision: 1311068

URL: http://svn.apache.org/viewvc?rev=1311068&view=rev
Log:
Refactoring: Use interface to initialize output-processors and not the constructor

Modified:
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/OutboundWSSec.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/BinarySecurityTokenOutputProcessor.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/DerivedKeyTokenOutputProcessor.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/EncryptEndingOutputProcessor.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/EncryptOutputProcessor.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/EncryptedKeyOutputProcessor.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/SAMLTokenOutputProcessor.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/SecurityContextTokenOutputProcessor.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/SecurityHeaderOutputProcessor.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/SignatureConfirmationOutputProcessor.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/SignatureEndingOutputProcessor.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/SignatureOutputProcessor.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/TimestampOutputProcessor.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/UsernameTokenOutputProcessor.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/AbstractBufferingOutputProcessor.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/AbstractOutputProcessor.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/OutputProcessor.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/AbstractEncryptEndingOutputProcessor.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/AbstractEncryptOutputProcessor.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/AbstractSignatureEndingOutputProcessor.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/AbstractSignatureOutputProcessor.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/FinalOutputProcessor.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/OutputProcessorChainTest.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/XMLSecurityStreamWriterTest.java

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/OutboundWSSec.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/OutboundWSSec.java?rev=1311068&r1=1311067&r2=1311068&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/OutboundWSSec.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/OutboundWSSec.java Sun Apr  8 18:42:34 2012
@@ -23,6 +23,7 @@ import org.swssf.wss.impl.WSSecurityCont
 import org.swssf.wss.impl.processor.output.*;
 import org.swssf.wss.securityEvent.SecurityEvent;
 import org.swssf.wss.securityEvent.SecurityEventListener;
+import org.swssf.xmlsec.ext.OutputProcessor;
 import org.swssf.xmlsec.ext.XMLSecurityConstants;
 import org.swssf.xmlsec.ext.XMLSecurityException;
 import org.swssf.xmlsec.impl.OutputProcessorChainImpl;
@@ -103,89 +104,121 @@ public class OutboundWSSec {
         final WSSDocumentContextImpl documentContext = new WSSDocumentContextImpl();
         documentContext.setEncoding(encoding);
 
-        OutputProcessorChainImpl processorChain = new OutputProcessorChainImpl(securityContextImpl, documentContext);
+        OutputProcessorChainImpl outputProcessorChain = new OutputProcessorChainImpl(securityContextImpl, documentContext);
 
         try {
-            processorChain.addProcessor(new SecurityHeaderOutputProcessor(securityProperties, null));
+            final SecurityHeaderOutputProcessor securityHeaderOutputProcessor = new SecurityHeaderOutputProcessor();
+            initializeOutputProcessor(outputProcessorChain, securityHeaderOutputProcessor, null);
             //todo some combinations are not possible atm: eg Action.SIGNATURE and Action.USERNAMETOKEN_SIGNED
             //todo they use the same signaure parts
             for (int i = 0; i < securityProperties.getOutAction().length; i++) {
                 XMLSecurityConstants.Action action = securityProperties.getOutAction()[i];
                 if (action.equals(WSSConstants.TIMESTAMP)) {
-                    processorChain.addProcessor(new TimestampOutputProcessor(securityProperties, action));
+                    final TimestampOutputProcessor timestampOutputProcessor = new TimestampOutputProcessor();
+                    initializeOutputProcessor(outputProcessorChain, timestampOutputProcessor, action);
+
                 } else if (action.equals(WSSConstants.SIGNATURE)) {
-                    processorChain.addProcessor(new BinarySecurityTokenOutputProcessor(securityProperties, action));
-                    SignatureOutputProcessor signatureOutputProcessor = new SignatureOutputProcessor(securityProperties, action);
-                    processorChain.addProcessor(signatureOutputProcessor);
-                    SignatureEndingOutputProcessor signatureEndingOutputProcessor = new SignatureEndingOutputProcessor(securityProperties, action, signatureOutputProcessor);
-                    signatureEndingOutputProcessor.getAfterProcessors().add(UsernameTokenOutputProcessor.class.getName());
-                    processorChain.addProcessor(signatureEndingOutputProcessor);
+                    final BinarySecurityTokenOutputProcessor binarySecurityTokenOutputProcessor = new BinarySecurityTokenOutputProcessor();
+                    initializeOutputProcessor(outputProcessorChain, binarySecurityTokenOutputProcessor, action);
+
+                    SignatureOutputProcessor signatureOutputProcessor = new SignatureOutputProcessor();
+                    initializeOutputProcessor(outputProcessorChain, signatureOutputProcessor, action);
+
                 } else if (action.equals(WSSConstants.ENCRYPT)) {
-                    processorChain.addProcessor(new BinarySecurityTokenOutputProcessor(securityProperties, action));
-                    processorChain.addProcessor(new EncryptedKeyOutputProcessor(securityProperties, action));
-                    processorChain.addProcessor(new EncryptOutputProcessor(securityProperties, action));
-                    org.swssf.wss.impl.processor.output.EncryptEndingOutputProcessor encryptEndingOutputProcessor = new org.swssf.wss.impl.processor.output.EncryptEndingOutputProcessor(securityProperties, action);
-                    encryptEndingOutputProcessor.getAfterProcessors().add(UsernameTokenOutputProcessor.class.getName());
-                    processorChain.addProcessor(encryptEndingOutputProcessor);
+                    final BinarySecurityTokenOutputProcessor binarySecurityTokenOutputProcessor = new BinarySecurityTokenOutputProcessor();
+                    initializeOutputProcessor(outputProcessorChain, binarySecurityTokenOutputProcessor, action);
+
+                    final EncryptedKeyOutputProcessor encryptedKeyOutputProcessor = new EncryptedKeyOutputProcessor();
+                    initializeOutputProcessor(outputProcessorChain, encryptedKeyOutputProcessor, action);
+
+                    final EncryptOutputProcessor encryptOutputProcessor = new EncryptOutputProcessor();
+                    initializeOutputProcessor(outputProcessorChain, encryptOutputProcessor, action);
+
                 } else if (action.equals(WSSConstants.USERNAMETOKEN)) {
-                    UsernameTokenOutputProcessor usernameTokenOutputProcessor = new UsernameTokenOutputProcessor(securityProperties, action);
-                    processorChain.addProcessor(usernameTokenOutputProcessor);
+                    UsernameTokenOutputProcessor usernameTokenOutputProcessor = new UsernameTokenOutputProcessor();
+                    initializeOutputProcessor(outputProcessorChain, usernameTokenOutputProcessor, action);
+
                 } else if (action.equals(WSSConstants.USERNAMETOKEN_SIGNED)) {
-                    processorChain.addProcessor(new UsernameTokenOutputProcessor(securityProperties, action));
-                    SignatureOutputProcessor signatureOutputProcessor = new SignatureOutputProcessor(securityProperties, action);
-                    processorChain.addProcessor(signatureOutputProcessor);
-                    SignatureEndingOutputProcessor signatureEndingOutputProcessor = new SignatureEndingOutputProcessor(securityProperties, action, signatureOutputProcessor);
-                    signatureEndingOutputProcessor.getAfterProcessors().add(UsernameTokenOutputProcessor.class.getName());
-                    processorChain.addProcessor(signatureEndingOutputProcessor);
+                    final UsernameTokenOutputProcessor usernameTokenOutputProcessor = new UsernameTokenOutputProcessor();
+                    initializeOutputProcessor(outputProcessorChain, usernameTokenOutputProcessor, action);
+
+                    SignatureOutputProcessor signatureOutputProcessor = new SignatureOutputProcessor();
+                    initializeOutputProcessor(outputProcessorChain, signatureOutputProcessor, action);
+
                 } else if (action.equals(WSSConstants.SIGNATURE_CONFIRMATION)) {
-                    SignatureConfirmationOutputProcessor signatureConfirmationOutputProcessor = new SignatureConfirmationOutputProcessor(securityProperties, action);
-                    processorChain.addProcessor(signatureConfirmationOutputProcessor);
+                    SignatureConfirmationOutputProcessor signatureConfirmationOutputProcessor = new SignatureConfirmationOutputProcessor();
+                    initializeOutputProcessor(outputProcessorChain, signatureConfirmationOutputProcessor, action);
+
                 } else if (action.equals(WSSConstants.SIGNATURE_WITH_DERIVED_KEY)) {
-                    processorChain.addProcessor(new BinarySecurityTokenOutputProcessor(securityProperties, action));
+                    BinarySecurityTokenOutputProcessor binarySecurityTokenOutputProcessor = new BinarySecurityTokenOutputProcessor();
+                    initializeOutputProcessor(outputProcessorChain, binarySecurityTokenOutputProcessor, action);
+
                     if (securityProperties.getDerivedKeyTokenReference() == WSSConstants.DerivedKeyTokenReference.EncryptedKey) {
-                        processorChain.addProcessor(new EncryptedKeyOutputProcessor(securityProperties, action));
+                        final EncryptedKeyOutputProcessor encryptedKeyOutputProcessor = new EncryptedKeyOutputProcessor();
+                        initializeOutputProcessor(outputProcessorChain, encryptedKeyOutputProcessor, action);
+
                     } else if (securityProperties.getDerivedKeyTokenReference() == WSSConstants.DerivedKeyTokenReference.SecurityContextToken) {
-                        processorChain.addProcessor(new SecurityContextTokenOutputProcessor(securityProperties, action));
+                        final SecurityContextTokenOutputProcessor securityContextTokenOutputProcessor = new SecurityContextTokenOutputProcessor();
+                        initializeOutputProcessor(outputProcessorChain, securityContextTokenOutputProcessor, action);
+
                     }
-                    processorChain.addProcessor(new DerivedKeyTokenOutputProcessor(securityProperties, action));
-                    SignatureOutputProcessor signatureOutputProcessor = new SignatureOutputProcessor(securityProperties, action);
-                    processorChain.addProcessor(signatureOutputProcessor);
-                    SignatureEndingOutputProcessor signatureEndingOutputProcessor = new SignatureEndingOutputProcessor(securityProperties, action, signatureOutputProcessor);
-                    signatureEndingOutputProcessor.getAfterProcessors().add(UsernameTokenOutputProcessor.class.getName());
-                    processorChain.addProcessor(signatureEndingOutputProcessor);
+                    final DerivedKeyTokenOutputProcessor derivedKeyTokenOutputProcessor = new DerivedKeyTokenOutputProcessor();
+                    initializeOutputProcessor(outputProcessorChain, derivedKeyTokenOutputProcessor, action);
+
+                    SignatureOutputProcessor signatureOutputProcessor = new SignatureOutputProcessor();
+                    initializeOutputProcessor(outputProcessorChain, signatureOutputProcessor, action);
+
                 } else if (action.equals(WSSConstants.ENCRYPT_WITH_DERIVED_KEY)) {
-                    processorChain.addProcessor(new BinarySecurityTokenOutputProcessor(securityProperties, action));
+                    final BinarySecurityTokenOutputProcessor binarySecurityTokenOutputProcessor = new BinarySecurityTokenOutputProcessor();
+                    initializeOutputProcessor(outputProcessorChain, binarySecurityTokenOutputProcessor, action);
+
                     if (securityProperties.getDerivedKeyTokenReference() == WSSConstants.DerivedKeyTokenReference.EncryptedKey) {
-                        processorChain.addProcessor(new EncryptedKeyOutputProcessor(securityProperties, action));
+                        final EncryptedKeyOutputProcessor encryptedKeyOutputProcessor = new EncryptedKeyOutputProcessor();
+                        initializeOutputProcessor(outputProcessorChain, encryptedKeyOutputProcessor, action);
+
                     } else if (securityProperties.getDerivedKeyTokenReference() == WSSConstants.DerivedKeyTokenReference.SecurityContextToken) {
-                        processorChain.addProcessor(new SecurityContextTokenOutputProcessor(securityProperties, action));
+                        final SecurityContextTokenOutputProcessor securityContextTokenOutputProcessor = new SecurityContextTokenOutputProcessor();
+                        initializeOutputProcessor(outputProcessorChain, securityContextTokenOutputProcessor, action);
+
                     }
-                    processorChain.addProcessor(new DerivedKeyTokenOutputProcessor(securityProperties, action));
-                    processorChain.addProcessor(new EncryptOutputProcessor(securityProperties, action));
-                    org.swssf.wss.impl.processor.output.EncryptEndingOutputProcessor encryptEndingOutputProcessor = new org.swssf.wss.impl.processor.output.EncryptEndingOutputProcessor(securityProperties, action);
-                    encryptEndingOutputProcessor.getAfterProcessors().add(UsernameTokenOutputProcessor.class.getName());
-                    processorChain.addProcessor(encryptEndingOutputProcessor);
+                    final DerivedKeyTokenOutputProcessor derivedKeyTokenOutputProcessor = new DerivedKeyTokenOutputProcessor();
+                    initializeOutputProcessor(outputProcessorChain, derivedKeyTokenOutputProcessor, action);
+
+                    final EncryptOutputProcessor encryptOutputProcessor = new EncryptOutputProcessor();
+                    initializeOutputProcessor(outputProcessorChain, encryptOutputProcessor, action);
+
                 } else if (action.equals(WSSConstants.SAML_TOKEN_SIGNED)) {
-                    processorChain.addProcessor(new SAMLTokenOutputProcessor(securityProperties, action));
-                    SignatureOutputProcessor signatureOutputProcessor = new SignatureOutputProcessor(securityProperties, action);
-                    processorChain.addProcessor(signatureOutputProcessor);
-                    SignatureEndingOutputProcessor signatureEndingOutputProcessor = new SignatureEndingOutputProcessor(securityProperties, action, signatureOutputProcessor);
-                    signatureEndingOutputProcessor.getAfterProcessors().add(UsernameTokenOutputProcessor.class.getName());
-                    processorChain.addProcessor(signatureEndingOutputProcessor);
+                    final SAMLTokenOutputProcessor samlTokenOutputProcessor = new SAMLTokenOutputProcessor();
+                    initializeOutputProcessor(outputProcessorChain, samlTokenOutputProcessor, action);
+
+                    SignatureOutputProcessor signatureOutputProcessor = new SignatureOutputProcessor();
+                    initializeOutputProcessor(outputProcessorChain, signatureOutputProcessor, action);
+
                 } else if (action.equals(WSSConstants.SAML_TOKEN_UNSIGNED)) {
-                    processorChain.addProcessor(new SAMLTokenOutputProcessor(securityProperties, action));
+                    final SAMLTokenOutputProcessor samlTokenOutputProcessor = new SAMLTokenOutputProcessor();
+                    initializeOutputProcessor(outputProcessorChain, samlTokenOutputProcessor, action);
                 }
             }
             if (output instanceof OutputStream) {
-                processorChain.addProcessor(new FinalOutputProcessor((OutputStream) output, encoding, securityProperties, null));
+                final FinalOutputProcessor finalOutputProcessor = new FinalOutputProcessor((OutputStream) output, encoding);
+                initializeOutputProcessor(outputProcessorChain, finalOutputProcessor, null);
+
             } else if (output instanceof XMLStreamWriter) {
-                processorChain.addProcessor(new FinalOutputProcessor((XMLStreamWriter) output, securityProperties, null));
+                final FinalOutputProcessor finalOutputProcessor = new FinalOutputProcessor((XMLStreamWriter) output);
+                initializeOutputProcessor(outputProcessorChain, finalOutputProcessor, null);
+
             } else {
                 throw new IllegalArgumentException(output + " is not supported as output");
             }
         } catch (XMLSecurityException e) {
             throw new WSSecurityException(e.getMessage(), e);
         }
-        return new XMLSecurityStreamWriter(processorChain);
+        return new XMLSecurityStreamWriter(outputProcessorChain);
+    }
+
+    private void initializeOutputProcessor(OutputProcessorChainImpl outputProcessorChain, OutputProcessor outputProcessor, XMLSecurityConstants.Action action) throws XMLSecurityException {
+        outputProcessor.setXMLSecurityProperties(securityProperties);
+        outputProcessor.setAction(action);
+        outputProcessor.init(outputProcessorChain);
     }
 }

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/BinarySecurityTokenOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/BinarySecurityTokenOutputProcessor.java?rev=1311068&r1=1311067&r2=1311068&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/BinarySecurityTokenOutputProcessor.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/BinarySecurityTokenOutputProcessor.java Sun Apr  8 18:42:34 2012
@@ -40,8 +40,8 @@ import java.util.UUID;
  */
 public class BinarySecurityTokenOutputProcessor extends AbstractOutputProcessor {
 
-    public BinarySecurityTokenOutputProcessor(WSSSecurityProperties securityProperties, XMLSecurityConstants.Action action) throws XMLSecurityException {
-        super(securityProperties, action);
+    public BinarySecurityTokenOutputProcessor() throws XMLSecurityException {
+        super();
     }
 
     @Override
@@ -149,17 +149,21 @@ public class BinarySecurityTokenOutputPr
                 outputProcessorChain.getSecurityContext().put(WSSConstants.PROP_USE_THIS_TOKEN_ID_FOR_SIGNATURE, bstId);
                 if (((WSSSecurityProperties) getSecurityProperties()).getSignatureKeyIdentifierType() == WSSConstants.KeyIdentifierType.SECURITY_TOKEN_DIRECT_REFERENCE) {
                     outputProcessorChain.getSecurityContext().put(WSSConstants.PROP_APPEND_SIGNATURE_ON_THIS_ID, bstId);
-                    FinalBinarySecurityTokenOutputProcessor finalBinarySecurityTokenOutputProcessor = new FinalBinarySecurityTokenOutputProcessor(getSecurityProperties(), getAction(), binarySecurityToken);
-                    finalBinarySecurityTokenOutputProcessor.getBeforeProcessors().add(org.swssf.wss.impl.processor.output.SignatureOutputProcessor.class.getName());
-                    outputProcessorChain.addProcessor(finalBinarySecurityTokenOutputProcessor);
+                    FinalBinarySecurityTokenOutputProcessor finalBinarySecurityTokenOutputProcessor = new FinalBinarySecurityTokenOutputProcessor(binarySecurityToken);
+                    finalBinarySecurityTokenOutputProcessor.setXMLSecurityProperties(getSecurityProperties());
+                    finalBinarySecurityTokenOutputProcessor.setAction(getAction());
+                    finalBinarySecurityTokenOutputProcessor.getBeforeProcessors().add(SignatureOutputProcessor.class.getName());
+                    finalBinarySecurityTokenOutputProcessor.init(outputProcessorChain);
                     binarySecurityToken.setProcessor(finalBinarySecurityTokenOutputProcessor);
                 }
             } else if (action.equals(WSSConstants.ENCRYPT)) {
                 outputProcessorChain.getSecurityContext().put(WSSConstants.PROP_USE_THIS_TOKEN_ID_FOR_ENCRYPTED_KEY, bstId);
                 if (((WSSSecurityProperties) getSecurityProperties()).getEncryptionKeyIdentifierType() == WSSConstants.KeyIdentifierType.SECURITY_TOKEN_DIRECT_REFERENCE) {
-                    FinalBinarySecurityTokenOutputProcessor finalBinarySecurityTokenOutputProcessor = new FinalBinarySecurityTokenOutputProcessor(getSecurityProperties(), getAction(), binarySecurityToken);
-                    finalBinarySecurityTokenOutputProcessor.getAfterProcessors().add(org.swssf.wss.impl.processor.output.EncryptEndingOutputProcessor.class.getName());
-                    outputProcessorChain.addProcessor(finalBinarySecurityTokenOutputProcessor);
+                    FinalBinarySecurityTokenOutputProcessor finalBinarySecurityTokenOutputProcessor = new FinalBinarySecurityTokenOutputProcessor(binarySecurityToken);
+                    finalBinarySecurityTokenOutputProcessor.setXMLSecurityProperties(getSecurityProperties());
+                    finalBinarySecurityTokenOutputProcessor.setAction(getAction());
+                    finalBinarySecurityTokenOutputProcessor.getAfterProcessors().add(EncryptEndingOutputProcessor.class.getName());
+                    finalBinarySecurityTokenOutputProcessor.init(outputProcessorChain);
                     binarySecurityToken.setProcessor(finalBinarySecurityTokenOutputProcessor);
                 }
             } else if (action.equals(WSSConstants.SIGNATURE_WITH_DERIVED_KEY)
@@ -212,8 +216,8 @@ public class BinarySecurityTokenOutputPr
 
         private SecurityToken securityToken;
 
-        FinalBinarySecurityTokenOutputProcessor(XMLSecurityProperties securityProperties, XMLSecurityConstants.Action action, SecurityToken securityToken) throws XMLSecurityException {
-            super(securityProperties, action);
+        FinalBinarySecurityTokenOutputProcessor(SecurityToken securityToken) throws XMLSecurityException {
+            super();
             this.getAfterProcessors().add(BinarySecurityTokenOutputProcessor.class.getName());
             this.securityToken = securityToken;
         }

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/DerivedKeyTokenOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/DerivedKeyTokenOutputProcessor.java?rev=1311068&r1=1311067&r2=1311068&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/DerivedKeyTokenOutputProcessor.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/DerivedKeyTokenOutputProcessor.java Sun Apr  8 18:42:34 2012
@@ -47,8 +47,8 @@ import java.util.UUID;
  */
 public class DerivedKeyTokenOutputProcessor extends AbstractOutputProcessor {
 
-    public DerivedKeyTokenOutputProcessor(WSSSecurityProperties securityProperties, XMLSecurityConstants.Action action) throws XMLSecurityException {
-        super(securityProperties, action);
+    public DerivedKeyTokenOutputProcessor() throws XMLSecurityException {
+        super();
     }
 
     @Override
@@ -185,12 +185,12 @@ public class DerivedKeyTokenOutputProces
             }
             outputProcessorChain.getSecurityContext().registerSecurityTokenProvider(wsuIdDKT, derivedKeysecurityTokenProvider);
             FinalDerivedKeyTokenOutputProcessor finalDerivedKeyTokenOutputProcessor =
-                    new FinalDerivedKeyTokenOutputProcessor(
-                            getSecurityProperties(), getAction(), derivedKeySecurityToken,
-                            offset, length, new String(Base64.encodeBase64(nonce)));
+                    new FinalDerivedKeyTokenOutputProcessor(derivedKeySecurityToken, offset, length, new String(Base64.encodeBase64(nonce)));
+            finalDerivedKeyTokenOutputProcessor.setXMLSecurityProperties(getSecurityProperties());
+            finalDerivedKeyTokenOutputProcessor.setAction(getAction());
             finalDerivedKeyTokenOutputProcessor.getBeforeProcessors().add(wrappingSecurityToken.getProcessor());
+            finalDerivedKeyTokenOutputProcessor.init(outputProcessorChain);
             derivedKeySecurityToken.setProcessor(finalDerivedKeyTokenOutputProcessor);
-            outputProcessorChain.addProcessor(finalDerivedKeyTokenOutputProcessor);
         } finally {
             outputProcessorChain.removeProcessor(this);
         }
@@ -204,11 +204,9 @@ public class DerivedKeyTokenOutputProces
         private int length;
         private String nonce;
 
-        FinalDerivedKeyTokenOutputProcessor(XMLSecurityProperties securityProperties, XMLSecurityConstants.Action action,
-                                            SecurityToken securityToken, int offset, int length, String nonce)
-                throws XMLSecurityException {
+        FinalDerivedKeyTokenOutputProcessor(SecurityToken securityToken, int offset, int length, String nonce) throws XMLSecurityException {
 
-            super(securityProperties, action);
+            super();
             this.securityToken = securityToken;
             this.offset = offset;
             this.length = length;

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/EncryptEndingOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/EncryptEndingOutputProcessor.java?rev=1311068&r1=1311067&r2=1311068&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/EncryptEndingOutputProcessor.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/EncryptEndingOutputProcessor.java Sun Apr  8 18:42:34 2012
@@ -19,10 +19,8 @@
 package org.swssf.wss.impl.processor.output;
 
 import org.swssf.wss.ext.WSSConstants;
-import org.swssf.wss.ext.WSSSecurityProperties;
 import org.swssf.wss.ext.WSSUtils;
 import org.swssf.xmlsec.ext.OutputProcessorChain;
-import org.swssf.xmlsec.ext.XMLSecurityConstants;
 import org.swssf.xmlsec.ext.XMLSecurityException;
 import org.swssf.xmlsec.impl.processor.output.AbstractEncryptEndingOutputProcessor;
 
@@ -36,8 +34,8 @@ import javax.xml.stream.XMLStreamExcepti
  */
 public class EncryptEndingOutputProcessor extends AbstractEncryptEndingOutputProcessor {
 
-    public EncryptEndingOutputProcessor(WSSSecurityProperties securityProperties, XMLSecurityConstants.Action action) throws XMLSecurityException {
-        super(securityProperties, action);
+    public EncryptEndingOutputProcessor() throws XMLSecurityException {
+        super();
         this.getAfterProcessors().add(EncryptOutputProcessor.class.getName());
         this.getAfterProcessors().add(UsernameTokenOutputProcessor.class.getName());
     }

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/EncryptOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/EncryptOutputProcessor.java?rev=1311068&r1=1311067&r2=1311068&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/EncryptOutputProcessor.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/EncryptOutputProcessor.java Sun Apr  8 18:42:34 2012
@@ -20,8 +20,10 @@ package org.swssf.wss.impl.processor.out
 
 import org.swssf.wss.ext.WSSConstants;
 import org.swssf.wss.ext.WSSDocumentContext;
-import org.swssf.wss.ext.WSSSecurityProperties;
-import org.swssf.xmlsec.ext.*;
+import org.swssf.xmlsec.ext.OutputProcessorChain;
+import org.swssf.xmlsec.ext.SecurePart;
+import org.swssf.xmlsec.ext.SecurityTokenProvider;
+import org.swssf.xmlsec.ext.XMLSecurityException;
 import org.swssf.xmlsec.impl.EncryptionPartDef;
 import org.swssf.xmlsec.impl.processor.output.AbstractEncryptOutputProcessor;
 
@@ -47,8 +49,17 @@ import java.util.UUID;
  */
 public class EncryptOutputProcessor extends AbstractEncryptOutputProcessor {
 
-    public EncryptOutputProcessor(WSSSecurityProperties securityProperties, XMLSecurityConstants.Action action) throws XMLSecurityException {
-        super(securityProperties, action);
+    public EncryptOutputProcessor() throws XMLSecurityException {
+        super();
+    }
+
+    @Override
+    public void init(OutputProcessorChain outputProcessorChain) throws XMLSecurityException {
+        super.init(outputProcessorChain);
+        EncryptEndingOutputProcessor encryptEndingOutputProcessor = new EncryptEndingOutputProcessor();
+        encryptEndingOutputProcessor.setXMLSecurityProperties(getSecurityProperties());
+        encryptEndingOutputProcessor.setAction(getAction());
+        encryptEndingOutputProcessor.init(outputProcessorChain);
     }
 
     @Override
@@ -74,12 +85,13 @@ public class EncryptOutputProcessor exte
                         outputProcessorChain.getSecurityContext().putAsList(EncryptionPartDef.class, encryptionPartDef);
                         internalEncryptionOutputProcessor =
                                 new InternalEncryptionOutputProcessor(
-                                        ((WSSSecurityProperties) getSecurityProperties()),
-                                        getAction(),
                                         encryptionPartDef,
                                         startElement,
                                         outputProcessorChain.getDocumentContext().getEncoding()
                                 );
+                        internalEncryptionOutputProcessor.setXMLSecurityProperties(getSecurityProperties());
+                        internalEncryptionOutputProcessor.setAction(getAction());
+                        internalEncryptionOutputProcessor.init(outputProcessorChain);
                     } catch (NoSuchAlgorithmException e) {
                         throw new XMLSecurityException(XMLSecurityException.ErrorCode.FAILED_ENCRYPTION, e);
                     } catch (NoSuchPaddingException e) {
@@ -91,7 +103,6 @@ public class EncryptOutputProcessor exte
                     }
 
                     setActiveInternalEncryptionOutputProcessor(internalEncryptionOutputProcessor);
-                    outputProcessorChain.addProcessor(internalEncryptionOutputProcessor);
                 }
             }
         }
@@ -106,12 +117,11 @@ public class EncryptOutputProcessor exte
 
         private boolean doEncryptedHeader = false;
 
-        InternalEncryptionOutputProcessor(WSSSecurityProperties securityProperties, XMLSecurityConstants.Action action, EncryptionPartDef encryptionPartDef,
-                                          StartElement startElement, String encoding)
+        InternalEncryptionOutputProcessor(EncryptionPartDef encryptionPartDef, StartElement startElement, String encoding)
                 throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IOException, XMLStreamException {
 
-            super(securityProperties, action, encryptionPartDef, startElement, encoding);
-            this.getBeforeProcessors().add(org.swssf.wss.impl.processor.output.EncryptEndingOutputProcessor.class.getName());
+            super(encryptionPartDef, startElement, encoding);
+            this.getBeforeProcessors().add(EncryptEndingOutputProcessor.class.getName());
             this.getBeforeProcessors().add(InternalEncryptionOutputProcessor.class.getName());
             this.getAfterProcessors().add(EncryptOutputProcessor.class.getName());
         }

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/EncryptedKeyOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/EncryptedKeyOutputProcessor.java?rev=1311068&r1=1311067&r2=1311068&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/EncryptedKeyOutputProcessor.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/EncryptedKeyOutputProcessor.java Sun Apr  8 18:42:34 2012
@@ -47,8 +47,8 @@ import java.util.UUID;
  */
 public class EncryptedKeyOutputProcessor extends AbstractOutputProcessor {
 
-    public EncryptedKeyOutputProcessor(XMLSecurityProperties securityProperties, XMLSecurityConstants.Action action) throws XMLSecurityException {
-        super(securityProperties, action);
+    public EncryptedKeyOutputProcessor() throws XMLSecurityException {
+        super();
     }
 
     @Override
@@ -124,7 +124,9 @@ public class EncryptedKeyOutputProcessor
                 }
             };
 
-            FinalEncryptedKeyOutputProcessor finalEncryptedKeyOutputProcessor = new FinalEncryptedKeyOutputProcessor(getSecurityProperties(), getAction(), encryptedKeySecurityToken);
+            FinalEncryptedKeyOutputProcessor finalEncryptedKeyOutputProcessor = new FinalEncryptedKeyOutputProcessor(encryptedKeySecurityToken);
+            finalEncryptedKeyOutputProcessor.setXMLSecurityProperties(getSecurityProperties());
+            finalEncryptedKeyOutputProcessor.setAction(getAction());
             XMLSecurityConstants.Action action = getAction();
             if (action.equals(WSSConstants.ENCRYPT)) {
                 outputProcessorChain.getSecurityContext().put(WSSConstants.PROP_USE_THIS_TOKEN_ID_FOR_ENCRYPTION, ekId);
@@ -148,9 +150,9 @@ public class EncryptedKeyOutputProcessor
                     finalEncryptedKeyOutputProcessor.getAfterProcessors().add(org.swssf.wss.impl.processor.output.EncryptEndingOutputProcessor.class.getName());
                 }
             }
+            finalEncryptedKeyOutputProcessor.init(outputProcessorChain);
             outputProcessorChain.getSecurityContext().registerSecurityTokenProvider(ekId, encryptedKeySecurityTokenProvider);
             encryptedKeySecurityToken.setProcessor(finalEncryptedKeyOutputProcessor);
-            outputProcessorChain.addProcessor(finalEncryptedKeyOutputProcessor);
         } finally {
             outputProcessorChain.removeProcessor(this);
         }
@@ -161,8 +163,8 @@ public class EncryptedKeyOutputProcessor
 
         private SecurityToken securityToken;
 
-        FinalEncryptedKeyOutputProcessor(XMLSecurityProperties securityProperties, XMLSecurityConstants.Action action, SecurityToken securityToken) throws XMLSecurityException {
-            super(securityProperties, action);
+        FinalEncryptedKeyOutputProcessor(SecurityToken securityToken) throws XMLSecurityException {
+            super();
             this.getAfterProcessors().add(FinalEncryptedKeyOutputProcessor.class.getName());
             this.securityToken = securityToken;
         }

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/SAMLTokenOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/SAMLTokenOutputProcessor.java?rev=1311068&r1=1311067&r2=1311068&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/SAMLTokenOutputProcessor.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/SAMLTokenOutputProcessor.java Sun Apr  8 18:42:34 2012
@@ -51,8 +51,8 @@ import java.util.UUID;
  */
 public class SAMLTokenOutputProcessor extends AbstractOutputProcessor {
 
-    public SAMLTokenOutputProcessor(WSSSecurityProperties securityProperties, XMLSecurityConstants.Action action) throws XMLSecurityException {
-        super(securityProperties, action);
+    public SAMLTokenOutputProcessor() throws XMLSecurityException {
+        super();
     }
 
     @Override
@@ -174,7 +174,10 @@ public class SAMLTokenOutputProcessor ex
                 securityToken = null;
             }
 
-            final FinalSAMLTokenOutputProcessor finalSAMLTokenOutputProcessor = new FinalSAMLTokenOutputProcessor(((WSSSecurityProperties) getSecurityProperties()), getAction(), securityToken, samlAssertionWrapper, securityTokenReferenceId, binarySecurityTokenId, senderVouches);
+            final FinalSAMLTokenOutputProcessor finalSAMLTokenOutputProcessor = new FinalSAMLTokenOutputProcessor(securityToken, samlAssertionWrapper, securityTokenReferenceId, binarySecurityTokenId, senderVouches);
+            finalSAMLTokenOutputProcessor.setXMLSecurityProperties(getSecurityProperties());
+            finalSAMLTokenOutputProcessor.setAction(getAction());
+            finalSAMLTokenOutputProcessor.init(outputProcessorChain);
 
             if (senderVouches) {
 
@@ -229,7 +232,6 @@ public class SAMLTokenOutputProcessor ex
                     outputProcessorChain.getSecurityContext().putAsList(SecurePart.class, securePart);
                 }
             }
-            outputProcessorChain.addProcessor(finalSAMLTokenOutputProcessor);
         } finally {
             outputProcessorChain.removeProcessor(this);
         }
@@ -244,12 +246,10 @@ public class SAMLTokenOutputProcessor ex
         private String binarySecurityTokenReferenceId;
         private boolean senderVouches = false;
 
-        FinalSAMLTokenOutputProcessor(WSSSecurityProperties securityProperties, XMLSecurityConstants.Action action,
-                                      SecurityToken securityToken, SAMLAssertionWrapper samlAssertionWrapper,
+        FinalSAMLTokenOutputProcessor(SecurityToken securityToken, SAMLAssertionWrapper samlAssertionWrapper,
                                       String securityTokenReferenceId, String binarySecurityTokenReferenceId,
-                                      boolean senderVouches)
-                throws XMLSecurityException {
-            super(securityProperties, action);
+                                      boolean senderVouches) throws XMLSecurityException {
+            super();
             this.getAfterProcessors().add(UsernameTokenOutputProcessor.class.getName());
             this.getAfterProcessors().add(SAMLTokenOutputProcessor.class.getName());
             this.samlAssertionWrapper = samlAssertionWrapper;

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/SecurityContextTokenOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/SecurityContextTokenOutputProcessor.java?rev=1311068&r1=1311067&r2=1311068&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/SecurityContextTokenOutputProcessor.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/SecurityContextTokenOutputProcessor.java Sun Apr  8 18:42:34 2012
@@ -20,7 +20,6 @@ package org.swssf.wss.impl.processor.out
 
 import org.swssf.wss.ext.WSSConstants;
 import org.swssf.wss.ext.WSSDocumentContext;
-import org.swssf.wss.ext.WSSSecurityProperties;
 import org.swssf.wss.ext.WSSecurityException;
 import org.swssf.wss.impl.securityToken.AbstractSecurityToken;
 import org.swssf.xmlsec.ext.*;
@@ -42,8 +41,8 @@ import java.util.UUID;
  */
 public class SecurityContextTokenOutputProcessor extends AbstractOutputProcessor {
 
-    public SecurityContextTokenOutputProcessor(WSSSecurityProperties securityProperties, XMLSecurityConstants.Action action) throws XMLSecurityException {
-        super(securityProperties, action);
+    public SecurityContextTokenOutputProcessor() throws XMLSecurityException {
+        super();
     }
 
     @Override
@@ -117,7 +116,9 @@ public class SecurityContextTokenOutputP
                 }
             };
 
-            FinalSecurityContextTokenOutputProcessor finalSecurityContextTokenOutputProcessor = new FinalSecurityContextTokenOutputProcessor(getSecurityProperties(), getAction(), securityContextSecurityToken, identifier);
+            FinalSecurityContextTokenOutputProcessor finalSecurityContextTokenOutputProcessor = new FinalSecurityContextTokenOutputProcessor(securityContextSecurityToken, identifier);
+            finalSecurityContextTokenOutputProcessor.setXMLSecurityProperties(getSecurityProperties());
+            finalSecurityContextTokenOutputProcessor.setAction(getAction());
             XMLSecurityConstants.Action action = getAction();
             if (action.equals(WSSConstants.SIGNATURE_WITH_DERIVED_KEY)) {
                 outputProcessorChain.getSecurityContext().put(WSSConstants.PROP_USE_THIS_TOKEN_ID_FOR_DERIVED_KEY, wsuId);
@@ -135,9 +136,9 @@ public class SecurityContextTokenOutputP
                 }
             }
 
+            finalSecurityContextTokenOutputProcessor.init(outputProcessorChain);
             outputProcessorChain.getSecurityContext().registerSecurityTokenProvider(wsuId, securityContextSecurityTokenProvider);
             securityContextSecurityToken.setProcessor(finalSecurityContextTokenOutputProcessor);
-            outputProcessorChain.addProcessor(finalSecurityContextTokenOutputProcessor);
 
         } finally {
             outputProcessorChain.removeProcessor(this);
@@ -150,8 +151,8 @@ public class SecurityContextTokenOutputP
         private SecurityToken securityToken;
         private String identifier;
 
-        FinalSecurityContextTokenOutputProcessor(XMLSecurityProperties securityProperties, XMLSecurityConstants.Action action, SecurityToken securityToken, String identifier) throws XMLSecurityException {
-            super(securityProperties, action);
+        FinalSecurityContextTokenOutputProcessor(SecurityToken securityToken, String identifier) throws XMLSecurityException {
+            super();
             this.securityToken = securityToken;
             this.identifier = identifier;
         }

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/SecurityHeaderOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/SecurityHeaderOutputProcessor.java?rev=1311068&r1=1311067&r2=1311068&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/SecurityHeaderOutputProcessor.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/SecurityHeaderOutputProcessor.java Sun Apr  8 18:42:34 2012
@@ -41,8 +41,8 @@ import java.util.Map;
  */
 public class SecurityHeaderOutputProcessor extends AbstractOutputProcessor {
 
-    public SecurityHeaderOutputProcessor(WSSSecurityProperties securityProperties, WSSConstants.Action action) throws XMLSecurityException {
-        super(securityProperties, action);
+    public SecurityHeaderOutputProcessor() throws XMLSecurityException {
+        super();
         setPhase(WSSConstants.Phase.PREPROCESSING);
     }
 

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/SignatureConfirmationOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/SignatureConfirmationOutputProcessor.java?rev=1311068&r1=1311067&r2=1311068&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/SignatureConfirmationOutputProcessor.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/SignatureConfirmationOutputProcessor.java Sun Apr  8 18:42:34 2012
@@ -21,12 +21,10 @@ package org.swssf.wss.impl.processor.out
 import org.apache.commons.codec.binary.Base64;
 import org.swssf.wss.ext.WSSConstants;
 import org.swssf.wss.ext.WSSDocumentContext;
-import org.swssf.wss.ext.WSSSecurityProperties;
 import org.swssf.wss.securityEvent.SecurityEvent;
 import org.swssf.wss.securityEvent.SignatureValueSecurityEvent;
 import org.swssf.xmlsec.ext.AbstractOutputProcessor;
 import org.swssf.xmlsec.ext.OutputProcessorChain;
-import org.swssf.xmlsec.ext.XMLSecurityConstants;
 import org.swssf.xmlsec.ext.XMLSecurityException;
 
 import javax.xml.namespace.QName;
@@ -44,10 +42,10 @@ import java.util.UUID;
  */
 public class SignatureConfirmationOutputProcessor extends AbstractOutputProcessor {
 
-    public SignatureConfirmationOutputProcessor(WSSSecurityProperties securityProperties, XMLSecurityConstants.Action action) throws XMLSecurityException {
-        super(securityProperties, action);
-        getBeforeProcessors().add(org.swssf.wss.impl.processor.output.SignatureOutputProcessor.class.getName());
-        getBeforeProcessors().add(org.swssf.wss.impl.processor.output.EncryptOutputProcessor.class.getName());
+    public SignatureConfirmationOutputProcessor() throws XMLSecurityException {
+        super();
+        getBeforeProcessors().add(SignatureOutputProcessor.class.getName());
+        getBeforeProcessors().add(EncryptOutputProcessor.class.getName());
     }
 
     @Override

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/SignatureEndingOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/SignatureEndingOutputProcessor.java?rev=1311068&r1=1311067&r2=1311068&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/SignatureEndingOutputProcessor.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/SignatureEndingOutputProcessor.java Sun Apr  8 18:42:34 2012
@@ -25,7 +25,6 @@ import org.swssf.wss.ext.WSSecurityConte
 import org.swssf.wss.securityEvent.SignatureValueSecurityEvent;
 import org.swssf.xmlsec.ext.OutputProcessorChain;
 import org.swssf.xmlsec.ext.SecurityToken;
-import org.swssf.xmlsec.ext.XMLSecurityConstants;
 import org.swssf.xmlsec.ext.XMLSecurityException;
 import org.swssf.xmlsec.impl.SignaturePartDef;
 import org.swssf.xmlsec.impl.algorithms.SignatureAlgorithm;
@@ -46,9 +45,9 @@ public class SignatureEndingOutputProces
 
     private SignedInfoProcessor signedInfoProcessor = null;
 
-    public SignatureEndingOutputProcessor(WSSSecurityProperties securityProperties, XMLSecurityConstants.Action action, org.swssf.wss.impl.processor.output.SignatureOutputProcessor signatureOutputProcessor) throws XMLSecurityException {
-        super(securityProperties, action, signatureOutputProcessor);
-        this.getAfterProcessors().add(org.swssf.wss.impl.processor.output.SignatureOutputProcessor.class.getName());
+    public SignatureEndingOutputProcessor(SignatureOutputProcessor signatureOutputProcessor) throws XMLSecurityException {
+        super(signatureOutputProcessor);
+        this.getAfterProcessors().add(SignatureOutputProcessor.class.getName());
         this.getAfterProcessors().add(UsernameTokenOutputProcessor.class.getName());
     }
 
@@ -64,9 +63,12 @@ public class SignatureEndingOutputProces
     }
 
     @Override
-    protected SignedInfoProcessor newSignedInfoProcessor(SignatureAlgorithm signatureAlgorithm) throws XMLSecurityException {
-        this.signedInfoProcessor = new SignedInfoProcessor(getSecurityProperties(), getAction(), signatureAlgorithm);
+    protected SignedInfoProcessor newSignedInfoProcessor(SignatureAlgorithm signatureAlgorithm, OutputProcessorChain outputProcessorChain) throws XMLSecurityException {
+        this.signedInfoProcessor = new SignedInfoProcessor(signatureAlgorithm);
+        this.signedInfoProcessor.setXMLSecurityProperties(getSecurityProperties());
+        this.signedInfoProcessor.setAction(getAction());
         this.signedInfoProcessor.getAfterProcessors().add(SignatureEndingOutputProcessor.class.getName());
+        this.signedInfoProcessor.init(outputProcessorChain);
         return this.signedInfoProcessor;
     }
 

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/SignatureOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/SignatureOutputProcessor.java?rev=1311068&r1=1311067&r2=1311068&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/SignatureOutputProcessor.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/SignatureOutputProcessor.java Sun Apr  8 18:42:34 2012
@@ -19,11 +19,9 @@
 package org.swssf.wss.impl.processor.output;
 
 import org.swssf.wss.ext.WSSConstants;
-import org.swssf.wss.ext.WSSSecurityProperties;
 import org.swssf.wss.ext.WSSecurityException;
 import org.swssf.xmlsec.ext.OutputProcessorChain;
 import org.swssf.xmlsec.ext.SecurePart;
-import org.swssf.xmlsec.ext.XMLSecurityConstants;
 import org.swssf.xmlsec.ext.XMLSecurityException;
 import org.swssf.xmlsec.impl.SignaturePartDef;
 import org.swssf.xmlsec.impl.processor.output.AbstractSignatureOutputProcessor;
@@ -46,8 +44,17 @@ import java.util.UUID;
  */
 public class SignatureOutputProcessor extends AbstractSignatureOutputProcessor {
 
-    public SignatureOutputProcessor(WSSSecurityProperties securityProperties, XMLSecurityConstants.Action action) throws XMLSecurityException {
-        super(securityProperties, action);
+    public SignatureOutputProcessor() throws XMLSecurityException {
+        super();
+    }
+
+    @Override
+    public void init(OutputProcessorChain outputProcessorChain) throws XMLSecurityException {
+        super.init(outputProcessorChain);
+        SignatureEndingOutputProcessor signatureEndingOutputProcessor = new SignatureEndingOutputProcessor(this);
+        signatureEndingOutputProcessor.setXMLSecurityProperties(getSecurityProperties());
+        signatureEndingOutputProcessor.setAction(getAction());
+        signatureEndingOutputProcessor.init(outputProcessorChain);
     }
 
     @Override
@@ -95,9 +102,12 @@ public class SignatureOutputProcessor ex
                         }
 
                         getSignaturePartDefList().add(signaturePartDef);
-                        internalSignatureOutputProcessor = new InternalSignatureOutputProcessor(getSecurityProperties(), getAction(), signaturePartDef, startElement.getName());
+                        internalSignatureOutputProcessor = new InternalSignatureOutputProcessor(signaturePartDef, startElement.getName());
+                        internalSignatureOutputProcessor.setXMLSecurityProperties(getSecurityProperties());
+                        internalSignatureOutputProcessor.setAction(getAction());
                         internalSignatureOutputProcessor.getAfterProcessors().add(SignatureOutputProcessor.class.getName());
                         internalSignatureOutputProcessor.getBeforeProcessors().add(SignatureEndingOutputProcessor.class.getName());
+                        internalSignatureOutputProcessor.init(outputProcessorChain);
 
                     } catch (NoSuchAlgorithmException e) {
                         throw new WSSecurityException(
@@ -109,7 +119,6 @@ public class SignatureOutputProcessor ex
                     }
 
                     setActiveInternalSignatureOutputProcessor(internalSignatureOutputProcessor);
-                    outputProcessorChain.addProcessor(internalSignatureOutputProcessor);
                 }
             }
         }

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/TimestampOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/TimestampOutputProcessor.java?rev=1311068&r1=1311067&r2=1311068&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/TimestampOutputProcessor.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/TimestampOutputProcessor.java Sun Apr  8 18:42:34 2012
@@ -24,7 +24,6 @@ import org.swssf.wss.ext.WSSSecurityProp
 import org.swssf.wss.ext.WSSecurityException;
 import org.swssf.xmlsec.ext.AbstractOutputProcessor;
 import org.swssf.xmlsec.ext.OutputProcessorChain;
-import org.swssf.xmlsec.ext.XMLSecurityConstants;
 import org.swssf.xmlsec.ext.XMLSecurityException;
 
 import javax.xml.datatype.DatatypeConfigurationException;
@@ -42,8 +41,8 @@ import java.util.GregorianCalendar;
  */
 public class TimestampOutputProcessor extends AbstractOutputProcessor {
 
-    public TimestampOutputProcessor(WSSSecurityProperties securityProperties, XMLSecurityConstants.Action action) throws XMLSecurityException {
-        super(securityProperties, action);
+    public TimestampOutputProcessor() throws XMLSecurityException {
+        super();
     }
 
     /*

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/UsernameTokenOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/UsernameTokenOutputProcessor.java?rev=1311068&r1=1311067&r2=1311068&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/UsernameTokenOutputProcessor.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/UsernameTokenOutputProcessor.java Sun Apr  8 18:42:34 2012
@@ -38,8 +38,8 @@ import java.util.*;
  */
 public class UsernameTokenOutputProcessor extends AbstractOutputProcessor {
 
-    public UsernameTokenOutputProcessor(WSSSecurityProperties securityProperties, XMLSecurityConstants.Action action) throws XMLSecurityException {
-        super(securityProperties, action);
+    public UsernameTokenOutputProcessor() throws XMLSecurityException {
+        super();
     }
 
     @Override
@@ -94,7 +94,10 @@ public class UsernameTokenOutputProcesso
                 outputProcessorChain.getSecurityContext().put(WSSConstants.PROP_USE_THIS_TOKEN_ID_FOR_SIGNATURE, wsuId);
                 outputProcessorChain.getSecurityContext().put(WSSConstants.PROP_APPEND_SIGNATURE_ON_THIS_ID, wsuId);
             }
-            outputProcessorChain.addProcessor(new FinalUsernameTokenOutputProcessor(((WSSSecurityProperties) getSecurityProperties()), getAction(), wsuId, nonceValue, password, created));
+            final FinalUsernameTokenOutputProcessor finalUsernameTokenOutputProcessor = new FinalUsernameTokenOutputProcessor(wsuId, nonceValue, password, created);
+            finalUsernameTokenOutputProcessor.setXMLSecurityProperties(getSecurityProperties());
+            finalUsernameTokenOutputProcessor.setAction(getAction());
+            finalUsernameTokenOutputProcessor.init(outputProcessorChain);
 
         } catch (DatatypeConfigurationException e) {
             throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e);
@@ -111,10 +114,9 @@ public class UsernameTokenOutputProcesso
         private String password = null;
         private XMLGregorianCalendar created = null;
 
-        FinalUsernameTokenOutputProcessor(WSSSecurityProperties securityProperties, XMLSecurityConstants.Action action, String wsuId,
-                                          byte[] nonceValue, String password, XMLGregorianCalendar created)
+        FinalUsernameTokenOutputProcessor(String wsuId, byte[] nonceValue, String password, XMLGregorianCalendar created)
                 throws XMLSecurityException {
-            super(securityProperties, action);
+            super();
             this.getAfterProcessors().add(UsernameTokenOutputProcessor.class.getName());
             this.getAfterProcessors().add(UsernameTokenOutputProcessor.class.getName());
             this.wsuId = wsuId;

Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/AbstractBufferingOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/AbstractBufferingOutputProcessor.java?rev=1311068&r1=1311067&r2=1311068&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/AbstractBufferingOutputProcessor.java (original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/AbstractBufferingOutputProcessor.java Sun Apr  8 18:42:34 2012
@@ -34,8 +34,8 @@ public abstract class AbstractBufferingO
     private ArrayDeque<XMLEvent> xmlEventBuffer = new ArrayDeque<XMLEvent>();
     private String appendAfterThisTokenId;
 
-    protected AbstractBufferingOutputProcessor(XMLSecurityProperties securityProperties, XMLSecurityConstants.Action action) throws XMLSecurityException {
-        super(securityProperties, action);
+    protected AbstractBufferingOutputProcessor() throws XMLSecurityException {
+        super();
     }
 
     public Deque<XMLEvent> getXmlEventBuffer() {

Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/AbstractOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/AbstractOutputProcessor.java?rev=1311068&r1=1311067&r2=1311068&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/AbstractOutputProcessor.java (original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/AbstractOutputProcessor.java Sun Apr  8 18:42:34 2012
@@ -49,11 +49,25 @@ public abstract class AbstractOutputProc
     private Set<Object> beforeProcessors = new HashSet<Object>();
     private Set<Object> afterProcessors = new HashSet<Object>();
 
-    protected AbstractOutputProcessor(XMLSecurityProperties securityProperties, XMLSecurityConstants.Action action) throws XMLSecurityException {
-        this.securityProperties = securityProperties;
+    protected AbstractOutputProcessor() throws XMLSecurityException {
+        super();
+    }
+
+    @Override
+    public void setXMLSecurityProperties(XMLSecurityProperties xmlSecurityProperties) {
+        this.securityProperties = xmlSecurityProperties;
+    }
+
+    @Override
+    public void setAction(XMLSecurityConstants.Action action) {
         this.action = action;
     }
 
+    @Override
+    public void init(OutputProcessorChain outputProcessorChain) throws XMLSecurityException {
+        outputProcessorChain.addProcessor(this);
+    }
+
     public XMLSecurityConstants.Phase getPhase() {
         return phase;
     }

Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/OutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/OutputProcessor.java?rev=1311068&r1=1311067&r2=1311068&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/OutputProcessor.java (original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/OutputProcessor.java Sun Apr  8 18:42:34 2012
@@ -31,6 +31,25 @@ import java.util.Set;
 public interface OutputProcessor {
 
     /**
+     * setter for the XMLSecurityProperties after instantiation of the processor
+     *
+     * @param xmlSecurityProperties
+     */
+    void setXMLSecurityProperties(XMLSecurityProperties xmlSecurityProperties);
+
+    /**
+     * setter for the Action after instantiation of the processor
+     *
+     * @param action
+     */
+    void setAction(XMLSecurityConstants.Action action);
+
+    /**
+     * Method will be called after setting the properties
+     */
+    void init(OutputProcessorChain outputProcessorChain) throws XMLSecurityException;
+
+    /**
      * This OutputProcessor will be added before the processors in this set
      *
      * @return The set with the named OutputProcessor

Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/AbstractEncryptEndingOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/AbstractEncryptEndingOutputProcessor.java?rev=1311068&r1=1311067&r2=1311068&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/AbstractEncryptEndingOutputProcessor.java (original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/AbstractEncryptEndingOutputProcessor.java Sun Apr  8 18:42:34 2012
@@ -18,7 +18,9 @@
  */
 package org.swssf.xmlsec.impl.processor.output;
 
-import org.swssf.xmlsec.ext.*;
+import org.swssf.xmlsec.ext.AbstractBufferingOutputProcessor;
+import org.swssf.xmlsec.ext.OutputProcessorChain;
+import org.swssf.xmlsec.ext.XMLSecurityException;
 
 import javax.xml.stream.XMLStreamException;
 
@@ -30,8 +32,8 @@ import javax.xml.stream.XMLStreamExcepti
  */
 public abstract class AbstractEncryptEndingOutputProcessor extends AbstractBufferingOutputProcessor {
 
-    public AbstractEncryptEndingOutputProcessor(XMLSecurityProperties securityProperties, XMLSecurityConstants.Action action) throws XMLSecurityException {
-        super(securityProperties, action);
+    public AbstractEncryptEndingOutputProcessor() throws XMLSecurityException {
+        super();
     }
 
     @Override

Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/AbstractEncryptOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/AbstractEncryptOutputProcessor.java?rev=1311068&r1=1311067&r2=1311068&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/AbstractEncryptOutputProcessor.java (original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/AbstractEncryptOutputProcessor.java Sun Apr  8 18:42:34 2012
@@ -53,8 +53,8 @@ public abstract class AbstractEncryptOut
 
     private AbstractInternalEncryptionOutputProcessor activeInternalEncryptionOutputProcessor = null;
 
-    public AbstractEncryptOutputProcessor(XMLSecurityProperties securityProperties, XMLSecurityConstants.Action action) throws XMLSecurityException {
-        super(securityProperties, action);
+    public AbstractEncryptOutputProcessor() throws XMLSecurityException {
+        super();
     }
 
     @Override
@@ -69,7 +69,7 @@ public abstract class AbstractEncryptOut
     }
 
     /**
-     * Processor which handles the effective enryption of the data
+     * Processor which handles the effective encryption of the data
      */
     public abstract class AbstractInternalEncryptionOutputProcessor extends AbstractOutputProcessor {
 
@@ -77,45 +77,64 @@ public abstract class AbstractEncryptOut
         private CharacterEventGeneratorOutputStream characterEventGeneratorOutputStream;
         private XMLEventWriter xmlEventWriter;
         private OutputStream cipherOutputStream;
+        private String encoding;
 
         private StartElement startElement;
         private int elementCounter = 0;
         private OutputProcessorChain subOutputProcessorChain;
 
-        public AbstractInternalEncryptionOutputProcessor(XMLSecurityProperties securityProperties, XMLSecurityConstants.Action action, EncryptionPartDef encryptionPartDef,
+        public AbstractInternalEncryptionOutputProcessor(EncryptionPartDef encryptionPartDef,
                                                          StartElement startElement, String encoding)
                 throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IOException, XMLStreamException {
 
-            super(securityProperties, action);
+            super();
             this.getBeforeProcessors().add(AbstractEncryptEndingOutputProcessor.class.getName());
             this.getBeforeProcessors().add(AbstractInternalEncryptionOutputProcessor.class.getName());
             this.getAfterProcessors().add(AbstractEncryptOutputProcessor.class.getName());
             this.setEncryptionPartDef(encryptionPartDef);
             this.setStartElement(startElement);
+            this.setEncoding(encoding);
+        }
+
+        @Override
+        public void init(OutputProcessorChain outputProcessorChain) throws XMLSecurityException {
+            try {
+                //initialize the cipher
+                String jceAlgorithm = JCEAlgorithmMapper.translateURItoJCEID(securityProperties.getEncryptionSymAlgorithm());
+                Cipher symmetricCipher = Cipher.getInstance(jceAlgorithm);
+
+                //Should internally generate an IV
+                symmetricCipher.init(Cipher.ENCRYPT_MODE, encryptionPartDef.getSymmetricKey());
+                byte[] iv = symmetricCipher.getIV();
+
+                characterEventGeneratorOutputStream = new CharacterEventGeneratorOutputStream(getEncoding());
+                //Base64EncoderStream calls write every 78byte (line breaks). So we have to buffer again to get optimal performance
+                Base64OutputStream base64EncoderStream = new Base64OutputStream(new BufferedOutputStream(characterEventGeneratorOutputStream), true, 76, new byte[]{'\n'});
+                base64EncoderStream.write(iv);
+
+                //the trimmer output stream is needed to strip away the dummy wrapping element which must be added
+                cipherOutputStream = new TrimmerOutputStream(new CipherOutputStream(base64EncoderStream, symmetricCipher), 8192, 3, 4);
+
+                //we create a new StAX writer for optimized namespace writing.
+                XMLOutputFactory xmlOutputFactory = XMLOutputFactory.newInstance();
+                xmlOutputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, false);
+                //spec says (4.2): "The cleartext octet sequence obtained in step 3 is interpreted as UTF-8 encoded character data."
+                xmlEventWriter = xmlOutputFactory.createXMLEventWriter(cipherOutputStream, "UTF-8");
+                //we have to output a fake element to workaround text-only encryption:
+                xmlEventWriter.add(XMLEventFactory.newInstance().createStartElement(new QName("a"), null, null));
+            } catch (NoSuchPaddingException e) {
+                throw new XMLSecurityException(XMLSecurityException.ErrorCode.FAILED_ENCRYPTION, e);
+            } catch (NoSuchAlgorithmException e) {
+                throw new XMLSecurityException(XMLSecurityException.ErrorCode.FAILED_ENCRYPTION, e);
+            } catch (IOException e) {
+                throw new XMLSecurityException(XMLSecurityException.ErrorCode.FAILED_ENCRYPTION, e);
+            } catch (XMLStreamException e) {
+                throw new XMLSecurityException(XMLSecurityException.ErrorCode.FAILED_ENCRYPTION, e);
+            } catch (InvalidKeyException e) {
+                throw new XMLSecurityException(XMLSecurityException.ErrorCode.FAILED_ENCRYPTION, e);
+            }
 
-            //initialize the cipher
-            String jceAlgorithm = JCEAlgorithmMapper.translateURItoJCEID(securityProperties.getEncryptionSymAlgorithm());
-            Cipher symmetricCipher = Cipher.getInstance(jceAlgorithm);
-
-            //Should internally generate an IV
-            symmetricCipher.init(Cipher.ENCRYPT_MODE, encryptionPartDef.getSymmetricKey());
-            byte[] iv = symmetricCipher.getIV();
-
-            characterEventGeneratorOutputStream = new CharacterEventGeneratorOutputStream(encoding);
-            //Base64EncoderStream calls write every 78byte (line breaks). So we have to buffer again to get optimal performance
-            Base64OutputStream base64EncoderStream = new Base64OutputStream(new BufferedOutputStream(characterEventGeneratorOutputStream), true, 76, new byte[]{'\n'});
-            base64EncoderStream.write(iv);
-
-            //the trimmer output stream is needed to strip away the dummy wrapping element which must be added 
-            cipherOutputStream = new TrimmerOutputStream(new CipherOutputStream(base64EncoderStream, symmetricCipher), 8192, 3, 4);
-
-            //we create a new StAX writer for optimized namespace writing.
-            XMLOutputFactory xmlOutputFactory = XMLOutputFactory.newInstance();
-            xmlOutputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, false);
-            //spec says (4.2): "The cleartext octet sequence obtained in step 3 is interpreted as UTF-8 encoded character data."
-            xmlEventWriter = xmlOutputFactory.createXMLEventWriter(cipherOutputStream, "UTF-8");
-            //we have to output a fake element to workaround text-only encryption:
-            xmlEventWriter.add(XMLEventFactory.newInstance().createStartElement(new QName("a"), null, null));
+            super.init(outputProcessorChain);
         }
 
         @Override
@@ -277,6 +296,14 @@ public abstract class AbstractEncryptOut
         protected void setElementCounter(int elementCounter) {
             this.elementCounter = elementCounter;
         }
+
+        public String getEncoding() {
+            return encoding;
+        }
+
+        public void setEncoding(String encoding) {
+            this.encoding = encoding;
+        }
     }
 
     /**

Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/AbstractSignatureEndingOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/AbstractSignatureEndingOutputProcessor.java?rev=1311068&r1=1311067&r2=1311068&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/AbstractSignatureEndingOutputProcessor.java (original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/AbstractSignatureEndingOutputProcessor.java Sun Apr  8 18:42:34 2012
@@ -44,8 +44,8 @@ public abstract class AbstractSignatureE
 
     private List<SignaturePartDef> signaturePartDefList;
 
-    public AbstractSignatureEndingOutputProcessor(XMLSecurityProperties securityProperties, XMLSecurityConstants.Action action, AbstractSignatureOutputProcessor signatureOutputProcessor) throws XMLSecurityException {
-        super(securityProperties, action);
+    public AbstractSignatureEndingOutputProcessor(AbstractSignatureOutputProcessor signatureOutputProcessor) throws XMLSecurityException {
+        super();
         signaturePartDefList = signatureOutputProcessor.getSignaturePartDefList();
     }
 
@@ -118,8 +118,7 @@ public abstract class AbstractSignatureE
 
         signatureAlgorithm.engineInitSign(wrappingSecurityToken.getSecretKey(getSecurityProperties().getSignatureAlgorithm(), null));
 
-        SignedInfoProcessor signedInfoProcessor = newSignedInfoProcessor(signatureAlgorithm);
-        subOutputProcessorChain.addProcessor(signedInfoProcessor);
+        SignedInfoProcessor signedInfoProcessor = newSignedInfoProcessor(signatureAlgorithm, subOutputProcessorChain);
 
         createStartElementAndOutputAsEvent(subOutputProcessorChain, XMLSecurityConstants.TAG_dsig_SignedInfo, null);
 
@@ -169,9 +168,12 @@ public abstract class AbstractSignatureE
         createEndElementAndOutputAsEvent(subOutputProcessorChain, XMLSecurityConstants.TAG_dsig_Signature);
     }
 
-    protected SignedInfoProcessor newSignedInfoProcessor(SignatureAlgorithm signatureAlgorithm) throws XMLSecurityException {
-        SignedInfoProcessor signedInfoProcessor = new SignedInfoProcessor(getSecurityProperties(), getAction(), signatureAlgorithm);
+    protected SignedInfoProcessor newSignedInfoProcessor(SignatureAlgorithm signatureAlgorithm, OutputProcessorChain outputProcessorChain) throws XMLSecurityException {
+        SignedInfoProcessor signedInfoProcessor = new SignedInfoProcessor(signatureAlgorithm);
+        signedInfoProcessor.setXMLSecurityProperties(getSecurityProperties());
+        signedInfoProcessor.setAction(getAction());
         signedInfoProcessor.getAfterProcessors().add(AbstractSignatureEndingOutputProcessor.class.getName());
+        signedInfoProcessor.init(outputProcessorChain);
         return signedInfoProcessor;
     }
 
@@ -191,15 +193,21 @@ public abstract class AbstractSignatureE
         private OutputStream bufferedSignerOutputStream;
         private Transformer transformer;
         private byte[] signatureValue = null;
+        private SignatureAlgorithm signatureAlgorithm;
 
-        public SignedInfoProcessor(XMLSecurityProperties securityProperties, XMLSecurityConstants.Action action, SignatureAlgorithm signatureAlgorithm) throws XMLSecurityException {
-            super(securityProperties, action);
+        public SignedInfoProcessor(SignatureAlgorithm signatureAlgorithm) throws XMLSecurityException {
+            super();
+            this.signatureAlgorithm = signatureAlgorithm;
+        }
+
+        @Override
+        public void init(OutputProcessorChain outputProcessorChain) throws XMLSecurityException {
 
-            signerOutputStream = new SignerOutputStream(signatureAlgorithm);
-            bufferedSignerOutputStream = new BufferedOutputStream(signerOutputStream);
+            this.signerOutputStream = new SignerOutputStream(this.signatureAlgorithm);
+            this.bufferedSignerOutputStream = new BufferedOutputStream(this.signerOutputStream);
 
             try {
-                transformer = XMLSecurityUtils.getTransformer(null, this.bufferedSignerOutputStream, getSecurityProperties().getSignatureCanonicalizationAlgorithm());
+                this.transformer = XMLSecurityUtils.getTransformer(null, this.bufferedSignerOutputStream, getSecurityProperties().getSignatureCanonicalizationAlgorithm());
             } catch (NoSuchMethodException e) {
                 throw new XMLSecurityException(XMLSecurityException.ErrorCode.FAILED_SIGNATURE, e);
             } catch (InstantiationException e) {
@@ -209,6 +217,8 @@ public abstract class AbstractSignatureE
             } catch (InvocationTargetException e) {
                 throw new XMLSecurityException(XMLSecurityException.ErrorCode.FAILED_SIGNATURE, e);
             }
+
+            super.init(outputProcessorChain);
         }
 
         public byte[] getSignatureValue() throws XMLSecurityException {

Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/AbstractSignatureOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/AbstractSignatureOutputProcessor.java?rev=1311068&r1=1311067&r2=1311068&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/AbstractSignatureOutputProcessor.java (original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/AbstractSignatureOutputProcessor.java Sun Apr  8 18:42:34 2012
@@ -50,8 +50,8 @@ public abstract class AbstractSignatureO
 
     private InternalSignatureOutputProcessor activeInternalSignatureOutputProcessor = null;
 
-    public AbstractSignatureOutputProcessor(XMLSecurityProperties securityProperties, XMLSecurityConstants.Action action) throws XMLSecurityException {
-        super(securityProperties, action);
+    public AbstractSignatureOutputProcessor() throws XMLSecurityException {
+        super();
     }
 
     public List<SignaturePartDef> getSignaturePartDefList() {
@@ -79,18 +79,21 @@ public abstract class AbstractSignatureO
         private DigestOutputStream digestOutputStream;
         private Transformer transformer;
 
-        public InternalSignatureOutputProcessor(XMLSecurityProperties securityProperties, XMLSecurityConstants.Action action, SignaturePartDef signaturePartDef, QName startElement) throws XMLSecurityException, NoSuchProviderException, NoSuchAlgorithmException {
-            super(securityProperties, action);
+        public InternalSignatureOutputProcessor(SignaturePartDef signaturePartDef, QName startElement) throws XMLSecurityException, NoSuchProviderException, NoSuchAlgorithmException {
+            super();
             this.getBeforeProcessors().add(InternalSignatureOutputProcessor.class.getName());
             this.signaturePartDef = signaturePartDef;
             this.startElement = startElement;
+        }
 
-            AlgorithmType algorithmID = JCEAlgorithmMapper.getAlgorithmMapping(getSecurityProperties().getSignatureDigestAlgorithm());
-            MessageDigest messageDigest = MessageDigest.getInstance(algorithmID.getJCEName(), algorithmID.getJCEProvider());
-            this.digestOutputStream = new DigestOutputStream(messageDigest);
-            this.bufferedDigestOutputStream = new BufferedOutputStream(digestOutputStream);
-
+        @Override
+        public void init(OutputProcessorChain outputProcessorChain) throws XMLSecurityException {
             try {
+                AlgorithmType algorithmID = JCEAlgorithmMapper.getAlgorithmMapping(getSecurityProperties().getSignatureDigestAlgorithm());
+                MessageDigest messageDigest = MessageDigest.getInstance(algorithmID.getJCEName(), algorithmID.getJCEProvider());
+                this.digestOutputStream = new DigestOutputStream(messageDigest);
+                this.bufferedDigestOutputStream = new BufferedOutputStream(digestOutputStream);
+
                 if (signaturePartDef.getTransformAlgo() != null) {
                     List<String> inclusiveNamespaces = new ArrayList<String>();
                     inclusiveNamespaces.add("#default");
@@ -107,7 +110,13 @@ public abstract class AbstractSignatureO
                 throw new XMLSecurityException(XMLSecurityException.ErrorCode.FAILED_SIGNATURE, e);
             } catch (InvocationTargetException e) {
                 throw new XMLSecurityException(XMLSecurityException.ErrorCode.FAILED_SIGNATURE, e);
+            } catch (NoSuchAlgorithmException e) {
+                throw new XMLSecurityException(XMLSecurityException.ErrorCode.FAILED_SIGNATURE, e);
+            } catch (NoSuchProviderException e) {
+                throw new XMLSecurityException(XMLSecurityException.ErrorCode.FAILED_SIGNATURE, e);
             }
+
+            super.init(outputProcessorChain);
         }
 
         @Override

Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/FinalOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/FinalOutputProcessor.java?rev=1311068&r1=1311067&r2=1311068&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/FinalOutputProcessor.java (original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/FinalOutputProcessor.java Sun Apr  8 18:42:34 2012
@@ -18,7 +18,10 @@
  */
 package org.swssf.xmlsec.impl.processor.output;
 
-import org.swssf.xmlsec.ext.*;
+import org.swssf.xmlsec.ext.AbstractOutputProcessor;
+import org.swssf.xmlsec.ext.OutputProcessorChain;
+import org.swssf.xmlsec.ext.XMLSecurityConstants;
+import org.swssf.xmlsec.ext.XMLSecurityException;
 import org.swssf.xmlsec.impl.XMLSecurityEventWriter;
 
 import javax.xml.stream.XMLEventWriter;
@@ -44,10 +47,8 @@ public class FinalOutputProcessor extend
         xmlOutputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, false);
     }
 
-    public FinalOutputProcessor(OutputStream outputStream, String encoding,
-                                XMLSecurityProperties securityProperties,
-                                XMLSecurityConstants.Action action) throws XMLSecurityException {
-        super(securityProperties, action);
+    public FinalOutputProcessor(OutputStream outputStream, String encoding) throws XMLSecurityException {
+        super();
         setPhase(XMLSecurityConstants.Phase.POSTPROCESSING);
         try {
             xmlEventWriter = xmlOutputFactory.createXMLEventWriter(outputStream, encoding);
@@ -56,10 +57,8 @@ public class FinalOutputProcessor extend
         }
     }
 
-    public FinalOutputProcessor(XMLStreamWriter xmlStreamWriter,
-                                XMLSecurityProperties securityProperties,
-                                XMLSecurityConstants.Action action) throws XMLSecurityException {
-        super(securityProperties, action);
+    public FinalOutputProcessor(XMLStreamWriter xmlStreamWriter) throws XMLSecurityException {
+        super();
         setPhase(XMLSecurityConstants.Phase.POSTPROCESSING);
         this.xmlEventWriter = new XMLSecurityEventWriter(xmlStreamWriter);
     }

Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/OutputProcessorChainTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/OutputProcessorChainTest.java?rev=1311068&r1=1311067&r2=1311068&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/OutputProcessorChainTest.java (original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/OutputProcessorChainTest.java Sun Apr  8 18:42:34 2012
@@ -18,10 +18,7 @@
  */
 package org.swssf.xmlsec.test;
 
-import org.swssf.xmlsec.ext.OutputProcessor;
-import org.swssf.xmlsec.ext.OutputProcessorChain;
-import org.swssf.xmlsec.ext.XMLSecurityConstants;
-import org.swssf.xmlsec.ext.XMLSecurityException;
+import org.swssf.xmlsec.ext.*;
 import org.swssf.xmlsec.impl.OutputProcessorChainImpl;
 import org.swssf.xmlsec.impl.SecurityContextImpl;
 import org.testng.Assert;
@@ -44,6 +41,15 @@ public class OutputProcessorChainTest {
         private Set<Object> beforeProcessors = new HashSet<Object>();
         private Set<Object> afterProcessors = new HashSet<Object>();
 
+        public void setXMLSecurityProperties(XMLSecurityProperties xmlSecurityProperties) {
+        }
+
+        public void setAction(XMLSecurityConstants.Action action) {
+        }
+
+        public void init(OutputProcessorChain outputProcessorChain) throws XMLSecurityException {
+        }
+
         public Set<Object> getBeforeProcessors() {
             return beforeProcessors;
         }

Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/XMLSecurityStreamWriterTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/XMLSecurityStreamWriterTest.java?rev=1311068&r1=1311067&r2=1311068&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/XMLSecurityStreamWriterTest.java (original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/XMLSecurityStreamWriterTest.java Sun Apr  8 18:42:34 2012
@@ -19,10 +19,7 @@
 package org.swssf.xmlsec.test;
 
 import org.custommonkey.xmlunit.XMLAssert;
-import org.swssf.xmlsec.ext.OutputProcessor;
-import org.swssf.xmlsec.ext.OutputProcessorChain;
-import org.swssf.xmlsec.ext.XMLSecurityConstants;
-import org.swssf.xmlsec.ext.XMLSecurityException;
+import org.swssf.xmlsec.ext.*;
 import org.swssf.xmlsec.impl.OutputProcessorChainImpl;
 import org.swssf.xmlsec.impl.SecurityContextImpl;
 import org.swssf.xmlsec.impl.XMLSecurityStreamWriter;
@@ -187,6 +184,18 @@ public class XMLSecurityStreamWriterTest
         }
 
         @Override
+        public void setXMLSecurityProperties(XMLSecurityProperties xmlSecurityProperties) {
+        }
+
+        @Override
+        public void setAction(XMLSecurityConstants.Action action) {
+        }
+
+        @Override
+        public void init(OutputProcessorChain outputProcessorChain) throws XMLSecurityException {
+        }
+
+        @Override
         public Set<Object> getBeforeProcessors() {
             return new HashSet<Object>();
         }



Mime
View raw message