[jbossws-commits] JBossWS SVN: r16254 - in stack/cxf/trunk/modules/testsuite/cxf-tests/src/test: resources/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl and 1 other directory.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Thu May 10 10:50:24 EDT 2012


Author: alessio.soldano at jboss.com
Date: 2012-05-10 10:50:24 -0400 (Thu, 10 May 2012)
New Revision: 16254

Modified:
   stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustPicketLinkTestCase.java
   stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustTestCase.java
   stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustTestUtils.java
   stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/SecurityService.wsdl
Log:
[JBWS-3434] Adding testcase using WSA EPR for getting STS client configuration - currently excluded while waiting for [CXF-4304] to be included in a CXF release


Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustPicketLinkTestCase.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustPicketLinkTestCase.java	2012-05-10 14:16:16 UTC (rev 16253)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustPicketLinkTestCase.java	2012-05-10 14:50:24 UTC (rev 16254)
@@ -64,7 +64,7 @@
          
          final QName stsServiceName = new QName("urn:picketlink:identity-federation:sts", "PicketLinkSTS");
          final QName stsPortName = new QName("urn:picketlink:identity-federation:sts", "PicketLinkSTSPort");
-         WSTrustTestUtils.setupWsse(proxy, bus, stsURL + "?wsdl", stsServiceName, stsPortName);
+         WSTrustTestUtils.setupWsseAndSTSClient(proxy, bus, stsURL + "?wsdl", stsServiceName, stsPortName);
          
          assertEquals("WS-Trust Hello World!", proxy.sayHello());
       }

Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustTestCase.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustTestCase.java	2012-05-10 14:16:16 UTC (rev 16253)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustTestCase.java	2012-05-10 14:50:24 UTC (rev 16254)
@@ -52,6 +52,11 @@
             "jaxws-samples-wsse-policy-trust-client.jar jaxws-samples-wsse-policy-trust-sts.war jaxws-samples-wsse-policy-trust.war");
    }
    
+   /**
+    * WS-Trust test with the STS information programmatically provided
+    * 
+    * @throws Exception
+    */
    public void test() throws Exception
    {
       Bus bus = BusFactory.newInstance().createBus();
@@ -66,7 +71,7 @@
          
          final QName stsServiceName = new QName("http://docs.oasis-open.org/ws-sx/ws-trust/200512/", "SecurityTokenService");
          final QName stsPortName = new QName("http://docs.oasis-open.org/ws-sx/ws-trust/200512/", "UT_Port");
-         WSTrustTestUtils.setupWsse(proxy, bus, stsURL + "?wsdl", stsServiceName, stsPortName);
+         WSTrustTestUtils.setupWsseAndSTSClient(proxy, bus, stsURL + "?wsdl", stsServiceName, stsPortName);
          
          assertEquals("WS-Trust Hello World!", proxy.sayHello());
       }
@@ -75,4 +80,36 @@
          bus.shutdown(true);
       }
    }
+   
+   /**
+    * WS-Trust test with the STS information coming from EPR specified in service endpoint contract policy
+    * 
+    * @throws Exception
+    */
+   public void testUsingEPR() throws Exception
+   {
+      if (true) {
+         System.out.println("FIXME: [CXF-4304] Complete WSA support for STS client configuration via EPR");
+         return;
+      }
+      
+      Bus bus = BusFactory.newInstance().createBus();
+      try
+      {
+         BusFactory.setThreadDefaultBus(bus);
+         
+         final QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy", "SecurityService");
+         final URL wsdlURL = new URL(serviceURL + "?wsdl");
+         Service service = Service.create(wsdlURL, serviceName);
+         ServiceIface proxy = (ServiceIface) service.getPort(ServiceIface.class);
+         
+         WSTrustTestUtils.setupWsse(proxy, bus);
+         
+         assertEquals("WS-Trust Hello World!", proxy.sayHello());
+      }
+      finally
+      {
+         bus.shutdown(true);
+      }
+   }
 }

Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustTestUtils.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustTestUtils.java	2012-05-10 14:16:16 UTC (rev 16253)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustTestUtils.java	2012-05-10 14:50:24 UTC (rev 16254)
@@ -53,7 +53,7 @@
       return testSetup;
    }
    
