cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1492733 - in /cxf/trunk: rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/ rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/ systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/
Date Thu, 13 Jun 2013 16:16:57 GMT
Author: coheigea
Date: Thu Jun 13 16:16:57 2013
New Revision: 1492733

URL: http://svn.apache.org/r1492733
Log:
Added support for outbound Symmetric streaming WS-Security + enabled X.509 testcases

Modified:
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/AbstractWSS4JStaxInterceptor.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JStaxInInterceptor.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JStaxOutInterceptor.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxSymmetricBindingHandler.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/StaxX509TokenTest.java
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/X509TokenTest.java

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/AbstractWSS4JStaxInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/AbstractWSS4JStaxInterceptor.java?rev=1492733&r1=1492732&r2=1492733&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/AbstractWSS4JStaxInterceptor.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/AbstractWSS4JStaxInterceptor.java
Thu Jun 13 16:16:57 2013
@@ -37,12 +37,16 @@ import org.apache.cxf.binding.soap.inter
 import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.common.classloader.ClassLoaderUtils.ClassLoaderHolder;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.phase.PhaseInterceptor;
 import org.apache.cxf.resource.ResourceManager;
+import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.ws.security.SecurityConstants;
+import org.apache.cxf.ws.security.tokenstore.TokenStore;
+import org.apache.cxf.ws.security.tokenstore.TokenStoreFactory;
 import org.apache.wss4j.common.ConfigurationConstants;
 import org.apache.wss4j.common.crypto.Crypto;
 import org.apache.wss4j.common.crypto.CryptoFactory;
@@ -170,6 +174,27 @@ public abstract class AbstractWSS4JStaxI
             }
         }
     }
