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 2008/12/15 22:00:38 UTC

svn commit: r726798 - in /cxf/sandbox/interopfest/wstrust13: ./ src/main/java/interop/client/Client.java src/main/resources/etc/client.xml

Author: dkulp
Date: Mon Dec 15 13:00:37 2008
New Revision: 726798

URL: http://svn.apache.org/viewvc?rev=726798&view=rev
Log:
Start on wstrust13 since wstrust10 STS server seems to have issues

Added:
    cxf/sandbox/interopfest/wstrust13/   (props changed)
      - copied from r726797, cxf/sandbox/interopfest/wstrust10/
Modified:
    cxf/sandbox/interopfest/wstrust13/src/main/java/interop/client/Client.java
    cxf/sandbox/interopfest/wstrust13/src/main/resources/etc/client.xml

Propchange: cxf/sandbox/interopfest/wstrust13/
------------------------------------------------------------------------------
    svn:mergeinfo = 

Modified: cxf/sandbox/interopfest/wstrust13/src/main/java/interop/client/Client.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/interopfest/wstrust13/src/main/java/interop/client/Client.java?rev=726798&r1=726797&r2=726798&view=diff
==============================================================================
--- cxf/sandbox/interopfest/wstrust13/src/main/java/interop/client/Client.java (original)
+++ cxf/sandbox/interopfest/wstrust13/src/main/java/interop/client/Client.java Mon Dec 15 13:00:37 2008
@@ -26,6 +26,8 @@
 import javax.xml.namespace.QName;
 import javax.xml.ws.BindingProvider;
 
+import org.tempuri.IPingServiceContract;
+import org.tempuri.PingService;
 import org.tempuri.SymmetricFederatedService;
 
 import org.apache.cxf.Bus;
@@ -39,6 +41,9 @@
 import org.apache.cxf.ws.policy.PolicyBuilder;
 import org.apache.cxf.ws.policy.PolicyEngine;
 import org.apache.cxf.ws.security.SecurityConstants;
+import org.apache.cxf.ws.security.policy.model.IssuedToken;
+import org.apache.cxf.ws.security.policy.model.SupportingToken;
+import org.apache.cxf.ws.security.policy.model.Token;
 import org.apache.cxf.ws.security.policy.model.Trust10;
 import org.apache.cxf.ws.security.policy.model.Trust13;
 import org.apache.cxf.ws.security.tokenstore.SecurityToken;
@@ -65,9 +70,15 @@
     public static void main(String argv[])
         throws Exception {
         if (argv.length < 2) {
+            /*
             argv = new String[] {"Scenario_1_IssuedTokenOverTransport_UsernameOverTransport",
                                  "/etc/sts_policy_ut.xml",
                                  "https://131.107.72.15/Scenario_1_IssuedTokenOverTransport_UsernameOverTransport"};
+            argv = new String[] {"Scenario_2_IssuedToken_MutualCertificate10",
+                                 "/etc/sts_policy_mc10.xml",
+                                 "http://131.107.72.15/Scenario_2_IssuedToken_MutualCertificate10"};
+                                 */
+            argv = new String[] {"CustomBinding_IPingServiceContract"};
         }
 
         Bus b = new SpringBusFactory().createBus("etc/client.xml");
@@ -75,20 +86,18 @@
         
         final String portPrefix = argv[0];
 
-        final SymmetricFederatedService svc = new SymmetricFederatedService();
-        final IPingService port = 
+        final PingService svc = new PingService();
+        final IPingServiceContract port = 
             svc.getPort(
                 new QName(
                     "http://tempuri.org/",
                     portPrefix
                 ),
-                IPingService.class
+                IPingServiceContract.class
             );
         
         STSClient stsClient = new STSClient(b);
-        PolicyBuilder pb = b.getExtension(PolicyBuilder.class);
-        stsClient.setPolicy(pb.getPolicy(Client.class.getResourceAsStream(argv[1])));
-        stsClient.setLocation(argv[2]);
+        stsClient.setBeanName(argv[0]);
         
         //TODO: get the Trust10 token out of the port
         PolicyEngine pe = b.getExtension(PolicyEngine.class);
@@ -99,13 +108,21 @@
                 stsClient.setTrust((Trust10)as);
             } else if (as instanceof Trust13) {
                 stsClient.setTrust((Trust13)as);
+            } else if (as instanceof SupportingToken) {
+                Token t2 = ((SupportingToken)as).getToken();
+                if (t2 instanceof IssuedToken) {
+                    IssuedToken token = (IssuedToken)t2;
+                    stsClient.setTemplate(token.getRstTemplate());
+                }
             }
         }
         
         SecurityToken responseToken = stsClient.requestSecurityToken();
 
         //TODO: stick security token into the RequestContext/TokenStore
