cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asold...@apache.org
Subject svn commit: r1337193 - in /cxf/branches/2.5.x-fixes: ./ rt/ws/security/src/main/java/org/apache/cxf/ws/security/ rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/ rt/ws/security/src/test/java/org/apache/cxf/ws/security/sts/
Date Fri, 11 May 2012 14:54:54 GMT
Author: asoldano
Date: Fri May 11 14:54:53 2012
New Revision: 1337193

URL: http://svn.apache.org/viewvc?rev=1337193&view=rev
Log:
Merged revisions 1337187 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1337187 | asoldano | 2012-05-11 16:42:00 +0200 (Fri, 11 May 2012) | 2 lines
  
  [CXF-4308] Add option for disabling STS client WS-MEX invocation using WSA EPR address
........

Modified:
    cxf/branches/2.5.x-fixes/   (props changed)
    cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/SecurityConstants.java
    cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java
    cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSUtils.java
    cxf/branches/2.5.x-fixes/rt/ws/security/src/test/java/org/apache/cxf/ws/security/sts/STSClientTest.java

Propchange: cxf/branches/2.5.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/trunk:r1337187

Propchange: cxf/branches/2.5.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/SecurityConstants.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/SecurityConstants.java?rev=1337193&r1=1337192&r2=1337193&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/SecurityConstants.java
(original)
+++ cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/SecurityConstants.java
Fri May 11 14:54:53 2012
@@ -179,6 +179,13 @@ public final class SecurityConstants {
     public static final String CACHE_CONFIG_FILE = 
         "ws-security.cache.config.file";
     
+    /**
+     * Set this property to avoid STS client trying send WS-MetadataExchange call using
+     * STS EPR WSA address when the endpoint contract contains no WS-MetadataExchange info.
+     */
+    public static final String DISABLE_STS_CLIENT_WSMEX_CALL_USING_EPR_ADDRESS =
+        "ws-security.sts.disable-wsmex-call-using-epr-address";
+    
     public static final Set<String> ALL_PROPERTIES;
     
     static {
@@ -196,7 +203,7 @@ public final class SecurityConstants {
             KERBEROS_JAAS_CONTEXT_NAME, KERBEROS_SPN, SPNEGO_CLIENT_ACTION,
             ENABLE_NONCE_CACHE, NONCE_CACHE_INSTANCE, ENABLE_TIMESTAMP_CACHE,
             TIMESTAMP_CACHE_INSTANCE, CACHE_CONFIG_FILE,
-            SAML_ROLE_ATTRIBUTENAME
+            SAML_ROLE_ATTRIBUTENAME, DISABLE_STS_CLIENT_WSMEX_CALL_USING_EPR_ADDRESS
         }));
         ALL_PROPERTIES = Collections.unmodifiableSet(s);
     }

Modified: cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java?rev=1337193&r1=1337192&r2=1337193&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java
(original)
+++ cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java
Fri May 11 14:54:53 2012
@@ -432,7 +432,7 @@ public class STSClient implements Config
         return client;
     }
     
-    public void configureViaEPR(EndpointReferenceType ref) {
+    public void configureViaEPR(EndpointReferenceType ref, boolean useEPRWSAAddrAsMEXLocation)
{
         if (client != null) {
             return;
         }
@@ -449,7 +449,7 @@ public class STSClient implements Config
         if (wsdlLoc != null) {
             wsdlLocation = wsdlLoc;
         }
-        String mexLoc = findMEXLocation(ref);
+        String mexLoc = findMEXLocation(ref, useEPRWSAAddrAsMEXLocation);
         if (mexLoc != null) {
             try {
                 JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean();
@@ -487,7 +487,7 @@ public class STSClient implements Config
             }
         }
     }
-    protected String findMEXLocation(EndpointReferenceType ref) {
+    protected String findMEXLocation(EndpointReferenceType ref, boolean useEPRWSAAddrAsMEXLocation)
{
         if (ref.getMetadata() != null && ref.getMetadata().getAny() != null) {
             for (Object any : ref.getMetadata().getAny()) {
                 if (any instanceof Element) {
@@ -498,7 +498,7 @@ public class STSClient implements Config
                 }
             }
         }
-        return null;
+        return useEPRWSAAddrAsMEXLocation ? EndpointReferenceUtils.getAddress(ref) : null;
     }
     protected String findMEXLocation(Element ref) {
         Element el = DOMUtils.getFirstElement(ref);

Modified: cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSUtils.java?rev=1337193&r1=1337192&r2=1337193&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSUtils.java
(original)
+++ cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSUtils.java
Fri May 11 14:54:53 2012
@@ -112,7 +112,9 @@ public final class STSUtils {
             client.setBeanName(ep.getEndpointInfo().getName().toString() + type);
             if (itok.getIssuerEpr() != null) {
                 //configure via mex
-                client.configureViaEPR(itok.getIssuerEpr());
+                boolean useEPRWSAAddrAsMEXLocation = !Boolean.valueOf((String)message
+                        .getContextualProperty(SecurityConstants.DISABLE_STS_CLIENT_WSMEX_CALL_USING_EPR_ADDRESS));
+                client.configureViaEPR(itok.getIssuerEpr(), useEPRWSAAddrAsMEXLocation);
             }
         }
         return client;

Modified: cxf/branches/2.5.x-fixes/rt/ws/security/src/test/java/org/apache/cxf/ws/security/sts/STSClientTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/ws/security/src/test/java/org/apache/cxf/ws/security/sts/STSClientTest.java?rev=1337193&r1=1337192&r2=1337193&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/ws/security/src/test/java/org/apache/cxf/ws/security/sts/STSClientTest.java
(original)
+++ cxf/branches/2.5.x-fixes/rt/ws/security/src/test/java/org/apache/cxf/ws/security/sts/STSClientTest.java
Fri May 11 14:54:53 2012
@@ -53,7 +53,7 @@ public class STSClientTest extends Asser
 
         Bus bus = BusFactory.getThreadDefaultBus();
         STSClient client = new STSClient(bus);
-        client.configureViaEPR(ref);
+        client.configureViaEPR(ref, false);
 
         assertEquals("http://localhost:8080/jaxws-samples-wsse-policy-trust-sts/SecurityTokenService?wsdl",
                      client.getWsdlLocation());



Mime
View raw message