ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gi...@apache.org
Subject svn commit: r1337945 [1/5] - in /webservices/wss4j/branches/swssf: ./ cxf-integration/src/main/java/org/swssf/cxfIntegration/interceptor/ cxf-integration/src/test/java/org/swssf/cxfIntegration/test/integration/ cxf-integration/src/test/resources/ cxf-i...
Date Sun, 13 May 2012 17:27:13 GMT
Author: giger
Date: Sun May 13 17:27:10 2012
New Revision: 1337945

URL: http://svn.apache.org/viewvc?rev=1337945&view=rev
Log:
Performance improvements

Modified:
    webservices/wss4j/branches/swssf/cxf-integration/src/main/java/org/swssf/cxfIntegration/interceptor/SecurityInInterceptor.java
    webservices/wss4j/branches/swssf/cxf-integration/src/test/java/org/swssf/cxfIntegration/test/integration/CXFIntegrationTest.java
    webservices/wss4j/branches/swssf/cxf-integration/src/test/resources/integration/test-application-context.xml
    webservices/wss4j/branches/swssf/cxf-integration/src/test/resources/log4j-cxf.xml
    webservices/wss4j/branches/swssf/pom.xml
    webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/PolicyEnforcer.java
    webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/PolicyInputProcessor.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/WSSec.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/InboundWSSec.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/WSSConstants.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/WSSUtils.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/InboundWSSecurityContextImpl.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/WSSDocumentContextImpl.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/WSSecurityContextImpl.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/derivedKey/P_SHA1.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/BinarySecurityTokenInputHandler.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/DecryptInputProcessor.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/EncryptedKeyInputHandler.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/OperationInputProcessor.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/ReferenceListInputHandler.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/SAMLTokenInputHandler.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/SecurityHeaderInputProcessor.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/SignatureInputHandler.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/SignatureReferenceVerifyInputProcessor.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/TimestampInputHandler.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/UsernameTokenInputHandler.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-ws-security/src/main/java/org/swssf/wss/impl/saml/builder/SAML1ComponentBuilder.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/saml/builder/SAML2ComponentBuilder.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/securityToken/SecurityTokenFactoryImpl.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/AbstractElementSecurityEvent.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/AbstractTestBase.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/DerivedKeyTokenTest.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/SignatureTest.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/config/ConfigurationProperties.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/config/Init.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/config/JCEAlgorithmMapper.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/config/SecurityHeaderHandlerMapper.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/config/TransformerAlgorithmMapper.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/AbstractInputProcessor.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/AbstractInputSecurityHeaderHandler.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/ComparableAttribute.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/ComparableNamespace.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/InputProcessor.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/ext/SecurityContext.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/XMLEventNS.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/XMLSecurityConstants.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/XMLSecurityProperties.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/XMLSecurityUtils.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/DocumentContextImpl.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/InputProcessorChainImpl.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/OutputProcessorChainImpl.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/SecurityContextImpl.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/XMLSecurityEventReader.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/XMLSecurityEventWriter.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/XMLSecurityStreamReader.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/XMLSecurityStreamWriter.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/algorithms/ECDSAUtils.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/algorithms/HMACSignatureAlgorithm.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/algorithms/PKISignatureAlgorithm.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/algorithms/SignatureAlgorithm.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/input/AbstractDecryptInputProcessor.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/input/AbstractSignatureReferenceVerifyInputProcessor.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/input/LogInputProcessor.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/input/XMLEventReaderInputProcessor.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/transformer/canonicalizer/Canonicalizer11.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/Canonicalizer20010315_Excl.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/transformer/canonicalizer/CanonicalizerBase.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/util/DigestOutputStream.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/util/RFC2253Parser.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/util/SignerOutputStream.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/InputProcessorChainTest.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/UncategorizedTest.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/XMLSecurityEventReaderTest.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/XMLSecurityStreamReaderTest.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/XMLSecurityStreamWriterTest.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/test/java/org/swssf/xmlsec/test/utils/XMLEventNSAllocator.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/test/resources/testdata/plain-soap-1.1.xml

Modified: webservices/wss4j/branches/swssf/cxf-integration/src/main/java/org/swssf/cxfIntegration/interceptor/SecurityInInterceptor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/cxf-integration/src/main/java/org/swssf/cxfIntegration/interceptor/SecurityInInterceptor.java?rev=1337945&r1=1337944&r2=1337945&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/cxf-integration/src/main/java/org/swssf/cxfIntegration/interceptor/SecurityInInterceptor.java (original)
+++ webservices/wss4j/branches/swssf/cxf-integration/src/main/java/org/swssf/cxfIntegration/interceptor/SecurityInInterceptor.java Sun May 13 17:27:10 2012
@@ -34,8 +34,8 @@ import org.swssf.wss.securityEvent.Secur
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
-import java.util.ArrayList;
 import java.util.HashSet;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Set;
 
@@ -66,7 +66,7 @@ public class SecurityInInterceptor exten
         XMLStreamReader originalXmlStreamReader = soapMessage.getContent(XMLStreamReader.class);
         XMLStreamReader newXmlStreamReader = null;
 
