You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2019/07/17 11:54:23 UTC

[cxf] branch master updated: Fixing CrossDomainTest

This is an automated email from the ASF dual-hosted git repository.

coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/master by this push:
     new 9101e20  Fixing CrossDomainTest
9101e20 is described below

commit 9101e20ab3716f99f196eddda1d0d619aacfd642
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Wed Jul 17 12:54:02 2019 +0100

    Fixing CrossDomainTest
---
 .../systest/sts/cross_domain/CrossDomainTest.java  | 14 ++++++------
 .../{cxf-client.xml => cxf-client-mex.xml}         | 21 -----------------
 .../cxf/systest/sts/cross_domain/cxf-client.xml    | 26 ++++++----------------
 .../cxf/systest/sts/cross_domain/cxf-sts-saml1.xml |  4 ++--
 4 files changed, 16 insertions(+), 49 deletions(-)

diff --git a/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/cross_domain/CrossDomainTest.java b/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/cross_domain/CrossDomainTest.java
index 779c6b8..9d3ebc7 100644
--- a/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/cross_domain/CrossDomainTest.java
+++ b/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/cross_domain/CrossDomainTest.java
@@ -96,14 +96,14 @@ public class CrossDomainTest extends AbstractBusClientServerTestBase {
         stopAllServers();
     }
 
-    // In this test, a CXF client checks to see that the location defined on its STSClient is different
-    // from that configured in the Issuer of the IssuedToken policy supplied in the WSDL of the
-    // service provider. It obtains a SAML Token from the configured STS first, and then sends it in
-    // the security header to the second STS. The returned token is then sent to the service provider.
-    // This illustrates cross-domain SSO: https://issues.apache.org/jira/browse/CXF-3520
+    // In this test, the CXF client has two STSClients configured. The "default" STSClient config points to
+    // STS "b". This STS has an IssuedToken policy that requires a token from STS "a".
     @org.junit.Test