-        final String output = port.echo(INPUT);
+        ((BindingProvider)port).getRequestContext().put(SecurityConstants.TRUST_TOKEN, responseToken);
+        
+        final String output = port.ping(INPUT);
         if (!INPUT.equals(output)) {
             System.err.println(
                 "Expected " + INPUT + " but got " + output

Modified: cxf/sandbox/interopfest/wstrust13/src/main/resources/etc/client.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/interopfest/wstrust13/src/main/resources/etc/client.xml?rev=726798&r1=726797&r2=726798&view=diff
==============================================================================
--- cxf/sandbox/interopfest/wstrust13/src/main/resources/etc/client.xml (original)
+++ cxf/sandbox/interopfest/wstrust13/src/main/resources/etc/client.xml Mon Dec 15 13:00:37 2008
@@ -25,7 +25,8 @@
         </cxf:features>
     </cxf:bus>
     
-    <bean id="default.sts-client" class="org.apache.cxf.ws.security.trust.STSClient" abstract="true">
+    <bean id="Scenario_1_IssuedTokenOverTransport_UsernameOverTransport" 
+    	class="org.apache.cxf.ws.security.trust.STSClient" abstract="true">
     	<property name="soap11" value="false"/>
     	<property name="properties">
     		<map>
@@ -34,28 +35,30 @@
     		</map>
     	</property>
     </bean>
-    
-    
-    <http:conduit name="https://131.107.72.15/Security_Federation_FederatedService_Indigo/Symmetric.svc/Scenario_1_IssuedTokenOverTransport_UsernameOverTransport.*">
-        <http:tlsClientParameters disableCNCheck="true">
-            <sec:keyManagers keyPassword="password">
-                <sec:keyStore type="pkcs12" password="password" resource="certs/alice.pfx"/>
-            </sec:keyManagers>
-            <sec:trustManagers>
-                <sec:keyStore type="pkcs12" password="password" resource="certs/bob.pfx"/>
-            </sec:trustManagers>
-        </http:tlsClientParameters>
-    </http:conduit>
-    <http:conduit name="https://131.107.72.15/Security_Federation_SecurityTokenService_Indigo/Symmetric.svc/.*">
-        <http:tlsClientParameters disableCNCheck="true">
-            <sec:keyManagers keyPassword="password">
-                <sec:keyStore type="pkcs12" password="password" resource="certs/alice.pfx"/>
-            </sec:keyManagers>
-            <sec:trustManagers>
-                <sec:keyStore type="pkcs12" password="password" resource="certs/bob.pfx"/>
-            </sec:trustManagers>
-        </http:tlsClientParameters>
-    </http:conduit>
+    <bean id="Scenario_2_IssuedToken_MutualCertificate10" 
+    	class="org.apache.cxf.ws.security.trust.STSClient" abstract="true">
+    	<property name="soap11" value="false"/>
+    	<property name="properties">
+    		<map>
+    			<entry key="ws-security.username" value="Alice"/>
+    			<entry key="ws-security.password" value="abcd!1234"/>
+    		</map>
+    	</property>
+    </bean>
+    <bean id="CustomBinding_IPingServiceContract" 
+    	class="org.apache.cxf.ws.security.trust.STSClient" abstract="true">
+    	<property name="wsdlLocation" value="target/wsdl2/trust.wsdl"/>
+    	<property name="serviceName" value="{http://schemas.microsoft.com/ws/2008/06/identity/securitytokenservice}SecurityTokenService"/>
+    	<property name="endpointName" value="{http://schemas.microsoft.com/ws/2008/06/identity/securitytokenservice}CustomBinding_IWSTrust13Sync"/>
+    	<property name="properties">
+    		<map>
+    			<entry key="ws-security.username" value="joe"/>
+    			<entry key="ws-security.password" value="eoj"/>
+    		</map>
+    	</property>
+    </bean>
+     
+
     <http:conduit name="https://131.107.72.15/.*">
         <http:tlsClientParameters disableCNCheck="true">
             <sec:keyManagers keyPassword="password">