+    
+    protected final TokenStore getTokenStore(Message message) {
+        EndpointInfo info = message.getExchange().get(Endpoint.class).getEndpointInfo();
+        synchronized (info) {
+            TokenStore tokenStore = 
+                (TokenStore)message.getContextualProperty(SecurityConstants.TOKEN_STORE_CACHE_INSTANCE);
+            if (tokenStore == null) {
+                tokenStore = (TokenStore)info.getProperty(SecurityConstants.TOKEN_STORE_CACHE_INSTANCE);
+            }
+            if (tokenStore == null) {
+                TokenStoreFactory tokenStoreFactory = TokenStoreFactory.newInstance();
+                String cacheKey = SecurityConstants.TOKEN_STORE_CACHE_INSTANCE;
+                if (info.getName() != null) {
+                    cacheKey += "-" + info.getName().toString().hashCode();
+                }
+                tokenStore = tokenStoreFactory.newTokenStore(cacheKey, message);
+                info.setProperty(SecurityConstants.TOKEN_STORE_CACHE_INSTANCE, tokenStore);
+            }
+            return tokenStore;
+        }
+    }
 
     public Set<URI> getRoles() {
         return null;

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java?rev=1492733&r1=1492732&r2=1492733&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
Thu Jun 13 16:16:57 2013
@@ -82,7 +82,6 @@ import org.apache.wss4j.dom.WSSecurityEn
 import org.apache.wss4j.dom.handler.RequestData;
 import org.apache.wss4j.dom.handler.WSHandlerConstants;
 import org.apache.wss4j.dom.handler.WSHandlerResult;
-import org.apache.wss4j.dom.message.token.SecurityTokenReference;
 import org.apache.wss4j.dom.processor.Processor;
 import org.apache.wss4j.dom.util.WSSecurityUtil;
 import org.apache.wss4j.dom.validate.NoOpValidator;
@@ -589,23 +588,11 @@ public class WSS4JInInterceptor extends 
                 WSPasswordCallback pc = (WSPasswordCallback)callbacks[i];
                 
                 String id = pc.getIdentifier();
-                
-                if (SecurityTokenReference.ENC_KEY_SHA1_URI.equals(pc.getType())
-                    || WSConstants.WSS_KRB_KI_VALUE_TYPE.equals(pc.getType())) {
-                    for (String tokenId : store.getTokenIdentifiers()) {
-                        SecurityToken token = store.getToken(tokenId);
-                        if (token != null && id.equals(token.getSHA1())) {
-                            pc.setKey(token.getSecret());
-                            return;
-                        }
-                    }
-                } else { 
-                    SecurityToken tok = store.getToken(id);
-                    if (tok != null) {
-                        pc.setKey(tok.getSecret());
-                        pc.setCustomToken(tok.getToken());
-                        return;
-                    }
+                SecurityToken tok = store.getToken(id);
+                if (tok != null) {
+                    pc.setKey(tok.getSecret());
+                    pc.setCustomToken(tok.getToken());
+                    return;
                 }
             }
             if (internal != null) {

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JStaxInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JStaxInInterceptor.java?rev=1492733&r1=1492732&r2=1492733&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JStaxInInterceptor.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JStaxInInterceptor.java
Thu Jun 13 16:16:57 2013
@@ -18,12 +18,16 @@
  */
 package org.apache.cxf.ws.security.wss4j;
 
+import java.io.IOException;
 import java.util.Arrays;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.logging.Logger;
 
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 
@@ -39,9 +43,12 @@ import org.apache.cxf.interceptor.URIMap
 import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.ws.security.SecurityConstants;
+import org.apache.cxf.ws.security.tokenstore.SecurityToken;
+import org.apache.cxf.ws.security.tokenstore.TokenStore;
 import org.apache.wss4j.common.ConfigurationConstants;
 import org.apache.wss4j.common.cache.ReplayCache;
 import org.apache.wss4j.common.crypto.Crypto;
+import org.apache.wss4j.common.ext.WSPasswordCallback;
 import org.apache.wss4j.common.ext.WSSecurityException;
 import org.apache.wss4j.policy.WSSPolicyException;
 import org.apache.wss4j.stax.ConfigurationConverter;
@@ -115,6 +122,22 @@ public class WSS4JStaxInInterceptor exte
             configureProperties(soapMessage);
             configureCallbackHandler(soapMessage);
             
+            if (getSecurityProperties() != null) {
+                TokenStoreCallbackHandler callbackHandler = 
+                    new TokenStoreCallbackHandler(
+                        getSecurityProperties().getCallbackHandler(), getTokenStore(soapMessage)
+                    );
+                getSecurityProperties().setCallbackHandler(callbackHandler);
+            } else {
+                Map<String, Object> config = getProperties();
+                TokenStoreCallbackHandler callbackHandler = 
+                    new TokenStoreCallbackHandler(
+                        (CallbackHandler)config.get(ConfigurationConstants.PW_CALLBACK_REF),

+                        getTokenStore(soapMessage)
+                    );
+                config.put(ConfigurationConstants.PW_CALLBACK_REF, callbackHandler);
+            }
+            
             InboundWSSec inboundWSSec = null;
             WSSSecurityProperties secProps = null;
             if (getSecurityProperties() != null) {
@@ -335,4 +358,31 @@ public class WSS4JStaxInInterceptor exte
     public void setActions(List<String> actions) {
         this.actions = actions;
     }
+    
+    private class TokenStoreCallbackHandler implements CallbackHandler {
+        private CallbackHandler internal;
+        private TokenStore store;
+        public TokenStoreCallbackHandler(CallbackHandler in, TokenStore st) {
+            internal = in;
+            store = st;
+        }
+        
+        public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException
{
+            for (int i = 0; i < callbacks.length; i++) {
+                WSPasswordCallback pc = (WSPasswordCallback)callbacks[i];
+                
+                String id = pc.getIdentifier();
+                SecurityToken tok = store.getToken(id);
+                if (tok != null) {
+                    pc.setKey(tok.getSecret());
+                    pc.setCustomToken(tok.getToken());
+                    return;
+                }
+            }
+            if (internal != null) {
+                internal.handle(callbacks);
+            }
+        }
+        
+    }
 }

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JStaxOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JStaxOutInterceptor.java?rev=1492733&r1=1492732&r2=1492733&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JStaxOutInterceptor.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JStaxOutInterceptor.java
Thu Jun 13 16:16:57 2013
@@ -122,8 +122,8 @@ public class WSS4JStaxOutInterceptor ext
             translateProperties(mc);
             Map<String, SecurityTokenProvider<OutboundSecurityToken>> outboundTokens
= 
                 new HashMap<String, SecurityTokenProvider<OutboundSecurityToken>>();
-            configureProperties(mc, outboundTokens);
             configureCallbackHandler(mc);
+            configureProperties(mc, outboundTokens);
             
             OutboundWSSec outboundWSSec = null;
             WSSSecurityProperties secProps = null;

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxSymmetricBindingHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxSymmetricBindingHandler.java?rev=1492733&r1=1492732&r2=1492733&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxSymmetricBindingHandler.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxSymmetricBindingHandler.java
Thu Jun 13 16:16:57 2013
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.ws.security.wss4j.policyhandlers;
 
+import java.io.IOException;
 import java.security.NoSuchAlgorithmException;
 import java.util.ArrayList;
 import java.util.Date;
@@ -27,25 +28,25 @@ import java.util.Map;
 
 import javax.crypto.KeyGenerator;
 import javax.crypto.SecretKey;
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
 import javax.xml.namespace.QName;
 import javax.xml.soap.SOAPException;
 
 import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.common.util.StringUtils;
-import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.ws.policy.AssertionInfoMap;
 import org.apache.cxf.ws.security.SecurityConstants;
 import org.apache.cxf.ws.security.tokenstore.SecurityToken;
+import org.apache.cxf.ws.security.tokenstore.TokenStore;
 import org.apache.wss4j.common.ConfigurationConstants;
+import org.apache.wss4j.common.ext.WSPasswordCallback;
 import org.apache.wss4j.common.ext.WSSecurityException;
 import org.apache.wss4j.dom.WSConstants;
 import org.apache.wss4j.dom.WSSConfig;
-import org.apache.wss4j.dom.WSSecurityEngineResult;
-import org.apache.wss4j.dom.handler.WSHandlerConstants;
-import org.apache.wss4j.dom.handler.WSHandlerResult;
 import org.apache.wss4j.dom.util.WSSecurityUtil;
-import org.apache.wss4j.policy.SPConstants.IncludeTokenType;
 import org.apache.wss4j.policy.model.AbstractSymmetricAsymmetricBinding;
 import org.apache.wss4j.policy.model.AbstractToken;
 import org.apache.wss4j.policy.model.AbstractToken.DerivedKeys;
@@ -108,6 +109,14 @@ public class StaxSymmetricBindingHandler
         configureLayout(aim);
         sbinding = (SymmetricBinding)getBinding(aim);
         
+        // Set up CallbackHandler which wraps the configured Handler
+        Map<String, Object> config = getProperties();
+        TokenStoreCallbackHandler callbackHandler = 
+            new TokenStoreCallbackHandler(
+                (CallbackHandler)config.get(ConfigurationConstants.PW_CALLBACK_REF), getTokenStore()
+            );
+        config.put(ConfigurationConstants.PW_CALLBACK_REF, callbackHandler);
+        
         if (sbinding.getProtectionOrder() 
             == AbstractSymmetricAsymmetricBinding.ProtectionOrder.EncryptBeforeSigning) {
             doEncryptBeforeSign();
@@ -379,9 +388,8 @@ public class StaxSymmetricBindingHandler
         }
         
         AbstractToken sigToken = wrapper.getToken();
-        if (sbinding.isProtectTokens() && (sigToken instanceof X509Token)
-            && sigToken.getIncludeTokenType() != IncludeTokenType.INCLUDE_TOKEN_NEVER)
{
-            parts += "{Element}{" + WSSConstants.NS_WSSE10 + "}BinarySecurityToken;";
+        if (sbinding.isProtectTokens() && (sigToken instanceof X509Token)) {
+            parts += "{Element}{" + WSSConstants.NS_XMLENC + "}EncryptedKey;";
         }
         
         config.put(ConfigurationConstants.SIGNATURE_PARTS, parts);
@@ -428,34 +436,55 @@ public class StaxSymmetricBindingHandler
     }
     
     private String getEncryptedKey() {
+        // findEncryptedKeyToken(message);
+        /*
+        SecurityEvent event = findEncryptedKeyEvent(message);
+        if (event != null) {
+            org.apache.xml.security.stax.securityToken.SecurityToken securityToken = 
+                ((EncryptedKeyTokenSecurityEvent)event).getSecurityToken();
+            if (securityToken != null) {
+                Date created = new Date();
+                Date expires = new Date();
+                expires.setTime(created.getTime() + 300000);
+                
+                String encryptedKeyID = securityToken.getId();
+                System.out.println("ID: " + encryptedKeyID);
+                SecurityToken tempTok = new SecurityToken(encryptedKeyID, created, expires);
+                // tempTok.setSecret(securityToken.g);
+                //tempTok.setSHA1(getSHA1((byte[])wser
+                //                        .get(WSSecurityEngineResult.TAG_ENCRYPTED_EPHEMERAL_KEY)));
+                getTokenStore().add(tempTok);
+                
+                return encryptedKeyID;
+            }
+        }
+        System.out.println("EVENT NULL?: " + (event == null));
+        */
+        return null;
         
-        List<WSHandlerResult> results = CastUtils.cast((List<?>)message.getExchange().getInMessage()
-            .get(WSHandlerConstants.RECV_RESULTS));
-        
-        for (WSHandlerResult rResult : results) {
-            List<WSSecurityEngineResult> wsSecEngineResults = rResult.getResults();
-            
-            for (WSSecurityEngineResult wser : wsSecEngineResults) {
-                Integer actInt = (Integer)wser.get(WSSecurityEngineResult.TAG_ACTION);
-                String encryptedKeyID = (String)wser.get(WSSecurityEngineResult.TAG_ID);
-                if (actInt.intValue() == WSConstants.ENCR
-                    && encryptedKeyID != null
-                    && encryptedKeyID.length() != 0) {
-                    Date created = new Date();
-                    Date expires = new Date();
-                    expires.setTime(created.getTime() + 300000);
-                    SecurityToken tempTok = new SecurityToken(encryptedKeyID, created, expires);
-                    tempTok.setSecret((byte[])wser.get(WSSecurityEngineResult.TAG_SECRET));
-                    tempTok.setSHA1(getSHA1((byte[])wser
-                                            .get(WSSecurityEngineResult.TAG_ENCRYPTED_EPHEMERAL_KEY)));
-                    getTokenStore().add(tempTok);
-                    
-                    return encryptedKeyID;
+    }
+    /*
+     * TODO
+    private SecurityToken findEncryptedKeyToken(Message message) {
+        @SuppressWarnings("unchecked")
+        final List<SecurityEvent> incomingEventList = 
+            (List<SecurityEvent>) message.getExchange().get(SecurityEvent.class.getName()
+ ".in");
+        if (incomingEventList != null) {
+            for (SecurityEvent incomingEvent : incomingEventList) {
+                if (WSSecurityEventConstants.EncryptedPart == incomingEvent.getSecurityEventType()
+                    || WSSecurityEventConstants.EncryptedElement 
+                        == incomingEvent.getSecurityEventType()) {
+                    org.apache.xml.security.stax.securityToken.SecurityToken token = 
+                        ((AbstractSecuredElementSecurityEvent)incomingEvent).getSecurityToken();
+                    if (token != null && token.get) {
+                        
+                    }
                 }
             }
         }
         return null;
     }
+    */
     
     private String getSHA1(byte[] input) {
         try {
@@ -518,4 +547,34 @@ public class StaxSymmetricBindingHandler
         outboundTokens.put(WSSConstants.PROP_USE_THIS_TOKEN_ID_FOR_SIGNATURE, 
                            encryptedKeySecurityTokenProvider);
     }
+    
+    private class TokenStoreCallbackHandler implements CallbackHandler {
+        private CallbackHandler internal;
+        private TokenStore store;
+        public TokenStoreCallbackHandler(CallbackHandler in, TokenStore st) {
+            internal = in;
+            store = st;
+        }
+        
+        public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException
{
+            for (int i = 0; i < callbacks.length; i++) {
+                WSPasswordCallback pc = (WSPasswordCallback)callbacks[i];
+                
+                if (pc.getKey() != null) {
+                    String id = pc.getIdentifier();
+                    SecurityToken token = store.getToken(id);
+                    if (token != null) {
+                        token.setSHA1(getSHA1(pc.getKey()));
+                        // Create another cache entry with the SHA1 Identifier as the key

+                        // for easy retrieval
+                        store.add(token.getSHA1(), token);
+                    }
+                }
+            }
+            if (internal != null) {
+                internal.handle(callbacks);
+            }
+        }
+        
+    }
 }

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java?rev=1492733&r1=1492732&r2=1492733&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java
Thu Jun 13 16:16:57 2013
@@ -852,9 +852,11 @@ public class SymmetricBindingHandler ext
         // Set the SHA1 value of the encrypted key, this is used when the encrypted
         // key is referenced via a key identifier of type EncryptedKeySHA1
         tempTok.setSHA1(getSHA1(encrKey.getEncryptedEphemeralKey()));
-        
         tokenStore.add(tempTok);
         
+        // Create another cache entry with the SHA1 Identifier as the key for easy retrieval
+        tokenStore.add(tempTok.getSHA1(), tempTok);
+        
         String bstTokenId = encrKey.getBSTTokenId();
         //If direct ref is used to refer to the cert
         //then add the cert to the sec header now

Modified: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/StaxX509TokenTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/StaxX509TokenTest.java?rev=1492733&r1=1492732&r2=1492733&view=diff
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/StaxX509TokenTest.java
(original)
+++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/StaxX509TokenTest.java
Thu Jun 13 16:16:57 2013
@@ -61,14 +61,6 @@ public class StaxX509TokenTest extends A
                 // set this to false to fork
                 launchServer(StaxServer.class, true)
         );
-        /*
-        assertTrue(
-                "Intermediary failed to launch",
-                // run the server in the same process
-                // set this to false to fork
-                launchServer(Intermediary.class, true)
-        );
-        */
     }
     
     @org.junit.AfterClass
@@ -128,29 +120,6 @@ public class StaxX509TokenTest extends A
     }
     
     @org.junit.Test
-    public void testIntermediary() throws Exception {
-
-        SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = StaxX509TokenTest.class.getResource("client/intermediary-client.xml");
-
-        Bus bus = bf.createBus(busFile.toString());
-        SpringBusFactory.setDefaultBus(bus);
-        SpringBusFactory.setThreadDefaultBus(bus);
-        
-        URL wsdl = StaxX509TokenTest.class.getResource("DoubleItIntermediary.wsdl");
-        Service service = Service.create(wsdl, SERVICE_QNAME);
-        QName portQName = new QName(NAMESPACE, "DoubleItPort");
-        DoubleItPortType x509Port = 
-                service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(x509Port, INTERMEDIARY_PORT);
-        
-        x509Port.doubleIt(25);
-        
-        ((java.io.Closeable)x509Port).close();
-        bus.shutdown(true);
-    }
-    
-    @org.junit.Test
     public void testIssuerSerial() throws Exception {
 
         SpringBusFactory bf = new SpringBusFactory();

Modified: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/X509TokenTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/X509TokenTest.java?rev=1492733&r1=1492732&r2=1492733&view=diff
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/X509TokenTest.java
(original)
+++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/X509TokenTest.java
Thu Jun 13 16:16:57 2013
@@ -93,12 +93,18 @@ public class X509TokenTest extends Abstr
         DoubleItPortType x509Port = 
                 service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(x509Port, PORT);
+        
+        // DOM
+        x509Port.doubleIt(25);
+        
+        // Streaming
+        SecurityTestUtil.enableStreaming(x509Port);
         x509Port.doubleIt(25);
         
         ((java.io.Closeable)x509Port).close();
         bus.shutdown(true);
     }
-    
+  
     @org.junit.Test
     public void testKeyIdentifierJaxwsClient() throws Exception {
 
@@ -120,6 +126,11 @@ public class X509TokenTest extends Abstr
                 "org/apache/cxf/systest/ws/wssec10/client/bob.properties");
         ((BindingProvider)x509Port).getRequestContext().put(SecurityConstants.ENCRYPT_USERNAME,
"bob");
         
+        // DOM
+        x509Port.doubleIt(25);
+        
+        // Streaming
+        SecurityTestUtil.enableStreaming(x509Port);
         x509Port.doubleIt(25);
         
         ((java.io.Closeable)x509Port).close();
@@ -143,6 +154,11 @@ public class X509TokenTest extends Abstr
                 service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(x509Port, INTERMEDIARY_PORT);
         
+        // DOM
+        x509Port.doubleIt(25);
+        
+        // Streaming
+        SecurityTestUtil.enableStreaming(x509Port);
         x509Port.doubleIt(25);
         
         ((java.io.Closeable)x509Port).close();
@@ -165,6 +181,12 @@ public class X509TokenTest extends Abstr
         DoubleItPortType x509Port = 
                 service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(x509Port, PORT);
+        
+        // DOM
+        x509Port.doubleIt(25);
+        
+        // Streaming
+        SecurityTestUtil.enableStreaming(x509Port);
         x509Port.doubleIt(25);
         
         ((java.io.Closeable)x509Port).close();
@@ -187,6 +209,12 @@ public class X509TokenTest extends Abstr
         DoubleItPortType x509Port = 
                 service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(x509Port, PORT);
+        
+        // DOM
+        x509Port.doubleIt(25);
+        
+        // Streaming
+        SecurityTestUtil.enableStreaming(x509Port);
         x509Port.doubleIt(25);
         
         ((java.io.Closeable)x509Port).close();
@@ -209,6 +237,8 @@ public class X509TokenTest extends Abstr
         DoubleItPortType x509Port = 
                 service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(x509Port, PORT);
+        
+        // DOM
         x509Port.doubleIt(25);
         
         ((java.io.Closeable)x509Port).close();
@@ -399,8 +429,14 @@ public class X509TokenTest extends Abstr
         DoubleItPortType x509Port = 
                 service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(x509Port, PORT);
+        
+        // DOM
         x509Port.doubleIt(25);
         
+        // TODO Streaming
+        // SecurityTestUtil.enableStreaming(x509Port);
+        // x509Port.doubleIt(25);
+        
         ((java.io.Closeable)x509Port).close();
         bus.shutdown(true);
     }



Mime
View raw message