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 2014/06/16 16:54:43 UTC

[2/2] git commit: [CXF-5807] - Fix STSClient configuration when Issuer EPR has an "anonymous" address

[CXF-5807] - Fix STSClient configuration when Issuer EPR has an "anonymous" address

Conflicts:
	rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/AbstractSTSClient.java


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/4fba5ce2
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/4fba5ce2
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/4fba5ce2

Branch: refs/heads/2.7.x-fixes
Commit: 4fba5ce228b0ab45c2c03d808990ed06db3c5476
Parents: 9884c8e
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Mon Jun 16 15:32:20 2014 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Mon Jun 16 15:35:33 2014 +0100

----------------------------------------------------------------------
 .../ws/security/trust/AbstractSTSClient.java    | 32 +++++++++++++++++---
 .../apache/cxf/systest/sts/issuer/DoubleIt.wsdl |  3 +-
 2 files changed, 29 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/4fba5ce2/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/AbstractSTSClient.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/AbstractSTSClient.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/AbstractSTSClient.java
index 28a3582..c06cfeb 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/AbstractSTSClient.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/AbstractSTSClient.java
@@ -518,16 +518,38 @@ public abstract class AbstractSTSClient implements Configurable, InterceptorProv
                         Service service = factory.create();
                         service.setDataBinding(dataBinding);
                         
+                        // Get the endpoint + service names by matching the 'location' to the
+                        // address in the WSDL. If the 'location' is 'anonymous' then just fall
+                        // back to the first service + endpoint name in the WSDL, if the endpoint
+                        // name is not defined in the Metadata
+                        List<ServiceInfo> services = service.getServiceInfos();
+                        String anonymousAddress = "http://www.w3.org/2005/08/addressing/anonymous";
                         
-                        for (ServiceInfo serv : service.getServiceInfos()) {
-                            for (EndpointInfo ei : serv.getEndpoints()) {
-                                if (ei.getAddress().equals(location)) {
-                                    endpointName = ei.getName();
-                                    serviceName = serv.getName();
+                        if (!anonymousAddress.equals(location)) {
+                            for (ServiceInfo serv : services) {
+                                for (EndpointInfo ei : serv.getEndpoints()) {
+                                    if (ei.getAddress().equals(location)) {
+                                        endpointName = ei.getName();
+                                        serviceName = serv.getName();
+                                    }
                                 }
                             }
                         }
+                        
                         EndpointInfo ei = service.getEndpointInfo(endpointName);
+<<<<<<< HEAD
+=======
+                        if (ei == null && anonymousAddress.equals(location)
+                            && !services.isEmpty() && !services.get(0).getEndpoints().isEmpty()) {
+                            serviceName = services.get(0).getName();
+                            endpointName = services.get(0).getEndpoints().iterator().next().getName();
+                            ei = service.getEndpointInfo(endpointName);
+                        }
+                        
+                        if (location != null && !anonymousAddress.equals(location)) {
+                            ei.setAddress(location);
+                        }
+>>>>>>> da25b2a... [CXF-5807] - Fix STSClient configuration when Issuer EPR has an "anonymous" address
                         Endpoint endpoint = new EndpointImpl(bus, service, ei);
                         client = new ClientImpl(bus, endpoint);
                     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/4fba5ce2/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/issuer/DoubleIt.wsdl
----------------------------------------------------------------------
diff --git a/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/issuer/DoubleIt.wsdl b/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/issuer/DoubleIt.wsdl
index 9bac590..95b4ffe 100644
--- a/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/issuer/DoubleIt.wsdl
+++ b/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/issuer/DoubleIt.wsdl
@@ -252,7 +252,8 @@
                                 <sp:RequireInternalReference/>
                             </wsp:Policy>
                             <sp:Issuer>
-                                <wsaw:Address>https://localhost:30101/SecurityTokenService/TransportSoap12</wsaw:Address>
+                                <!--<wsaw:Address>https://localhost:30101/SecurityTokenService/TransportSoap12</wsaw:Address>-->
+                                <wsaw:Address>http://www.w3.org/2005/08/addressing/anonymous</wsaw:Address>
                                 <wsaw:Metadata>
                                     <wsx:Metadata>
                                         <wsx:MetadataSection>