-    @org.junit.Ignore
     public void testCrossDomain() throws Exception {
+        if (!portFree) {
+            return;
+        }
+
         SpringBusFactory bf = new SpringBusFactory();
         URL busFile = CrossDomainTest.class.getResource("cxf-client.xml");
 
@@ -137,7 +137,7 @@ public class CrossDomainTest extends AbstractBusClientServerTestBase {
         }
 
         SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = CrossDomainTest.class.getResource("cxf-client.xml");
+        URL busFile = CrossDomainTest.class.getResource("cxf-client-mex.xml");
 
         Bus bus = bf.createBus(busFile.toString());
         BusFactory.setDefaultBus(bus);
diff --git a/services/sts/systests/advanced/src/test/resources/org/apache/cxf/systest/sts/cross_domain/cxf-client.xml b/services/sts/systests/advanced/src/test/resources/org/apache/cxf/systest/sts/cross_domain/cxf-client-mex.xml
similarity index 72%
copy from services/sts/systests/advanced/src/test/resources/org/apache/cxf/systest/sts/cross_domain/cxf-client.xml
copy to services/sts/systests/advanced/src/test/resources/org/apache/cxf/systest/sts/cross_domain/cxf-client-mex.xml
index 530d833..0c06bc4 100644
--- a/services/sts/systests/advanced/src/test/resources/org/apache/cxf/systest/sts/cross_domain/cxf-client.xml
+++ b/services/sts/systests/advanced/src/test/resources/org/apache/cxf/systest/sts/cross_domain/cxf-client-mex.xml
@@ -30,27 +30,6 @@
             <cxf:logging/>
         </cxf:features>
     </cxf:bus>
-    <jaxws:client name="{http://www.example.org/contract/DoubleIt}DoubleItCrossDomainPort" createdFromAPI="true">
-        <jaxws:properties>
-            <entry key="security.sts.client">
-                <bean class="org.apache.cxf.ws.security.trust.STSClient">
-                    <constructor-arg ref="cxf"/>
-                    <property name="wsdlLocation" value="https://localhost:${testutil.ports.cross_domain.STSServer.2}/SecurityTokenService/a?wsdl"/>
-                    <property name="serviceName" value="{http://docs.oasis-open.org/ws-sx/ws-trust/200512/}SecurityTokenService"/>
-                    <property name="endpointName" value="{http://docs.oasis-open.org/ws-sx/ws-trust/200512/}Transport_Port"/>
-                    <property name="properties">
-                        <map>
-                            <entry key="security.username" value="alice"/>
-                            <entry key="security.callback-handler" value="org.apache.cxf.systest.sts.common.CommonCallbackHandler"/>
-                            <entry key="security.sts.token.username" value="myclientkey"/>
-                            <entry key="security.sts.token.properties" value="clientKeystore.properties"/>
-                            <entry key="security.sts.token.usecert" value="true"/>
-                        </map>
-                    </property>
-                </bean>
-            </entry>
-        </jaxws:properties>
-    </jaxws:client>
     
     <jaxws:client name="{http://www.example.org/contract/DoubleIt}DoubleItCrossDomainMEXPort" createdFromAPI="true">
         <jaxws:properties>
diff --git a/services/sts/systests/advanced/src/test/resources/org/apache/cxf/systest/sts/cross_domain/cxf-client.xml b/services/sts/systests/advanced/src/test/resources/org/apache/cxf/systest/sts/cross_domain/cxf-client.xml
index 530d833..80d0750 100644
--- a/services/sts/systests/advanced/src/test/resources/org/apache/cxf/systest/sts/cross_domain/cxf-client.xml
+++ b/services/sts/systests/advanced/src/test/resources/org/apache/cxf/systest/sts/cross_domain/cxf-client.xml
@@ -30,14 +30,12 @@
             <cxf:logging/>
         </cxf:features>
     </cxf:bus>
-    <jaxws:client name="{http://www.example.org/contract/DoubleIt}DoubleItCrossDomainPort" createdFromAPI="true">
-        <jaxws:properties>
-            <entry key="security.sts.client">
-                <bean class="org.apache.cxf.ws.security.trust.STSClient">
+    
+    <bean class="org.apache.cxf.ws.security.trust.STSClient" name="default.sts-client">
                     <constructor-arg ref="cxf"/>
-                    <property name="wsdlLocation" value="https://localhost:${testutil.ports.cross_domain.STSServer.2}/SecurityTokenService/a?wsdl"/>
+                    <property name="wsdlLocation" value="https://localhost:30102/SecurityTokenService/b?wsdl"/>
                     <property name="serviceName" value="{http://docs.oasis-open.org/ws-sx/ws-trust/200512/}SecurityTokenService"/>
-                    <property name="endpointName" value="{http://docs.oasis-open.org/ws-sx/ws-trust/200512/}Transport_Port"/>
+                    <property name="endpointName" value="{http://docs.oasis-open.org/ws-sx/ws-trust/200512/}Transport_STSB_Port"/>
                     <property name="properties">
                         <map>
                             <entry key="security.username" value="alice"/>
@@ -48,15 +46,8 @@
                         </map>
                     </property>
                 </bean>
-            </entry>
-        </jaxws:properties>
-    </jaxws:client>
-    
-    <jaxws:client name="{http://www.example.org/contract/DoubleIt}DoubleItCrossDomainMEXPort" createdFromAPI="true">
-        <jaxws:properties>
-            <entry key="security.sts.prefer-wsmex" value="true"/>
-            <entry key="security.sts.client">
-                <bean class="org.apache.cxf.ws.security.trust.STSClient">
+                
+    <bean class="org.apache.cxf.ws.security.trust.STSClient" name="{http://docs.oasis-open.org/ws-sx/ws-trust/200512/}Transport_STSB_Port.sts-client">
                     <constructor-arg ref="cxf"/>
                     <property name="wsdlLocation" value="https://localhost:30101/SecurityTokenService/a?wsdl"/>
                     <property name="serviceName" value="{http://docs.oasis-open.org/ws-sx/ws-trust/200512/}SecurityTokenService"/>
@@ -70,11 +61,8 @@
                             <entry key="security.sts.token.usecert" value="true"/>
                         </map>
                     </property>
-                    <property name="enableAppliesTo" value="false"/>
                 </bean>
-            </entry>
-        </jaxws:properties>
-    </jaxws:client>
+                
     
     <http:conduit name="https://localhost:.*">
         <http:tlsClientParameters disableCNCheck="true">
diff --git a/services/sts/systests/advanced/src/test/resources/org/apache/cxf/systest/sts/cross_domain/cxf-sts-saml1.xml b/services/sts/systests/advanced/src/test/resources/org/apache/cxf/systest/sts/cross_domain/cxf-sts-saml1.xml
index a67ebe7..b05d19a 100644
--- a/services/sts/systests/advanced/src/test/resources/org/apache/cxf/systest/sts/cross_domain/cxf-sts-saml1.xml
+++ b/services/sts/systests/advanced/src/test/resources/org/apache/cxf/systest/sts/cross_domain/cxf-sts-saml1.xml
@@ -60,8 +60,8 @@
         <property name="endpoints" ref="transportEndpoints"/>
     </bean>
     <util:list id="transportEndpoints">
-        <value>https://localhost:(\d)*/doubleit/services/doubleit.*
-                </value>
+        <value>https://localhost:(\d)*/doubleit/services/doubleit.*</value>
+        <value>https://localhost:30102/SecurityTokenService/b</value>
     </util:list>
     <bean id="customRealmParser" class="org.apache.cxf.systest.sts.realms.URLRealmParser"/>
     <bean id="transportSTSProperties" class="org.apache.cxf.sts.StaticSTSProperties">