-   public static void setupWsse(ServiceIface proxy, Bus bus, String stsWsdlLocation, QName stsService, QName stsPort)
+   public static void setupWsseAndSTSClient(ServiceIface proxy, Bus bus, String stsWsdlLocation, QName stsService, QName stsPort)
    {
       Map<String, Object> ctx = ((BindingProvider) proxy).getRequestContext();
       ctx.put(SecurityConstants.CALLBACK_HANDLER, new ClientCallbackHandler());
@@ -62,9 +62,11 @@
       ctx.put(SecurityConstants.SIGNATURE_USERNAME, "myclientkey");
       ctx.put(SecurityConstants.ENCRYPT_USERNAME, "myservicekey");
       STSClient stsClient = new STSClient(bus);
-      stsClient.setWsdlLocation(stsWsdlLocation);
-      stsClient.setServiceQName(stsService);
-      stsClient.setEndpointQName(stsPort);
+      if (stsWsdlLocation != null) {
+         stsClient.setWsdlLocation(stsWsdlLocation);
+         stsClient.setServiceQName(stsService);
+         stsClient.setEndpointQName(stsPort);
+      }
       Map<String, Object> props = stsClient.getProperties();
       props.put(SecurityConstants.USERNAME, "alice");
       props.put(SecurityConstants.CALLBACK_HANDLER, new ClientCallbackHandler());
@@ -75,4 +77,26 @@
       props.put(SecurityConstants.STS_TOKEN_USE_CERT_FOR_KEYINFO, "true");
       ctx.put(SecurityConstants.STS_CLIENT, stsClient);
    }
+   
+   public static void setupWsse(ServiceIface proxy, Bus bus)
+   {
+      Map<String, Object> ctx = ((BindingProvider) proxy).getRequestContext();
+      ctx.put(SecurityConstants.CALLBACK_HANDLER, new ClientCallbackHandler());
+      ctx.put(SecurityConstants.SIGNATURE_PROPERTIES, Thread.currentThread().getContextClassLoader().getResource("META-INF/clientKeystore.properties"));
+      ctx.put(SecurityConstants.ENCRYPT_PROPERTIES, Thread.currentThread().getContextClassLoader().getResource("META-INF/clientKeystore.properties"));
+      ctx.put(SecurityConstants.SIGNATURE_USERNAME, "myclientkey");
+      ctx.put(SecurityConstants.ENCRYPT_USERNAME, "myservicekey");
+      ctx.put(appendIssuedTokenSuffix(SecurityConstants.USERNAME), "alice");
+      ctx.put(appendIssuedTokenSuffix(SecurityConstants.CALLBACK_HANDLER), new ClientCallbackHandler());
+      ctx.put(appendIssuedTokenSuffix(SecurityConstants.ENCRYPT_PROPERTIES), Thread.currentThread().getContextClassLoader().getResource("META-INF/clientKeystore.properties"));
+      ctx.put(appendIssuedTokenSuffix(SecurityConstants.ENCRYPT_USERNAME), "mystskey");
+      ctx.put(appendIssuedTokenSuffix(SecurityConstants.STS_TOKEN_USERNAME), "myclientkey");
+      ctx.put(appendIssuedTokenSuffix(SecurityConstants.STS_TOKEN_PROPERTIES), Thread.currentThread().getContextClassLoader().getResource("META-INF/clientKeystore.properties"));
+      ctx.put(appendIssuedTokenSuffix(SecurityConstants.STS_TOKEN_USE_CERT_FOR_KEYINFO), "true");
+   }
+   
+   private static String appendIssuedTokenSuffix(String prop)
+   {
+      return prop + ".it";
+   }
 }

Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/SecurityService.wsdl
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/SecurityService.wsdl	2012-05-10 14:16:16 UTC (rev 16253)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/SecurityService.wsdl	2012-05-10 14:50:24 UTC (rev 16254)
@@ -68,8 +68,13 @@
 										<sp:RequireInternalReference />
 									</wsp:Policy>
 									<sp:Issuer>
-										<wsaws:Address>http://localhost:8080/jaxws-samples-wsse-policy-trust-sts
-										</wsaws:Address>
+										<wsaws:Address>http://localhost:8080/jaxws-samples-wsse-policy-trust-sts/SecurityTokenService</wsaws:Address>
+										<wsaws:Metadata xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+										                wsdli:wsdlLocation="http://localhost:8080/jaxws-samples-wsse-policy-trust-sts/SecurityTokenService?wsdl">
+										    <wsaw:ServiceName xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
+										                    xmlns:stsns="http://docs.oasis-open.org/ws-sx/ws-trust/200512/"
+										                    EndpointName="UT_Port">stsns:SecurityTokenService</wsaw:ServiceName>
+										</wsaws:Metadata>
 									</sp:Issuer>
 								</sp:IssuedToken>
 							</wsp:Policy>



More information about the jbossws-commits mailing list