You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2013/08/26 22:12:34 UTC

svn commit: r1517680 - in /cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security: sign_enc/ sign_enc/src/main/java/demo/wssec/client/ sign_enc/src/main/java/demo/wssec/server/ ut_policy/ ut_sign/ ut_sign/src/main/java/demo/wssec/cl...

Author: dkulp
Date: Mon Aug 26 20:12:34 2013
New Revision: 1517680

URL: http://svn.apache.org/r1517680
Log:
Merged revisions 1517675 via  git cherry-pick from
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1517675 | dkulp | 2013-08-26 16:08:40 -0400 (Mon, 26 Aug 2013) | 2 lines

  More updates to allow co-existence with ws-discovery

........

Modified:
    cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/sign_enc/pom.xml
    cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/sign_enc/src/main/java/demo/wssec/client/Client.java
    cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/sign_enc/src/main/java/demo/wssec/server/Server.java
    cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/ut_policy/pom.xml
    cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/ut_sign/pom.xml
    cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/ut_sign/src/main/java/demo/wssec/client/Client.java
    cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/ut_sign/src/main/java/demo/wssec/server/Server.java

Modified: cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/sign_enc/pom.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/sign_enc/pom.xml?rev=1517680&r1=1517679&r2=1517680&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/sign_enc/pom.xml (original)
+++ cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/sign_enc/pom.xml Mon Aug 26 20:12:34 2013
@@ -167,6 +167,9 @@
             <groupId>org.springframework</groupId>
             <artifactId>spring-context</artifactId>
         </dependency>
-
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>jcl-over-slf4j</artifactId>
+        </dependency>
     </dependencies>
 </project>

Modified: cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/sign_enc/src/main/java/demo/wssec/client/Client.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/sign_enc/src/main/java/demo/wssec/client/Client.java?rev=1517680&r1=1517679&r2=1517680&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/sign_enc/src/main/java/demo/wssec/client/Client.java (original)
+++ cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/sign_enc/src/main/java/demo/wssec/client/Client.java Mon Aug 26 20:12:34 2013
@@ -20,7 +20,6 @@
 package demo.wssec.client;
 
 import java.io.Closeable;
-
 import java.lang.reflect.UndeclaredThrowableException;
 import java.net.URL;
 import java.util.HashMap;
@@ -29,9 +28,9 @@ import java.util.Map;
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.frontend.ClientProxy;
 import org.apache.cxf.hello_world_soap_http.Greeter;
 import org.apache.cxf.hello_world_soap_http.GreeterService;
-
 import org.apache.cxf.ws.security.wss4j.DefaultCryptoCoverageChecker;
 import org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor;
 import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor;
@@ -81,7 +80,6 @@ public final class Client {
                          "http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p");
             outProps.put("signatureAlgorithm", "http://www.w3.org/2000/09/xmldsig#rsa-sha1");
 
-            bus.getOutInterceptors().add(new WSS4JOutInterceptor(outProps));
 
             Map<String, Object> inProps = new HashMap<String, Object>();
 
@@ -99,7 +97,6 @@ public final class Client {
                          "http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p");
             inProps.put("signatureAlgorithm", "http://www.w3.org/2000/09/xmldsig#rsa-sha1");
 
-            bus.getInInterceptors().add(new WSS4JInInterceptor(inProps));
 
             // Check to make sure that the SOAP Body and Timestamp were signed,
             // and that the SOAP Body was encrypted
