cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1400810 - in /cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security: SecurityConstants.java trust/STSUtils.java
Date Mon, 22 Oct 2012 09:06:42 GMT
Author: coheigea
Date: Mon Oct 22 09:06:41 2012
New Revision: 1400810

URL: http://svn.apache.org/viewvc?rev=1400810&view=rev
Log:
[CXF-4590] - STSUtils: DRY refactoring and support Soap12 via property

Modified:
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/SecurityConstants.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSUtils.java

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/SecurityConstants.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/SecurityConstants.java?rev=1400810&r1=1400809&r2=1400810&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/SecurityConstants.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/SecurityConstants.java
Mon Oct 22 09:06:41 2012
@@ -344,6 +344,12 @@ public final class SecurityConstants {
         "ws-security.sts.disable-wsmex-call-using-epr-address";
     
     /**
+     * Switch STS client to send Soap 1.2 messages
+     */
+    public static final String STS_CLIENT_SOAP12_BINDING =
+        "ws-security.sts.client-soap12-binding";
+
+    /**
      * 
      * A Crypto object to be used for the STS. If this is not defined then the 
      * {@link STS_TOKEN_PROPERTIES} is used instead.

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSUtils.java?rev=1400810&r1=1400809&r2=1400810&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSUtils.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSUtils.java
Mon Oct 22 09:06:41 2012
@@ -31,6 +31,7 @@ import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.endpoint.EndpointException;
 import org.apache.cxf.endpoint.EndpointImpl;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.service.Service;
 import org.apache.cxf.service.ServiceImpl;
 import org.apache.cxf.service.model.BindingInfo;
@@ -82,21 +83,9 @@ public final class STSUtils {
     }
     
     public static STSClient getClient(Message message, String type) {
-        STSClient client = (STSClient)message
-            .getContextualProperty(SecurityConstants.STS_CLIENT);
-        if (client == null) {
-            if (type == null) {
-                type = "";
-            } else {
-                type = "." + type + "-client";
-            }
-            client = new STSClient(message.getExchange().get(Bus.class));
-            Endpoint ep = message.getExchange().get(Endpoint.class);
-            client.setEndpointName(ep.getEndpointInfo().getName().toString() + type);
-            client.setBeanName(ep.getEndpointInfo().getName().toString() + type);
-        }
-        return client;
+        return getClient(message, type, null);
     }
+    
     public static STSClient getClient(Message message, String type, IssuedToken itok) {
         STSClient client = (STSClient)message
             .getContextualProperty(SecurityConstants.STS_CLIENT);
@@ -110,10 +99,14 @@ public final class STSUtils {
             Endpoint ep = message.getExchange().get(Endpoint.class);
             client.setEndpointName(ep.getEndpointInfo().getName().toString() + type);
             client.setBeanName(ep.getEndpointInfo().getName().toString() + type);
-            if (itok.getIssuerEpr() != null) {
+            if (MessageUtils.getContextualBoolean(message, SecurityConstants.STS_CLIENT_SOAP12_BINDING,
false)) {
+                client.setSoap12();
+            }
+            if ((itok != null) && (itok.getIssuerEpr() != null)) {
                 //configure via mex
-                boolean useEPRWSAAddrAsMEXLocation = !Boolean.valueOf((String)message
-                        .getContextualProperty(SecurityConstants.DISABLE_STS_CLIENT_WSMEX_CALL_USING_EPR_ADDRESS));
+                boolean useEPRWSAAddrAsMEXLocation = !Boolean.valueOf(
+                        (String)message.getContextualProperty(
+                         SecurityConstants.DISABLE_STS_CLIENT_WSMEX_CALL_USING_EPR_ADDRESS));
                 client.configureViaEPR(itok.getIssuerEpr(), useEPRWSAAddrAsMEXLocation);
             }
         }



Mime
View raw message