-        final List<SecurityEvent> incomingSecurityEventList = new ArrayList<SecurityEvent>();
+        final List<SecurityEvent> incomingSecurityEventList = new LinkedList<SecurityEvent>();
         SecurityEventListener securityEventListener = new SecurityEventListener() {
             public void registerSecurityEvent(SecurityEvent securityEvent) throws WSSecurityException {
                 incomingSecurityEventList.add(securityEvent);

Modified: webservices/wss4j/branches/swssf/cxf-integration/src/test/java/org/swssf/cxfIntegration/test/integration/CXFIntegrationTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/cxf-integration/src/test/java/org/swssf/cxfIntegration/test/integration/CXFIntegrationTest.java?rev=1337945&r1=1337944&r2=1337945&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/cxf-integration/src/test/java/org/swssf/cxfIntegration/test/integration/CXFIntegrationTest.java (original)
+++ webservices/wss4j/branches/swssf/cxf-integration/src/test/java/org/swssf/cxfIntegration/test/integration/CXFIntegrationTest.java Sun May 13 17:27:10 2012
@@ -49,12 +49,12 @@ public class CXFIntegrationTest {
             final Client client = ClientProxy.getClient(greeterStream);
             WSS4JOutInterceptor wss4JOutInterceptor = new WSS4JOutInterceptor();
             wss4JOutInterceptor.setProperty(WSHandlerConstants.ACTION, "Timestamp Signature Encrypt");
-            //wss4JOutInterceptor.setProperty(WSHandlerConstants.ACTION, "Encrypt");
             wss4JOutInterceptor.setProperty(WSHandlerConstants.USER, "transmitter");
             wss4JOutInterceptor.setProperty(WSHandlerConstants.ENCRYPTION_USER, "receiver");
             wss4JOutInterceptor.setProperty(WSHandlerConstants.PW_CALLBACK_CLASS, WSS4JCallbackHandlerImpl.class.getName());
             wss4JOutInterceptor.setProperty(WSHandlerConstants.SIG_PROP_FILE, "transmitter-crypto.properties");
             wss4JOutInterceptor.setProperty(WSHandlerConstants.ENC_PROP_FILE, "transmitter-crypto.properties");
+            wss4JOutInterceptor.setProperty(WSHandlerConstants.ENC_SYM_ALGO, "http://www.w3.org/2001/04/xmlenc#aes256-cbc");
             client.getOutInterceptors().add(wss4JOutInterceptor);
 
             WSS4JInInterceptor wss4JInInterceptor = new WSS4JInInterceptor();
@@ -72,13 +72,13 @@ public class CXFIntegrationTest {
             greeterWSS4J = soapService.getSoapPort();
             final Client client = ClientProxy.getClient(greeterWSS4J);
             WSS4JOutInterceptor wss4JOutInterceptor = new WSS4JOutInterceptor();
-            //wss4JOutInterceptor.setProperty(WSHandlerConstants.ACTION, "Timestamp Signature Encrypt");
             wss4JOutInterceptor.setProperty(WSHandlerConstants.ACTION, "Timestamp Signature Encrypt");
             wss4JOutInterceptor.setProperty(WSHandlerConstants.USER, "transmitter");
             wss4JOutInterceptor.setProperty(WSHandlerConstants.ENCRYPTION_USER, "receiver");
             wss4JOutInterceptor.setProperty(WSHandlerConstants.PW_CALLBACK_CLASS, WSS4JCallbackHandlerImpl.class.getName());
             wss4JOutInterceptor.setProperty(WSHandlerConstants.SIG_PROP_FILE, "transmitter-crypto.properties");
             wss4JOutInterceptor.setProperty(WSHandlerConstants.ENC_PROP_FILE, "transmitter-crypto.properties");
+            wss4JOutInterceptor.setProperty(WSHandlerConstants.ENC_SYM_ALGO, "http://www.w3.org/2001/04/xmlenc#aes256-cbc");
             client.getOutInterceptors().add(wss4JOutInterceptor);
 
             WSS4JInInterceptor wss4JInInterceptor = new WSS4JInInterceptor();
@@ -97,6 +97,7 @@ public class CXFIntegrationTest {
 
     @Test(alwaysRun = true)
     public void startTiming() {
+        System.gc();
         System.out.println("startTiming");
         starttime = System.currentTimeMillis();
     }
@@ -105,12 +106,12 @@ public class CXFIntegrationTest {
     public void stopTiming() {
         System.out.println("Streaming: 100 invocations took " + (System.currentTimeMillis() - starttime) + " milliseconds");
         System.out.flush();
+        System.gc();
     }
 
-    @Test(invocationCount = 100, threadPoolSize = 10, dependsOnMethods = {"startTiming", "testCXFWSS4J"})
-    //@Test(invocationCount = 1, threadPoolSize = 10)
+    @Test(invocationCount = 100, threadPoolSize = 10, dependsOnMethods = {"startTiming"})
     public void testCXF() throws Exception {
-        String resp = greeterStream.greetMe("Hey Stream Service. It's me, the client. Nice to meet you...");
+        String resp = greeterStream.greetMe("Hey Service. It's me, the client. Nice to meet you...");
         //System.out.println(resp);
     }
 
@@ -118,6 +119,7 @@ public class CXFIntegrationTest {
 
     @Test(alwaysRun = true)
     public void startTimingWSS4J() {
+        System.gc();
         System.out.println("startTiming");
         starttimeWSS4J = System.currentTimeMillis();
     }
@@ -126,11 +128,12 @@ public class CXFIntegrationTest {
     public void stopTimingWSS4J() {
         System.out.println("DOM: 100 invocations took " + (System.currentTimeMillis() - starttimeWSS4J) + " milliseconds");
         System.out.flush();
+        System.gc();
     }
 
     @Test(invocationCount = 100, threadPoolSize = 10, dependsOnMethods = "startTimingWSS4J")
     public void testCXFWSS4J() throws Exception {
-        String resp = greeterWSS4J.greetMe("Hey DOM Service. It's me, the client. Nice to meet you...");
+        String resp = greeterWSS4J.greetMe("Hey Service. It's me, the client. Nice to meet you...");
         //System.out.println(resp);
     }
 }

Modified: webservices/wss4j/branches/swssf/cxf-integration/src/test/resources/integration/test-application-context.xml
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/cxf-integration/src/test/resources/integration/test-application-context.xml?rev=1337945&r1=1337944&r2=1337945&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/cxf-integration/src/test/resources/integration/test-application-context.xml (original)
+++ webservices/wss4j/branches/swssf/cxf-integration/src/test/resources/integration/test-application-context.xml Sun May 13 17:27:10 2012
@@ -166,6 +166,8 @@
                 <entry key="signaturePropFile" value="receiver-crypto.properties"/>
                 <entry key="user" value="receiver"/>
                 <entry key="encryptionUser" value="transmitter"/>
+                <entry key="encryptionSymAlgorithm" value="http://www.w3.org/2001/04/xmlenc#aes256-cbc"/>
+                <entry key="encryptionKeyTransportAlgorithm" value="http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p"/>
             </map>
         </property>
     </bean>

Modified: webservices/wss4j/branches/swssf/cxf-integration/src/test/resources/log4j-cxf.xml
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/cxf-integration/src/test/resources/log4j-cxf.xml?rev=1337945&r1=1337944&r2=1337945&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/cxf-integration/src/test/resources/log4j-cxf.xml (original)
+++ webservices/wss4j/branches/swssf/cxf-integration/src/test/resources/log4j-cxf.xml Sun May 13 17:27:10 2012
@@ -17,7 +17,7 @@
         <level value="INFO"/>
     </logger>
     <root>
-        <level value="INFO"/>
+        <priority value="INFO"/>
         <appender-ref ref="FILE"/>
         <appender-ref ref="STDOUT"/>
     </root>

Modified: webservices/wss4j/branches/swssf/pom.xml
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/pom.xml?rev=1337945&r1=1337944&r2=1337945&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/pom.xml (original)
+++ webservices/wss4j/branches/swssf/pom.xml Sun May 13 17:27:10 2012
@@ -110,6 +110,7 @@
                         <exclude>.pmd/**</exclude>
                         <exclude>.externalToolBuilders/**</exclude>
                         <exclude>.checkstyle/**</exclude>
+                        <exclude>.idea/**</exclude>
                         <exclude>src/main/resources/**</exclude>
                         <exclude>src/test/resources/**</exclude>
                         <exclude>**/*.patch</exclude>

Modified: webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/PolicyEnforcer.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/PolicyEnforcer.java?rev=1337945&r1=1337944&r2=1337945&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/PolicyEnforcer.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/PolicyEnforcer.java Sun May 13 17:27:10 2012
@@ -69,7 +69,7 @@ public class PolicyEnforcer implements S
         assertionStateMap = new LinkedList<Map<SecurityEvent.Event, Map<Assertion, List<Assertable>>>>();
         failedAssertionStateMap = new LinkedList<Map<SecurityEvent.Event, Map<Assertion, List<Assertable>>>>();
 
-        if (soapAction != null && !soapAction.equals("")) {
+        if (soapAction != null && !soapAction.isEmpty()) {
             effectivePolicy = findPolicyBySOAPAction(operationPolicies, soapAction);
             if (effectivePolicy != null) {
                 buildAssertionStateMap(effectivePolicy.getPolicy(), assertionStateMap);

Modified: webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/PolicyInputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/PolicyInputProcessor.java?rev=1337945&r1=1337944&r2=1337945&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/PolicyInputProcessor.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-policy/src/main/java/org/swssf/policy/PolicyInputProcessor.java Sun May 13 17:27:10 2012
@@ -45,7 +45,7 @@ public class PolicyInputProcessor extend
     public PolicyInputProcessor(PolicyEnforcer policyEnforcer, XMLSecurityProperties securityProperties) {
         super(securityProperties);
         this.setPhase(WSSConstants.Phase.POSTPROCESSING);
-        this.getBeforeProcessors().add(SecurityHeaderInputProcessor.class.getName());
+        this.addBeforeProcessor(SecurityHeaderInputProcessor.class.getName());
         this.policyEnforcer = policyEnforcer;
     }
 

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/WSSec.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/WSSec.java?rev=1337945&r1=1337944&r2=1337945&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/WSSec.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/WSSec.java Sun May 13 17:27:10 2012
@@ -24,6 +24,7 @@ import org.swssf.xmlsec.ext.SecurePart;
 import org.swssf.xmlsec.ext.XMLSecurityConstants;
 import org.swssf.xmlsec.ext.XMLSecurityException;
 
+import java.net.URISyntaxException;
 import java.security.Provider;
 import java.security.Security;
 import java.util.ArrayList;
@@ -52,6 +53,14 @@ public class WSSec {
         } catch (Throwable e) {
             throw new RuntimeException("Adding BouncyCastle provider failed", e);
         }
+
+        try {
+            Init.init(WSSec.class.getClassLoader().getResource("wss/wss-config.xml").toURI());
+        } catch (XMLSecurityException e) {
+            throw new RuntimeException(e.getMessage(), e);
+        } catch (URISyntaxException e) {
+            throw new RuntimeException(e.getMessage(), e);
+        }
     }
 
     /**
@@ -69,12 +78,6 @@ public class WSSec {
             throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "missingSecurityProperties");
         }
 
-        try {
-            Init.init(WSSec.class.getClassLoader().getResource("wss/wss-config.xml"));
-        } catch (XMLSecurityException e) {
-            throw new WSSecurityException(e.getMessage(), e);
-        }
-
         securityProperties = validateAndApplyDefaultsToOutboundSecurityProperties(securityProperties);
         return new OutboundWSSec(securityProperties);
     }
@@ -94,12 +97,6 @@ public class WSSec {
             throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "missingSecurityProperties");
         }
 
-        try {
-            Init.init(WSSec.class.getClassLoader().getResource("wss/wss-config.xml"));
-        } catch (XMLSecurityException e) {
-            throw new WSSecurityException(e.getMessage(), e);
-        }
-
         securityProperties = validateAndApplyDefaultsToInboundSecurityProperties(securityProperties);
         return new InboundWSSec(securityProperties);
     }

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/InboundWSSec.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/InboundWSSec.java?rev=1337945&r1=1337944&r2=1337945&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/InboundWSSec.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/InboundWSSec.java Sun May 13 17:27:10 2012
@@ -38,7 +38,7 @@ import javax.xml.stream.XMLEventReader;
 import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
-import java.util.ArrayList;
+import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 
@@ -53,6 +53,20 @@ public class InboundWSSec {
 
     protected static final transient Log log = LogFactory.getLog(InboundWSSec.class);
 
+    private static final XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
+
+    static {
+        xmlInputFactory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
+        xmlInputFactory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
+        try {
+            xmlInputFactory.setProperty("org.codehaus.stax2.internNames", true);
+            xmlInputFactory.setProperty("org.codehaus.stax2.internNsUris", true);
+            xmlInputFactory.setProperty("org.codehaus.stax2.preserveLocation", false);
+        } catch (IllegalArgumentException e) {
+            //ignore
+        }
+    }
+
     private WSSSecurityProperties securityProperties;
 
     public InboundWSSec(WSSSecurityProperties securityProperties) {
@@ -77,7 +91,7 @@ public class InboundWSSec {
      * @throws WSSecurityException thrown when a Security failure occurs
      */
     public XMLStreamReader processInMessage(XMLStreamReader xmlStreamReader) throws XMLStreamException, WSSecurityException {
-        return this.processInMessage(xmlStreamReader, new ArrayList<SecurityEvent>(), null);
+        return this.processInMessage(xmlStreamReader, null, null);
     }
 
     /**
@@ -101,7 +115,7 @@ public class InboundWSSec {
     public XMLStreamReader processInMessage(XMLStreamReader xmlStreamReader, List<SecurityEvent> requestSecurityEvents, SecurityEventListener securityEventListener) throws XMLStreamException, WSSecurityException {
 
         if (requestSecurityEvents == null) {
-            requestSecurityEvents = new ArrayList<SecurityEvent>();
+            requestSecurityEvents = Collections.emptyList();
         }
 
         final InboundWSSecurityContextImpl securityContextImpl = new InboundWSSecurityContextImpl();
@@ -109,18 +123,18 @@ public class InboundWSSec {
         securityContextImpl.addSecurityEventListener(securityEventListener);
         securityContextImpl.ignoredBSPRules(this.securityProperties.getIgnoredBSPRules());
 
-        for (int i = 0; i < requestSecurityEvents.size(); i++) {
-            SecurityEvent securityEvent = requestSecurityEvents.get(i);
-            if (securityEvent instanceof HttpsTokenSecurityEvent) {
-                securityContextImpl.registerSecurityEvent(securityEvent);
-                securityContextImpl.put(WSSConstants.TRANSPORT_SECURITY_ACTIVE, Boolean.TRUE);
-                break;
+        if (!requestSecurityEvents.isEmpty()) {
+            Iterator<SecurityEvent> securityEventIterator = requestSecurityEvents.iterator();
+            while (securityEventIterator.hasNext()) {
+                SecurityEvent securityEvent = securityEventIterator.next();
+                if (securityEvent instanceof HttpsTokenSecurityEvent) {
+                    securityContextImpl.registerSecurityEvent(securityEvent);
+                    securityContextImpl.put(WSSConstants.TRANSPORT_SECURITY_ACTIVE, Boolean.TRUE);
+                    break;
+                }
             }
         }
 
-        final XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
-        xmlInputFactory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
-        xmlInputFactory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
         securityContextImpl.put(WSSConstants.XMLINPUTFACTORY, xmlInputFactory);
         final XMLEventReader xmlEventReader = xmlInputFactory.createXMLEventReader(xmlStreamReader);
 
@@ -137,15 +151,17 @@ public class InboundWSSec {
 
         if (log.isTraceEnabled()) {
             LogInputProcessor logInputProcessor = new LogInputProcessor(securityProperties);
-            logInputProcessor.getAfterProcessors().add(SecurityHeaderInputProcessor.class.getName());
+            logInputProcessor.addAfterProcessor(SecurityHeaderInputProcessor.class.getName());
             inputProcessorChain.addProcessor(logInputProcessor);
         }
 
         List<InputProcessor> additionalInputProcessors = securityProperties.getInputProcessorList();
-        Iterator<InputProcessor> inputProcessorIterator = additionalInputProcessors.iterator();
-        while (inputProcessorIterator.hasNext()) {
-            InputProcessor inputProcessor = inputProcessorIterator.next();
-            inputProcessorChain.addProcessor(inputProcessor);
+        if (!additionalInputProcessors.isEmpty()) {
+            Iterator<InputProcessor> inputProcessorIterator = additionalInputProcessors.iterator();
+            while (inputProcessorIterator.hasNext()) {
+                InputProcessor inputProcessor = inputProcessorIterator.next();
+                inputProcessorChain.addProcessor(inputProcessor);
+            }
         }
 
         return new XMLSecurityStreamReader(inputProcessorChain, securityProperties);

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/WSSConstants.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/WSSConstants.java?rev=1337945&r1=1337944&r2=1337945&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/WSSConstants.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/WSSConstants.java Sun May 13 17:27:10 2012
@@ -354,9 +354,9 @@ public class WSSConstants extends XMLSec
         }
     }
 
-    public static final List<QName> SOAP_11_BODY_PATH = new LinkedList<QName>();
-    public static final List<QName> SOAP_11_HEADER_PATH = new LinkedList<QName>();
-    public static final List<QName> WSSE_SECURITY_HEADER_PATH = new LinkedList<QName>();
+    public static final List<QName> SOAP_11_BODY_PATH = new ArrayList<QName>(2);
+    public static final List<QName> SOAP_11_HEADER_PATH = new ArrayList<QName>(2);
+    public static final List<QName> WSSE_SECURITY_HEADER_PATH = new ArrayList<QName>(3);
 
     static {
         SOAP_11_BODY_PATH.add(WSSConstants.TAG_soap11_Envelope);

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/WSSUtils.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/WSSUtils.java?rev=1337945&r1=1337944&r2=1337945&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/WSSUtils.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/WSSUtils.java Sun May 13 17:27:10 2012
@@ -111,6 +111,8 @@ public class WSSUtils extends XMLSecurit
                                                           Deque<XMLEvent> xmlEventDeque)
             throws XMLStreamException, XMLSecurityException {
 
+        final String actor = ((WSSSecurityProperties) abstractBufferingOutputProcessor.getSecurityProperties()).getActor();
+
         //loop until we reach our security header and set flag
         Iterator<XMLEvent> xmlEventIterator = xmlEventDeque.descendingIterator();
         while (xmlEventIterator.hasNext()) {
@@ -121,7 +123,7 @@ public class WSSUtils extends XMLSecurit
                         && isResponsibleActorOrRole(
                         startElement,
                         ((WSSDocumentContext) outputProcessorChain.getDocumentContext()).getSOAPMessageVersionNamespace(),
-                        ((WSSSecurityProperties) abstractBufferingOutputProcessor.getSecurityProperties()).getActor())) {
+                        actor)) {
                     ((WSSDocumentContext) outputProcessorChain.getDocumentContext()).setInSecurityHeader(true);
                     outputProcessorChain.reset();
                     outputProcessorChain.processEvent(xmlEvent);
@@ -139,7 +141,7 @@ public class WSSUtils extends XMLSecurit
         } else {
             //we have a dependent token. so we have to append the current header after the token
             boolean found = false;
-            while (xmlEventIterator.hasNext() && !found) {
+            while (!found && xmlEventIterator.hasNext()) {
                 XMLEvent xmlEvent = xmlEventIterator.next();
 
                 outputProcessorChain.reset();
@@ -152,7 +154,7 @@ public class WSSUtils extends XMLSecurit
 
                     @SuppressWarnings("unchecked")
                     Iterator<Attribute> attributeIterator = startElement.getAttributes();
-                    while (attributeIterator.hasNext() && !found) {
+                    while (!found && attributeIterator.hasNext()) {
                         Attribute attribute = attributeIterator.next();
                         final QName attributeName = attribute.getName();
                         final String attributeValue = attribute.getValue();
@@ -163,7 +165,7 @@ public class WSSUtils extends XMLSecurit
                             matchingElementName = startElement.getName();
                             //we found the token and...
                             int level = 0;
-                            while (xmlEventIterator.hasNext() && !found) {
+                            while (!found && xmlEventIterator.hasNext()) {
                                 xmlEvent = xmlEventIterator.next();
 
                                 outputProcessorChain.reset();
@@ -216,17 +218,17 @@ public class WSSUtils extends XMLSecurit
                                                           String referenceId, X509Certificate[] x509Certificates,
                                                           boolean useSingleCertificate)
             throws XMLStreamException, XMLSecurityException {
-        Map<QName, String> attributes = new HashMap<QName, String>();
+        List<Attribute> attributes = new ArrayList<Attribute>(3);
         String valueType;
         if (useSingleCertificate) {
             valueType = WSSConstants.NS_X509_V3_TYPE;
         } else {
             valueType = WSSConstants.NS_X509PKIPathv1;
         }
-        attributes.put(WSSConstants.ATT_NULL_EncodingType, WSSConstants.SOAPMESSAGE_NS10_BASE64_ENCODING);
-        attributes.put(WSSConstants.ATT_NULL_ValueType, valueType);
-        attributes.put(WSSConstants.ATT_wsu_Id, referenceId);
-        abstractOutputProcessor.createStartElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_wsse_BinarySecurityToken, attributes);
+        attributes.add(XMLSecurityConstants.XMLEVENTFACTORY.createAttribute(WSSConstants.ATT_NULL_EncodingType, WSSConstants.SOAPMESSAGE_NS10_BASE64_ENCODING));
+        attributes.add(XMLSecurityConstants.XMLEVENTFACTORY.createAttribute(WSSConstants.ATT_NULL_ValueType, valueType));
+        attributes.add(XMLSecurityConstants.XMLEVENTFACTORY.createAttribute(WSSConstants.ATT_wsu_Id, referenceId));
+        abstractOutputProcessor.createStartElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_wsse_BinarySecurityToken, false, attributes);
         try {
             if (useSingleCertificate) {
                 abstractOutputProcessor.createCharactersAndOutputAsEvent(outputProcessorChain, new Base64(76, new byte[]{'\n'}).encodeToString(x509Certificates[0].getEncoded()));
@@ -256,10 +258,10 @@ public class WSSUtils extends XMLSecurit
             throw new XMLSecurityException(XMLSecurityException.ErrorCode.FAILED_SIGNATURE, "invalidCertForSKI");
         }
 
-        Map<QName, String> attributes = new HashMap<QName, String>();
-        attributes.put(WSSConstants.ATT_NULL_EncodingType, WSSConstants.SOAPMESSAGE_NS10_BASE64_ENCODING);
-        attributes.put(WSSConstants.ATT_NULL_ValueType, WSSConstants.NS_X509SubjectKeyIdentifier);
-        abstractOutputProcessor.createStartElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_wsse_KeyIdentifier, attributes);
+        List<Attribute> attributes = new ArrayList<Attribute>(2);
+        attributes.add(XMLSecurityConstants.XMLEVENTFACTORY.createAttribute(WSSConstants.ATT_NULL_EncodingType, WSSConstants.SOAPMESSAGE_NS10_BASE64_ENCODING));
+        attributes.add(XMLSecurityConstants.XMLEVENTFACTORY.createAttribute(WSSConstants.ATT_NULL_ValueType, WSSConstants.NS_X509SubjectKeyIdentifier));
+        abstractOutputProcessor.createStartElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_wsse_KeyIdentifier, false, attributes);
         byte data[] = new Merlin().getSKIBytesFromCert(x509Certificates[0]);
         abstractOutputProcessor.createCharactersAndOutputAsEvent(outputProcessorChain, new Base64(76, new byte[]{'\n'}).encodeToString(data));
         abstractOutputProcessor.createEndElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_wsse_KeyIdentifier);
@@ -269,10 +271,10 @@ public class WSSUtils extends XMLSecurit
                                                         OutputProcessorChain outputProcessorChain,
                                                         X509Certificate[] x509Certificates)
             throws XMLStreamException, XMLSecurityException {
-        Map<QName, String> attributes = new HashMap<QName, String>();
-        attributes.put(WSSConstants.ATT_NULL_EncodingType, WSSConstants.SOAPMESSAGE_NS10_BASE64_ENCODING);
-        attributes.put(WSSConstants.ATT_NULL_ValueType, WSSConstants.NS_X509_V3_TYPE);
-        abstractOutputProcessor.createStartElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_wsse_KeyIdentifier, attributes);
+        List<Attribute> attributes = new ArrayList<Attribute>(2);
+        attributes.add(XMLSecurityConstants.XMLEVENTFACTORY.createAttribute(WSSConstants.ATT_NULL_EncodingType, WSSConstants.SOAPMESSAGE_NS10_BASE64_ENCODING));
+        attributes.add(XMLSecurityConstants.XMLEVENTFACTORY.createAttribute(WSSConstants.ATT_NULL_ValueType, WSSConstants.NS_X509_V3_TYPE));
+        abstractOutputProcessor.createStartElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_wsse_KeyIdentifier, false, attributes);
         try {
             abstractOutputProcessor.createCharactersAndOutputAsEvent(outputProcessorChain, new Base64(76, new byte[]{'\n'}).encodeToString(x509Certificates[0].getEncoded()));
         } catch (CertificateEncodingException e) {
@@ -285,10 +287,10 @@ public class WSSUtils extends XMLSecurit
                                                               OutputProcessorChain outputProcessorChain,
                                                               X509Certificate[] x509Certificates)
             throws XMLStreamException, XMLSecurityException {
-        Map<QName, String> attributes = new HashMap<QName, String>();
-        attributes.put(WSSConstants.ATT_NULL_EncodingType, WSSConstants.SOAPMESSAGE_NS10_BASE64_ENCODING);
-        attributes.put(WSSConstants.ATT_NULL_ValueType, WSSConstants.NS_THUMBPRINT);
-        abstractOutputProcessor.createStartElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_wsse_KeyIdentifier, attributes);
+        List<Attribute> attributes = new ArrayList<Attribute>(2);
+        attributes.add(XMLSecurityConstants.XMLEVENTFACTORY.createAttribute(WSSConstants.ATT_NULL_EncodingType, WSSConstants.SOAPMESSAGE_NS10_BASE64_ENCODING));
+        attributes.add(XMLSecurityConstants.XMLEVENTFACTORY.createAttribute(WSSConstants.ATT_NULL_ValueType, WSSConstants.NS_THUMBPRINT));
+        abstractOutputProcessor.createStartElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_wsse_KeyIdentifier, false, attributes);
         try {
             MessageDigest sha;
             sha = MessageDigest.getInstance("SHA-1");
@@ -309,12 +311,12 @@ public class WSSUtils extends XMLSecurit
                                                    OutputProcessorChain outputProcessorChain, String referenceId,
                                                    String valueType)
             throws XMLStreamException, XMLSecurityException {
-        Map<QName, String> attributes = new HashMap<QName, String>();
-        attributes.put(WSSConstants.ATT_NULL_URI, "#" + referenceId);
+        List<Attribute> attributes = new ArrayList<Attribute>(2);
+        attributes.add(XMLSecurityConstants.XMLEVENTFACTORY.createAttribute(WSSConstants.ATT_NULL_URI, "#" + referenceId));
         if (valueType != null) {
-            attributes.put(WSSConstants.ATT_NULL_ValueType, valueType);
+            attributes.add(XMLSecurityConstants.XMLEVENTFACTORY.createAttribute(WSSConstants.ATT_NULL_ValueType, valueType));
         }
-        abstractOutputProcessor.createStartElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_wsse_Reference, attributes);
+        abstractOutputProcessor.createStartElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_wsse_Reference, false, attributes);
         abstractOutputProcessor.createEndElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_wsse_Reference);
     }
 
@@ -322,13 +324,13 @@ public class WSSUtils extends XMLSecurit
                                                             OutputProcessorChain outputProcessorChain,
                                                             XMLSecurityConstants.TokenType tokenType, String referenceId)
             throws XMLStreamException, XMLSecurityException {
-        Map<QName, String> attributes = new HashMap<QName, String>();
+        List<Attribute> attributes = new ArrayList<Attribute>(1);
         if (tokenType.equals(WSSConstants.Saml10Token) || tokenType.equals(WSSConstants.Saml11Token)) {
-            attributes.put(WSSConstants.ATT_NULL_ValueType, WSSConstants.NS_SAML10_TYPE);
+            attributes.add(XMLSecurityConstants.XMLEVENTFACTORY.createAttribute(WSSConstants.ATT_NULL_ValueType, WSSConstants.NS_SAML10_TYPE));
         } else if (tokenType.equals(WSSConstants.Saml20Token)) {
-            attributes.put(WSSConstants.ATT_NULL_ValueType, WSSConstants.NS_SAML20_TYPE);
+            attributes.add(XMLSecurityConstants.XMLEVENTFACTORY.createAttribute(WSSConstants.ATT_NULL_ValueType, WSSConstants.NS_SAML20_TYPE));
         }
-        abstractOutputProcessor.createStartElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_wsse_KeyIdentifier, attributes);
+        abstractOutputProcessor.createStartElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_wsse_KeyIdentifier, false, attributes);
         abstractOutputProcessor.createCharactersAndOutputAsEvent(outputProcessorChain, referenceId);
         abstractOutputProcessor.createEndElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_wsse_KeyIdentifier);
     }
@@ -336,10 +338,10 @@ public class WSSUtils extends XMLSecurit
     public static void createUsernameTokenReferenceStructure(AbstractOutputProcessor abstractOutputProcessor,
                                                              OutputProcessorChain outputProcessorChain, String tokenId)
             throws XMLStreamException, XMLSecurityException {
-        Map<QName, String> attributes = new HashMap<QName, String>();
-        attributes.put(WSSConstants.ATT_NULL_URI, "#" + tokenId);
-        attributes.put(WSSConstants.ATT_NULL_ValueType, WSSConstants.NS_USERNAMETOKEN_PROFILE_UsernameToken);
-        abstractOutputProcessor.createStartElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_wsse_Reference, attributes);
+        List<Attribute> attributes = new ArrayList<Attribute>(2);
+        attributes.add(XMLSecurityConstants.XMLEVENTFACTORY.createAttribute(WSSConstants.ATT_NULL_URI, "#" + tokenId));
+        attributes.add(XMLSecurityConstants.XMLEVENTFACTORY.createAttribute(WSSConstants.ATT_NULL_ValueType, WSSConstants.NS_USERNAMETOKEN_PROFILE_UsernameToken));
+        abstractOutputProcessor.createStartElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_wsse_Reference, false, attributes);
         abstractOutputProcessor.createEndElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_wsse_Reference);
     }
 
@@ -351,47 +353,47 @@ public class WSSUtils extends XMLSecurit
         PublicKey publicKey = x509Certificate.getPublicKey();
         String algorithm = publicKey.getAlgorithm();
 
-        abstractOutputProcessor.createStartElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_dsig_KeyValue, null);
+        abstractOutputProcessor.createStartElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_dsig_KeyValue, true, null);
 
         if ("RSA".equals(algorithm)) {
             RSAPublicKey rsaPublicKey = (RSAPublicKey) publicKey;
-            abstractOutputProcessor.createStartElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_dsig_RSAKeyValue, null);
-            abstractOutputProcessor.createStartElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_dsig_Modulus, null);
+            abstractOutputProcessor.createStartElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_dsig_RSAKeyValue, false, null);
+            abstractOutputProcessor.createStartElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_dsig_Modulus, false, null);
             abstractOutputProcessor.createCharactersAndOutputAsEvent(outputProcessorChain, new Base64(76, new byte[]{'\n'}).encodeToString(rsaPublicKey.getModulus().toByteArray()));
             abstractOutputProcessor.createEndElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_dsig_Modulus);
-            abstractOutputProcessor.createStartElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_dsig_Exponent, null);
+            abstractOutputProcessor.createStartElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_dsig_Exponent, false, null);
             abstractOutputProcessor.createCharactersAndOutputAsEvent(outputProcessorChain, new Base64(76, new byte[]{'\n'}).encodeToString(rsaPublicKey.getPublicExponent().toByteArray()));
             abstractOutputProcessor.createEndElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_dsig_Exponent);
             abstractOutputProcessor.createEndElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_dsig_RSAKeyValue);
         } else if ("DSA".equals(algorithm)) {
             DSAPublicKey dsaPublicKey = (DSAPublicKey) publicKey;
             BigInteger j = dsaPublicKey.getParams().getP().subtract(BigInteger.ONE).divide(dsaPublicKey.getParams().getQ());
-            abstractOutputProcessor.createStartElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_dsig_DSAKeyValue, null);
-            abstractOutputProcessor.createStartElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_dsig_P, null);
+            abstractOutputProcessor.createStartElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_dsig_DSAKeyValue, false, null);
+            abstractOutputProcessor.createStartElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_dsig_P, false, null);
             abstractOutputProcessor.createCharactersAndOutputAsEvent(outputProcessorChain, new Base64(76, new byte[]{'\n'}).encodeToString(dsaPublicKey.getParams().getP().toByteArray()));
             abstractOutputProcessor.createEndElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_dsig_P);
-            abstractOutputProcessor.createStartElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_dsig_Q, null);
+            abstractOutputProcessor.createStartElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_dsig_Q, false, null);
             abstractOutputProcessor.createCharactersAndOutputAsEvent(outputProcessorChain, new Base64(76, new byte[]{'\n'}).encodeToString(dsaPublicKey.getParams().getQ().toByteArray()));
             abstractOutputProcessor.createEndElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_dsig_Q);
-            abstractOutputProcessor.createStartElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_dsig_G, null);
+            abstractOutputProcessor.createStartElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_dsig_G, false, null);
             abstractOutputProcessor.createCharactersAndOutputAsEvent(outputProcessorChain, new Base64(76, new byte[]{'\n'}).encodeToString(dsaPublicKey.getParams().getG().toByteArray()));
             abstractOutputProcessor.createEndElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_dsig_G);
-            abstractOutputProcessor.createStartElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_dsig_Y, null);
+            abstractOutputProcessor.createStartElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_dsig_Y, false, null);
             abstractOutputProcessor.createCharactersAndOutputAsEvent(outputProcessorChain, new Base64(76, new byte[]{'\n'}).encodeToString(dsaPublicKey.getY().toByteArray()));
             abstractOutputProcessor.createEndElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_dsig_Y);
-            abstractOutputProcessor.createStartElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_dsig_J, null);
+            abstractOutputProcessor.createStartElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_dsig_J, false, null);
             abstractOutputProcessor.createCharactersAndOutputAsEvent(outputProcessorChain, new Base64(76, new byte[]{'\n'}).encodeToString(j.toByteArray()));
             abstractOutputProcessor.createEndElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_dsig_J);
             abstractOutputProcessor.createEndElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_dsig_DSAKeyValue);
         } else if ("EC".equals(algorithm)) {
             ECPublicKey ecPublicKey = (ECPublicKey) publicKey;
 
-            Map<QName, String> attributes = new HashMap<QName, String>();
-            attributes.put(WSSConstants.ATT_NULL_URI, "urn:oid:" + ECDSAUtils.getOIDFromPublicKey(ecPublicKey));
-            abstractOutputProcessor.createStartElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_dsig11_ECKeyValue, null);
-            abstractOutputProcessor.createStartElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_dsig11_NamedCurve, attributes);
+            List<Attribute> attributes = new ArrayList<Attribute>(1);
+            attributes.add(XMLSecurityConstants.XMLEVENTFACTORY.createAttribute(WSSConstants.ATT_NULL_URI, "urn:oid:" + ECDSAUtils.getOIDFromPublicKey(ecPublicKey)));
+            abstractOutputProcessor.createStartElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_dsig11_ECKeyValue, true, null);
+            abstractOutputProcessor.createStartElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_dsig11_NamedCurve, false, attributes);
             abstractOutputProcessor.createEndElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_dsig11_NamedCurve);
-            abstractOutputProcessor.createStartElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_dsig11_PublicKey, null);
+            abstractOutputProcessor.createStartElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_dsig11_PublicKey, false, null);
             abstractOutputProcessor.createCharactersAndOutputAsEvent(outputProcessorChain, new Base64(76, new byte[]{'\n'}).encodeToString(ECDSAUtils.encodePoint(ecPublicKey.getW(), ecPublicKey.getParams().getCurve())));
             abstractOutputProcessor.createEndElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_dsig11_PublicKey);
             abstractOutputProcessor.createEndElementAndOutputAsEvent(outputProcessorChain, WSSConstants.TAG_dsig11_ECKeyValue);

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/InboundWSSecurityContextImpl.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/InboundWSSecurityContextImpl.java?rev=1337945&r1=1337944&r2=1337945&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/InboundWSSecurityContextImpl.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/InboundWSSecurityContextImpl.java Sun May 13 17:27:10 2012
@@ -29,10 +29,7 @@ import org.swssf.xmlsec.ext.SecurityToke
 import org.swssf.xmlsec.ext.XMLSecurityException;
 
 import javax.xml.namespace.QName;
-import java.util.Deque;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
+import java.util.*;
 
 /**
  * Concrete security context implementation
@@ -44,11 +41,11 @@ public class InboundWSSecurityContextImp
 
     private static final transient Log logger = LogFactory.getLog(WSSecurityContextImpl.class);
 
-    private Deque<SecurityEvent> securityEventQueue = new LinkedList<SecurityEvent>();
+    private Deque<SecurityEvent> securityEventQueue = new ArrayDeque<SecurityEvent>();
     private boolean operationSecurityEventOccured = false;
     private boolean messageEncryptionTokenOccured = false;
 
-    private List<WSSConstants.BSPRule> ignoredBSPRules = new LinkedList<WSSConstants.BSPRule>();
+    private List<WSSConstants.BSPRule> ignoredBSPRules = Collections.emptyList();
 
     public synchronized void registerSecurityEvent(SecurityEvent securityEvent) throws WSSecurityException {
 
@@ -252,7 +249,7 @@ public class InboundWSSecurityContextImp
             }
         }
 
-        if (messageSignatureTokens.size() == 0) {
+        if (messageSignatureTokens.isEmpty()) {
             SecurityToken messageSignatureToken = getSupportingTokenSigningToken(
                     signedSupportingTokens,
                     signedEndorsingSupportingTokens,
@@ -274,7 +271,7 @@ public class InboundWSSecurityContextImp
             }
         }
 
-        if (messageSignatureTokens.size() == 0) {
+        if (messageSignatureTokens.isEmpty()) {
             for (Iterator<TokenSecurityEvent> iterator = supportingTokens.iterator(); iterator.hasNext(); ) {
                 TokenSecurityEvent supportingToken = iterator.next();
                 if (supportingToken.getSecurityToken().getTokenUsages().contains(SecurityToken.TokenUsage.Signature)) {
@@ -285,7 +282,7 @@ public class InboundWSSecurityContextImp
             }
         }
 
-        if (messageEncryptionTokens.size() == 0) {
+        if (messageEncryptionTokens.isEmpty()) {
             for (Iterator<TokenSecurityEvent> iterator = supportingTokens.iterator(); iterator.hasNext(); ) {
                 TokenSecurityEvent supportingToken = iterator.next();
                 if (supportingToken.getSecurityToken().getTokenUsages().contains(SecurityToken.TokenUsage.Encryption)) {
@@ -296,7 +293,7 @@ public class InboundWSSecurityContextImp
             }
         }
 
-        if (messageEncryptionTokens.size() > 0) {
+        if (!messageEncryptionTokens.isEmpty()) {
             this.messageEncryptionTokenOccured = true;
         }
 
@@ -510,6 +507,6 @@ public class InboundWSSecurityContextImp
     }
 
     public void ignoredBSPRules(List<WSSConstants.BSPRule> bspRules) {
-        ignoredBSPRules.addAll(bspRules);
+        ignoredBSPRules = new ArrayList<WSSConstants.BSPRule>(bspRules);
     }
 }

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/WSSDocumentContextImpl.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/WSSDocumentContextImpl.java?rev=1337945&r1=1337944&r2=1337945&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/WSSDocumentContextImpl.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/WSSDocumentContextImpl.java Sun May 13 17:27:10 2012
@@ -23,7 +23,7 @@ import org.swssf.wss.ext.WSSDocumentCont
 import org.swssf.xmlsec.impl.DocumentContextImpl;
 
 import javax.xml.namespace.QName;
-import java.util.LinkedList;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -68,9 +68,8 @@ public class WSSDocumentContextImpl exte
     @Override
     protected WSSDocumentContextImpl clone() throws CloneNotSupportedException {
         WSSDocumentContextImpl documentContext = new WSSDocumentContextImpl();
-        List<QName> subPath = new LinkedList<QName>();
-        subPath.addAll(this.getPath());
         documentContext.setEncoding(this.getEncoding());
+        List<QName> subPath = new ArrayList<QName>(this.getPath());
         documentContext.setPath(subPath);
         documentContext.setInSecurityHeader(isInSecurityHeader());
         documentContext.setContentTypeMap(getContentTypeMap());

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/WSSecurityContextImpl.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/WSSecurityContextImpl.java?rev=1337945&r1=1337944&r2=1337945&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/WSSecurityContextImpl.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/WSSecurityContextImpl.java Sun May 13 17:27:10 2012
@@ -25,7 +25,7 @@ import org.swssf.wss.securityEvent.Secur
 import org.swssf.wss.securityEvent.SecurityEventListener;
 import org.swssf.xmlsec.impl.SecurityContextImpl;
 
-import java.util.LinkedList;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -36,7 +36,7 @@ import java.util.List;
  */
 public class WSSecurityContextImpl extends SecurityContextImpl implements WSSecurityContext {
 
-    private List<SecurityEventListener> securityEventListeners = new LinkedList<SecurityEventListener>();
+    private List<SecurityEventListener> securityEventListeners = new ArrayList<SecurityEventListener>(2);
 
     public void addSecurityEventListener(SecurityEventListener securityEventListener) {
         if (securityEventListener != null) {

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/derivedKey/P_SHA1.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/derivedKey/P_SHA1.java?rev=1337945&r1=1337944&r2=1337945&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/derivedKey/P_SHA1.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/derivedKey/P_SHA1.java Sun May 13 17:27:10 2012
@@ -57,7 +57,7 @@ public class P_SHA1
 
             byte[] key = new byte[length];
 
-            System.arraycopy(tempBytes, 0 + offset, key, 0, key.length);
+            System.arraycopy(tempBytes, offset, key, 0, key.length);
 
             return key;
         } catch (Exception ex) {

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/BinarySecurityTokenInputHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/BinarySecurityTokenInputHandler.java?rev=1337945&r1=1337944&r2=1337945&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/BinarySecurityTokenInputHandler.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/BinarySecurityTokenInputHandler.java Sun May 13 17:27:10 2012
@@ -45,8 +45,9 @@ public class BinarySecurityTokenInputHan
 
     @Override
     public void handle(final InputProcessorChain inputProcessorChain, final XMLSecurityProperties securityProperties,
-                       Deque<XMLEvent> eventQueue, Integer index) throws XMLSecurityException {
+                       final Deque<XMLEvent> eventQueue, final Integer index) throws XMLSecurityException {
 
+        @SuppressWarnings("unchecked")
         final BinarySecurityTokenType binarySecurityTokenType =
                 ((JAXBElement<BinarySecurityTokenType>) parseStructure(eventQueue, index, securityProperties)).getValue();
 
@@ -58,8 +59,9 @@ public class BinarySecurityTokenInputHan
 
         final List<QName> elementPath = getElementPath(inputProcessorChain.getDocumentContext(), eventQueue);
         final XMLEvent responsibleStartXMLEvent = getResponsibleStartXMLEvent(eventQueue, index);
+        final WSSecurityContext securityContext = (WSSecurityContext) inputProcessorChain.getSecurityContext();
 
-        SecurityTokenProvider securityTokenProvider = new SecurityTokenProvider() {
+        final SecurityTokenProvider securityTokenProvider = new SecurityTokenProvider() {
 
             private WSSecurityToken binarySecurityToken = null;
 
@@ -78,7 +80,7 @@ public class BinarySecurityTokenInputHan
                 }
                 this.binarySecurityToken = SecurityTokenFactoryImpl.getSecurityToken(
                         binarySecurityTokenType,
-                        inputProcessorChain.getSecurityContext(),
+                        securityContext,
                         crypto,
                         securityProperties.getCallbackHandler());
                 this.binarySecurityToken.setElementPath(elementPath);
@@ -91,23 +93,24 @@ public class BinarySecurityTokenInputHan
             }
         };
 
-        inputProcessorChain.getSecurityContext().registerSecurityTokenProvider(binarySecurityTokenType.getId(), securityTokenProvider);
+        securityContext.registerSecurityTokenProvider(binarySecurityTokenType.getId(), securityTokenProvider);
 
         //fire a tokenSecurityEvent
         X509TokenSecurityEvent x509TokenSecurityEvent = new X509TokenSecurityEvent();
         x509TokenSecurityEvent.setSecurityToken(securityTokenProvider.getSecurityToken());
-        ((WSSecurityContext) inputProcessorChain.getSecurityContext()).registerSecurityEvent(x509TokenSecurityEvent);
+        securityContext.registerSecurityEvent(x509TokenSecurityEvent);
     }
 
     private void checkBSPCompliance(InputProcessorChain inputProcessorChain, BinarySecurityTokenType binarySecurityTokenType) throws WSSecurityException {
+        final WSSecurityContext securityContext = (WSSecurityContext) inputProcessorChain.getSecurityContext();
         if (binarySecurityTokenType.getEncodingType() == null) {
-            ((WSSecurityContext) inputProcessorChain.getSecurityContext()).handleBSPRule(WSSConstants.BSPRule.R3029);
+            securityContext.handleBSPRule(WSSConstants.BSPRule.R3029);
         }
         if (!WSSConstants.SOAPMESSAGE_NS10_BASE64_ENCODING.equals(binarySecurityTokenType.getEncodingType())) {
-            ((WSSecurityContext) inputProcessorChain.getSecurityContext()).handleBSPRule(WSSConstants.BSPRule.R3030);
+            securityContext.handleBSPRule(WSSConstants.BSPRule.R3030);
         }
         if (binarySecurityTokenType.getValueType() == null) {
-            ((WSSecurityContext) inputProcessorChain.getSecurityContext()).handleBSPRule(WSSConstants.BSPRule.R3031);
+            securityContext.handleBSPRule(WSSConstants.BSPRule.R3031);
         }
     }
 }

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/DecryptInputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/DecryptInputProcessor.java?rev=1337945&r1=1337944&r2=1337945&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/DecryptInputProcessor.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/DecryptInputProcessor.java Sun May 13 17:27:10 2012
@@ -53,7 +53,8 @@ public class DecryptInputProcessor exten
         checkBSPCompliance(keyInfoType, referenceList, securityContext, WSSConstants.BSPRule.R3006);
     }
 
-    private void checkBSPCompliance(KeyInfoType keyInfoType, ReferenceList referenceList, WSSecurityContext securityContext, WSSConstants.BSPRule bspRule) throws WSSecurityException {
+    private void checkBSPCompliance(KeyInfoType keyInfoType, ReferenceList referenceList, WSSecurityContext securityContext,
+                                    WSSConstants.BSPRule bspRule) throws WSSecurityException {
         if (keyInfoType != null) {
             if (keyInfoType.getContent().size() != 1) {
                 securityContext.handleBSPRule(WSSConstants.BSPRule.R5424);
@@ -80,18 +81,19 @@ public class DecryptInputProcessor exten
     protected void handleEncryptedContent(InputProcessorChain inputProcessorChain, XMLEvent parentXMLEvent, XMLEvent xmlEvent,
                                           SecurityToken securityToken) throws XMLSecurityException {
 
-        List<QName> parentElementPath = inputProcessorChain.getDocumentContext().getParentElementPath(xmlEvent.getEventType());
-        if (inputProcessorChain.getDocumentContext().getDocumentLevel() == 3
-                && ((WSSDocumentContext) inputProcessorChain.getDocumentContext()).isInSOAPBody()) {
+        final WSSDocumentContext documentContext = (WSSDocumentContext) inputProcessorChain.getDocumentContext();
+        List<QName> parentElementPath = documentContext.getParentElementPath(xmlEvent.getEventType());
+        if (documentContext.getDocumentLevel() == 3
+                && documentContext.isInSOAPBody()) {
             //soap:body content encryption counts as EncryptedPart
             EncryptedPartSecurityEvent encryptedPartSecurityEvent =
-                    new EncryptedPartSecurityEvent(securityToken, true, inputProcessorChain.getDocumentContext().getProtectionOrder());
+                    new EncryptedPartSecurityEvent(securityToken, true, documentContext.getProtectionOrder());
             encryptedPartSecurityEvent.setElementPath(parentElementPath);
             encryptedPartSecurityEvent.setXmlEvent(parentXMLEvent);
             ((WSSecurityContext) inputProcessorChain.getSecurityContext()).registerSecurityEvent(encryptedPartSecurityEvent);
         } else {
             ContentEncryptedElementSecurityEvent contentEncryptedElementSecurityEvent =
-                    new ContentEncryptedElementSecurityEvent(securityToken, true, inputProcessorChain.getDocumentContext().getProtectionOrder());
+                    new ContentEncryptedElementSecurityEvent(securityToken, true, documentContext.getProtectionOrder());
             contentEncryptedElementSecurityEvent.setElementPath(parentElementPath);
             contentEncryptedElementSecurityEvent.setXmlEvent(parentXMLEvent);
             ((WSSecurityContext) inputProcessorChain.getSecurityContext()).registerSecurityEvent(contentEncryptedElementSecurityEvent);
@@ -160,17 +162,18 @@ public class DecryptInputProcessor exten
 
         protected void handleEncryptedElement(InputProcessorChain inputProcessorChain, XMLEvent xmlEvent, SecurityToken securityToken) throws XMLSecurityException {
             //fire a SecurityEvent:
-            if (inputProcessorChain.getDocumentContext().getDocumentLevel() == 3
-                    && ((WSSDocumentContext) inputProcessorChain.getDocumentContext()).isInSOAPHeader()) {
+            final WSSDocumentContext documentContext = (WSSDocumentContext) inputProcessorChain.getDocumentContext();
+            if (documentContext.getDocumentLevel() == 3
+                    && documentContext.isInSOAPHeader()) {
                 EncryptedPartSecurityEvent encryptedPartSecurityEvent =
-                        new EncryptedPartSecurityEvent(securityToken, true, inputProcessorChain.getDocumentContext().getProtectionOrder());
-                encryptedPartSecurityEvent.setElementPath(inputProcessorChain.getDocumentContext().getPath());
+                        new EncryptedPartSecurityEvent(securityToken, true, documentContext.getProtectionOrder());
+                encryptedPartSecurityEvent.setElementPath(documentContext.getPath());
                 encryptedPartSecurityEvent.setXmlEvent(xmlEvent);
                 ((WSSecurityContext) inputProcessorChain.getSecurityContext()).registerSecurityEvent(encryptedPartSecurityEvent);
             } else {
                 EncryptedElementSecurityEvent encryptedElementSecurityEvent =
-                        new EncryptedElementSecurityEvent(securityToken, true, inputProcessorChain.getDocumentContext().getProtectionOrder());
-                encryptedElementSecurityEvent.setElementPath(inputProcessorChain.getDocumentContext().getPath());
+                        new EncryptedElementSecurityEvent(securityToken, true, documentContext.getProtectionOrder());
+                encryptedElementSecurityEvent.setElementPath(documentContext.getPath());
                 encryptedElementSecurityEvent.setXmlEvent(xmlEvent);
                 ((WSSecurityContext) inputProcessorChain.getSecurityContext()).registerSecurityEvent(encryptedElementSecurityEvent);
             }

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/EncryptedKeyInputHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/EncryptedKeyInputHandler.java?rev=1337945&r1=1337944&r2=1337945&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/EncryptedKeyInputHandler.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/EncryptedKeyInputHandler.java Sun May 13 17:27:10 2012
@@ -58,10 +58,11 @@ public class EncryptedKeyInputHandler ex
 
     @Override
     public void handle(final InputProcessorChain inputProcessorChain, final XMLSecurityProperties securityProperties,
-                       Deque<XMLEvent> eventQueue, Integer index) throws XMLSecurityException {
+                       final Deque<XMLEvent> eventQueue, final Integer index) throws XMLSecurityException {
 
         @SuppressWarnings("unchecked")
-        final EncryptedKeyType encryptedKeyType = ((JAXBElement<EncryptedKeyType>) parseStructure(eventQueue, index, securityProperties)).getValue();
+        final EncryptedKeyType encryptedKeyType =
+                ((JAXBElement<EncryptedKeyType>) parseStructure(eventQueue, index, securityProperties)).getValue();
 
         if (encryptedKeyType.getEncryptionMethod() == null) {
             throw new WSSecurityException(WSSecurityException.ErrorCode.UNSUPPORTED_ALGORITHM, "noEncAlgo");
@@ -75,8 +76,9 @@ public class EncryptedKeyInputHandler ex
 
         final List<QName> elementPath = getElementPath(inputProcessorChain.getDocumentContext(), eventQueue);
         final XMLEvent responsibleStartXMLEvent = getResponsibleStartXMLEvent(eventQueue, index);
+        final WSSecurityContext securityContext = (WSSecurityContext) inputProcessorChain.getSecurityContext();
 
-        SecurityTokenProvider securityTokenProvider = new SecurityTokenProvider() {
+        final SecurityTokenProvider securityTokenProvider = new SecurityTokenProvider() {
 
             private WSSecurityToken securityToken = null;
 
@@ -87,7 +89,7 @@ public class EncryptedKeyInputHandler ex
                 }
 
                 this.securityToken = new AbstractSecurityToken(
-                        (WSSecurityContext) inputProcessorChain.getSecurityContext(), null, null,
+                        securityContext, null, null,
                         encryptedKeyType.getId(), null) {
 
                     private Map<String, Key> keyTable = new Hashtable<String, Key>();
@@ -131,7 +133,7 @@ public class EncryptedKeyInputHandler ex
                                 keyInfoType,
                                 crypto,
                                 securityProperties.getCallbackHandler(),
-                                inputProcessorChain.getSecurityContext()
+                                securityContext
                         );
                         this.wrappingSecurityToken.addWrappedToken(wrappedSecurityToken);
                         return this.wrappingSecurityToken;
@@ -157,7 +159,12 @@ public class EncryptedKeyInputHandler ex
                                 keyUsage = WSSConstants.Sym_Key_Wrap;
                             }
 
-                            Cipher cipher = Cipher.getInstance(asyncEncAlgo.getJCEName(), asyncEncAlgo.getJCEProvider());
+                            Cipher cipher;
+                            if (asyncEncAlgo.getJCEProvider() == null) {
+                                cipher = Cipher.getInstance(asyncEncAlgo.getJCEName());
+                            } else {
+                                cipher = Cipher.getInstance(asyncEncAlgo.getJCEName(), asyncEncAlgo.getJCEProvider());
+                            }
                             cipher.init(Cipher.DECRYPT_MODE, wrappingSecurityToken.getSecretKey(algorithmURI, keyUsage));
                             if (encryptedKeyType.getCipherData() == null
                                     || encryptedKeyType.getCipherData().getCipherValue() == null) {
@@ -198,12 +205,12 @@ public class EncryptedKeyInputHandler ex
         };
 
         //register the key token for decryption:
-        inputProcessorChain.getSecurityContext().registerSecurityTokenProvider(encryptedKeyType.getId(), securityTokenProvider);
+        securityContext.registerSecurityTokenProvider(encryptedKeyType.getId(), securityTokenProvider);
 
         //fire a tokenSecurityEvent
         TokenSecurityEvent tokenSecurityEvent = new EncryptedKeyTokenSecurityEvent();
         tokenSecurityEvent.setSecurityToken(securityTokenProvider.getSecurityToken());
-        ((WSSecurityContext) inputProcessorChain.getSecurityContext()).registerSecurityEvent(tokenSecurityEvent);
+        securityContext.registerSecurityEvent(tokenSecurityEvent);
 
         //if this EncryptedKey structure contains a reference list, instantiate a new DecryptInputProcessor
         //and add it to the chain
@@ -217,26 +224,27 @@ public class EncryptedKeyInputHandler ex
             keyInfoType.getContent().add(objectFactory.createSecurityTokenReference(securityTokenReferenceType));
             inputProcessorChain.addProcessor(
                     new DecryptInputProcessor(keyInfoType, encryptedKeyType.getReferenceList(),
-                            (WSSSecurityProperties) securityProperties, (WSSecurityContext) inputProcessorChain.getSecurityContext())
+                            (WSSSecurityProperties) securityProperties, securityContext)
             );
         }
     }
 
     private void checkBSPCompliance(InputProcessorChain inputProcessorChain, EncryptedKeyType encryptedKeyType) throws WSSecurityException {
+        final WSSecurityContext securityContext = (WSSecurityContext) inputProcessorChain.getSecurityContext();
         if (encryptedKeyType.getType() != null) {
-            ((WSSecurityContext) inputProcessorChain.getSecurityContext()).handleBSPRule(WSSConstants.BSPRule.R3209);
+            securityContext.handleBSPRule(WSSConstants.BSPRule.R3209);
         }
         if (encryptedKeyType.getMimeType() != null) {
-            ((WSSecurityContext) inputProcessorChain.getSecurityContext()).handleBSPRule(WSSConstants.BSPRule.R5622);
+            securityContext.handleBSPRule(WSSConstants.BSPRule.R5622);
         }
         if (encryptedKeyType.getEncoding() != null) {
-            ((WSSecurityContext) inputProcessorChain.getSecurityContext()).handleBSPRule(WSSConstants.BSPRule.R5623);
+            securityContext.handleBSPRule(WSSConstants.BSPRule.R5623);
         }
         if (encryptedKeyType.getRecipient() != null) {
-            ((WSSecurityContext) inputProcessorChain.getSecurityContext()).handleBSPRule(WSSConstants.BSPRule.R5602);
+            securityContext.handleBSPRule(WSSConstants.BSPRule.R5602);
         }
         if (encryptedKeyType.getEncryptionMethod() == null) {
-            ((WSSecurityContext) inputProcessorChain.getSecurityContext()).handleBSPRule(WSSConstants.BSPRule.R5603);
+            securityContext.handleBSPRule(WSSConstants.BSPRule.R5603);
         }
     }
 

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/OperationInputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/OperationInputProcessor.java?rev=1337945&r1=1337944&r2=1337945&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/OperationInputProcessor.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/OperationInputProcessor.java Sun May 13 17:27:10 2012
@@ -41,7 +41,7 @@ public class OperationInputProcessor ext
     public OperationInputProcessor(XMLSecurityProperties securityProperties) {
         super(securityProperties);
         this.setPhase(WSSConstants.Phase.POSTPROCESSING);
-        this.getBeforeProcessors().add(SecurityHeaderInputProcessor.class.getName());
+        this.addBeforeProcessor(SecurityHeaderInputProcessor.class.getName());
     }
 
     @Override

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/ReferenceListInputHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/ReferenceListInputHandler.java?rev=1337945&r1=1337944&r2=1337945&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/ReferenceListInputHandler.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/ReferenceListInputHandler.java Sun May 13 17:27:10 2012
@@ -39,7 +39,7 @@ public class ReferenceListInputHandler e
 
     @Override
     public void handle(final InputProcessorChain inputProcessorChain, final XMLSecurityProperties securityProperties,
-                       Deque<XMLEvent> eventQueue, Integer index) throws XMLSecurityException {
+                       final Deque<XMLEvent> eventQueue, final Integer index) throws XMLSecurityException {
 
         final ReferenceList referenceList = (ReferenceList) parseStructure(eventQueue, index, securityProperties);
 

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/SAMLTokenInputHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/SAMLTokenInputHandler.java?rev=1337945&r1=1337944&r2=1337945&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/SAMLTokenInputHandler.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/SAMLTokenInputHandler.java Sun May 13 17:27:10 2012
@@ -137,7 +137,7 @@ public class SAMLTokenInputHandler exten
             case XMLEvent.START_ELEMENT:
                 StartElement startElement = xmlEvent.asStartElement();
                 Element element = document.createElementNS(startElement.getName().getNamespaceURI(), startElement.getName().getLocalPart());
-                if (startElement.getName().getPrefix() != null && !"".equals(startElement.getName().getPrefix())) {
+                if (startElement.getName().getPrefix() != null && !startElement.getName().getPrefix().isEmpty()) {
                     element.setPrefix(startElement.getName().getPrefix());
                 }
                 currentNode = currentNode.appendChild(element);
@@ -197,10 +197,11 @@ public class SAMLTokenInputHandler exten
             case XMLEvent.NAMESPACE:
                 Namespace namespace = (Namespace) xmlEvent;
                 Attr namespaceNode;
-                if ("".equals(namespace.getPrefix())) {
+                String prefix = namespace.getPrefix();
+                if (prefix == null || prefix.isEmpty()) {
                     namespaceNode = document.createAttributeNS(WSSConstants.NS_XML, "xmlns");
                 } else {
-                    namespaceNode = document.createAttributeNS(WSSConstants.NS_XML, "xmlns:" + namespace.getPrefix());
+                    namespaceNode = document.createAttributeNS(WSSConstants.NS_XML, "xmlns:" + prefix);
                 }
                 namespaceNode.setValue(namespace.getNamespaceURI());
                 ((Element) currentNode).setAttributeNodeNS(namespaceNode);



Mime
View raw message