@@ -107,10 +104,14 @@ public final class Client {
             coverageChecker.setSignBody(true);
             coverageChecker.setSignTimestamp(true);
             coverageChecker.setEncryptBody(true);
-            bus.getInInterceptors().add(coverageChecker);
 
             GreeterService service = new GreeterService();
             Greeter port = service.getGreeterPort();
+            org.apache.cxf.endpoint.Client client = ClientProxy.getClient(port);
+            client.getInInterceptors().add(new WSS4JInInterceptor(inProps));
+            client.getOutInterceptors().add(new WSS4JOutInterceptor(outProps));
+            client.getInInterceptors().add(coverageChecker);
+            
 
             String[] names = new String[] {"Anne", "Bill", "Chris", "Sachin Tendulkar"};
             // make a sequence of 4 invocations
@@ -121,7 +122,7 @@ public final class Client {
             }
 
             // allow asynchronous resends to occur
-            Thread.sleep(30 * 1000);
+            Thread.sleep(10 * 1000);
 
             if (port instanceof Closeable) {
                 ((Closeable)port).close();

Modified: cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/sign_enc/src/main/java/demo/wssec/server/Server.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/sign_enc/src/main/java/demo/wssec/server/Server.java?rev=1517680&r1=1517679&r2=1517680&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/sign_enc/src/main/java/demo/wssec/server/Server.java (original)
+++ cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/sign_enc/src/main/java/demo/wssec/server/Server.java Mon Aug 26 20:12:34 2013
@@ -20,7 +20,6 @@
 package demo.wssec.server;
 
 import java.net.URL;
-
 import java.util.HashMap;
 import java.util.Map;
 
@@ -29,7 +28,7 @@ import javax.xml.ws.Endpoint;
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.bus.spring.SpringBusFactory;
-
+import org.apache.cxf.jaxws.EndpointImpl;
 import org.apache.cxf.ws.security.wss4j.DefaultCryptoCoverageChecker;
 import org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor;
 import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor;
@@ -44,15 +43,8 @@ public class Server {
 
         Object implementor = new GreeterImpl();
         String address = "http://localhost:9000/SoapContext/GreeterPort";
-        Endpoint.publish(address, implementor);
-    }
-
-    public static void main(String args[]) throws Exception {
-
-        SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = Server.class.getResource("wssec.xml");
-        Bus bus = bf.createBus(busFile.toString());
-
+        EndpointImpl endpoint = (EndpointImpl)Endpoint.publish(address, implementor);
+        
         Map<String, Object> outProps = new HashMap<String, Object>();
         outProps.put("action", "UsernameToken Timestamp Signature Encrypt");
 
@@ -77,7 +69,7 @@ public class Server {
                          "http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p");
         outProps.put("signatureAlgorithm", "http://www.w3.org/2000/09/xmldsig#rsa-sha1");
 
-        bus.getOutInterceptors().add(new WSS4JOutInterceptor(outProps));
+        endpoint.getOutInterceptors().add(new WSS4JOutInterceptor(outProps));
 
         Map<String, Object> inProps = new HashMap<String, Object>();
 
@@ -94,7 +86,7 @@ public class Server {
                     "http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p");
         inProps.put("signatureAlgorithm", "http://www.w3.org/2000/09/xmldsig#rsa-sha1");
 
-        bus.getInInterceptors().add(new WSS4JInInterceptor(inProps));
+        endpoint.getInInterceptors().add(new WSS4JInInterceptor(inProps));
 
         // Check to make sure that the SOAP Body and Timestamp were signed,
         // and that the SOAP Body was encrypted
@@ -102,8 +94,17 @@ public class Server {
         coverageChecker.setSignBody(true);
         coverageChecker.setSignTimestamp(true);
         coverageChecker.setEncryptBody(true);
-        bus.getInInterceptors().add(coverageChecker);
+        endpoint.getInInterceptors().add(coverageChecker);
+
+    }
+
+    public static void main(String args[]) throws Exception {
+
+        SpringBusFactory bf = new SpringBusFactory();
+        URL busFile = Server.class.getResource("wssec.xml");
+        Bus bus = bf.createBus(busFile.toString());
 
+        
         BusFactory.setDefaultBus(bus);
 
         new Server();

Modified: cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/ut_policy/pom.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/ut_policy/pom.xml?rev=1517680&r1=1517679&r2=1517680&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/ut_policy/pom.xml (original)
+++ cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/ut_policy/pom.xml Mon Aug 26 20:12:34 2013
@@ -178,5 +178,9 @@
             <groupId>org.springframework</groupId>
             <artifactId>spring-context</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>jcl-over-slf4j</artifactId>
+        </dependency>        
     </dependencies>
 </project>

Modified: cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/ut_sign/pom.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/ut_sign/pom.xml?rev=1517680&r1=1517679&r2=1517680&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/ut_sign/pom.xml (original)
+++ cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/ut_sign/pom.xml Mon Aug 26 20:12:34 2013
@@ -168,5 +168,9 @@
             <groupId>org.springframework</groupId>
             <artifactId>spring-context</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>jcl-over-slf4j</artifactId>
+        </dependency>        
     </dependencies>
 </project>

Modified: cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/ut_sign/src/main/java/demo/wssec/client/Client.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/ut_sign/src/main/java/demo/wssec/client/Client.java?rev=1517680&r1=1517679&r2=1517680&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/ut_sign/src/main/java/demo/wssec/client/Client.java (original)
+++ cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/ut_sign/src/main/java/demo/wssec/client/Client.java Mon Aug 26 20:12:34 2013
@@ -28,9 +28,9 @@ import java.util.Map;
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.frontend.ClientProxy;
 import org.apache.cxf.hello_world_soap_http.Greeter;
 import org.apache.cxf.hello_world_soap_http.GreeterService;
-
 import org.apache.cxf.ws.security.wss4j.DefaultCryptoCoverageChecker;
 import org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor;
 import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor;
@@ -68,7 +68,6 @@ public final class Client {
                          + "{}{http://www.w3.org/2005/08/addressing}ReplyTo;");
             outProps.put("signatureAlgorithm", "http://www.w3.org/2000/09/xmldsig#rsa-sha1");
 
-            bus.getOutInterceptors().add(new WSS4JOutInterceptor(outProps));
 
             Map<String, Object> inProps = new HashMap<String, Object>();
 
@@ -80,14 +79,16 @@ public final class Client {
             inProps.put("signatureKeyIdentifier", "DirectReference");
             inProps.put("signatureAlgorithm", "http://www.w3.org/2000/09/xmldsig#rsa-sha1");
 
-            bus.getInInterceptors().add(new WSS4JInInterceptor(inProps));
 
             // Check to make sure that the SOAP Body and Timestamp were signed
             DefaultCryptoCoverageChecker coverageChecker = new DefaultCryptoCoverageChecker();
-            bus.getInInterceptors().add(coverageChecker);
 
             GreeterService service = new GreeterService();
             Greeter port = service.getGreeterPort();
+            org.apache.cxf.endpoint.Client client = ClientProxy.getClient(port);
+            client.getOutInterceptors().add(new WSS4JOutInterceptor(outProps));
+            client.getInInterceptors().add(new WSS4JInInterceptor(inProps));
+            client.getInInterceptors().add(coverageChecker);
 
             String[] names = new String[] {"Anne", "Bill", "Chris", "Scott"};
             // make a sequence of 4 invocations

Modified: cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/ut_sign/src/main/java/demo/wssec/server/Server.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/ut_sign/src/main/java/demo/wssec/server/Server.java?rev=1517680&r1=1517679&r2=1517680&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/ut_sign/src/main/java/demo/wssec/server/Server.java (original)
+++ cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/ut_sign/src/main/java/demo/wssec/server/Server.java Mon Aug 26 20:12:34 2013
@@ -20,7 +20,6 @@
 package demo.wssec.server;
 
 import java.net.URL;
-
 import java.util.HashMap;
 import java.util.Map;
 
@@ -29,6 +28,7 @@ import javax.xml.ws.Endpoint;
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.jaxws.EndpointImpl;
 import org.apache.cxf.ws.security.wss4j.DefaultCryptoCoverageChecker;
 import org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor;
 import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor;
@@ -44,15 +44,7 @@ public class Server {
 
         Object implementor = new GreeterImpl();
         String address = "http://localhost:9000/SoapContext/GreeterPort";
-        Endpoint.publish(address, implementor);
-    }
-
-    public static void main(String args[]) throws Exception {
-
-        SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = Server.class.getResource("wssec.xml");
-        Bus bus = bf.createBus(busFile.toString());
-
+        EndpointImpl impl = (EndpointImpl)Endpoint.publish(address, implementor);
         Map<String, Object> outProps = new HashMap<String, Object>();
         outProps.put("action", "UsernameToken Timestamp Signature");
 
@@ -67,7 +59,7 @@ public class Server {
                          + "{Element}{http://schemas.xmlsoap.org/soap/envelope/}Body");
         outProps.put("signatureAlgorithm", "http://www.w3.org/2000/09/xmldsig#rsa-sha1");
 
-        bus.getOutInterceptors().add(new WSS4JOutInterceptor(outProps));
+        impl.getOutInterceptors().add(new WSS4JOutInterceptor(outProps));
 
         Map<String, Object> inProps = new HashMap<String, Object>();
 
@@ -79,11 +71,20 @@ public class Server {
         inProps.put("signatureKeyIdentifier", "DirectReference");
         inProps.put("signatureAlgorithm", "http://www.w3.org/2000/09/xmldsig#rsa-sha1");
 
-        bus.getInInterceptors().add(new WSS4JInInterceptor(inProps));
+        impl.getInInterceptors().add(new WSS4JInInterceptor(inProps));
 
         // Check to make sure that the SOAP Body and Timestamp were signed
         DefaultCryptoCoverageChecker coverageChecker = new DefaultCryptoCoverageChecker();
-        bus.getInInterceptors().add(coverageChecker);
+        impl.getInInterceptors().add(coverageChecker);
+
+    }
+
+    public static void main(String args[]) throws Exception {
+
+        SpringBusFactory bf = new SpringBusFactory();
+        URL busFile = Server.class.getResource("wssec.xml");
+        Bus bus = bf.createBus(busFile.toString());
+
 
         BusFactory.setDefaultBus(bus);