You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by ru...@apache.org on 2008/06/11 07:55:59 UTC

svn commit: r666535 - in /synapse/trunk/java/modules/core/src/main/java/org/apache/synapse: config/xml/endpoints/ core/axis2/ endpoints/utils/

Author: ruwan
Date: Tue Jun 10 22:55:58 2008
New Revision: 666535

URL: http://svn.apache.org/viewvc?rev=666535&view=rev
Log:
Partiall fix to the issue SYNAPSE-355, this issue is blocked by the RAMPART-175 and we need to wait for that to be fixed to fix rest of this issue. It should be just two lines change after that.

Modified:
    synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/EndpointFactory.java
    synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/EndpointSerializer.java
    synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java
    synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/utils/EndpointDefinition.java

Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/EndpointFactory.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/EndpointFactory.java?rev=666535&r1=666534&r2=666535&view=diff
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/EndpointFactory.java (original)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/EndpointFactory.java Tue Jun 10 22:55:58 2008
@@ -31,6 +31,7 @@
 import org.apache.synapse.endpoints.Endpoint;
 import org.apache.synapse.endpoints.IndirectEndpoint;
 import org.apache.synapse.endpoints.utils.EndpointDefinition;
+import org.apache.synapse.util.PolicyInfo;
 
 import javax.xml.namespace.QName;
 import java.util.ArrayList;
@@ -174,10 +175,22 @@
 
             definition.setSecurityOn(true);
 
-            OMAttribute policy
-                    = wsSec.getAttribute(new QName(XMLConfigConstants.NULL_NAMESPACE, "policy"));
-            if (policy != null) {
-                definition.setWsSecPolicyKey(policy.getAttributeValue());
+            OMAttribute policyKey      = wsSec.getAttribute(
+                    new QName(XMLConfigConstants.NULL_NAMESPACE, "policy"));
+            OMAttribute inboundPolicyKey  = wsSec.getAttribute(
+                    new QName(XMLConfigConstants.NULL_NAMESPACE, "inboundPolicy"));
+            OMAttribute outboundPolicyKey = wsSec.getAttribute(
+                    new QName(XMLConfigConstants.NULL_NAMESPACE, "outboundPolicy"));
+            
+            if (policyKey != null && policyKey.getAttributeValue() != null) {
+                definition.setWsSecPolicyKey(policyKey.getAttributeValue());
+            } else {
+                if (inboundPolicyKey != null && inboundPolicyKey.getAttributeValue() != null) {
+                    definition.setInboundWsSecPolicyKey(inboundPolicyKey.getAttributeValue());
+                }
+                if (outboundPolicyKey != null && outboundPolicyKey.getAttributeValue() != null) {
+                    definition.setOutboundWsSecPolicyKey(outboundPolicyKey.getAttributeValue());
+                }
             }
         }
 

Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/EndpointSerializer.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/EndpointSerializer.java?rev=666535&r1=666534&r2=666535&view=diff
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/EndpointSerializer.java (original)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/EndpointSerializer.java Tue Jun 10 22:55:58 2008
@@ -28,6 +28,7 @@
 import org.apache.synapse.config.xml.XMLConfigConstants;
 import org.apache.synapse.endpoints.*;
 import org.apache.synapse.endpoints.utils.EndpointDefinition;
+import org.apache.synapse.util.PolicyInfo;
 
 /**
  * All endpoint serializers should implement this interface. Use EndpointSerializer to
@@ -127,6 +128,15 @@
             if (endpointDefinition.getWsSecPolicyKey() != null) {
                 sec.addAttribute(fac.createOMAttribute(
                         "policy", null, endpointDefinition.getWsSecPolicyKey()));
+            } else {
+                if (endpointDefinition.getInboundWsSecPolicyKey() != null) {
+                    sec.addAttribute(fac.createOMAttribute(
+                            "inboundPolicy", null, endpointDefinition.getInboundWsSecPolicyKey()));
+                }
+                if (endpointDefinition.getOutboundWsSecPolicyKey() != null) {
+                    sec.addAttribute(fac.createOMAttribute(
+                            "outboundPolicy", null, endpointDefinition.getOutboundWsSecPolicyKey()));
+                }
             }
             element.addChild(sec);
         }

Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java?rev=666535&r1=666534&r2=666535&view=diff
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java (original)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java Tue Jun 10 22:55:58 2008
@@ -50,6 +50,7 @@
 import org.apache.synapse.SynapseException;
 import org.apache.synapse.endpoints.utils.EndpointDefinition;
 import org.apache.synapse.util.MessageHelper;
+import org.apache.synapse.util.PolicyInfo;
 
 import javax.xml.namespace.QName;
 import java.util.ArrayList;
@@ -77,22 +78,26 @@
         EndpointDefinition endpoint,
         org.apache.synapse.MessageContext synapseOutMessageContext) throws AxisFault {
 
-        boolean separateListener    = false;
-        boolean wsSecurityEnabled   = false;
-        String wsSecPolicyKey       = null;
-        boolean wsRMEnabled         = false;
-        String wsRMPolicyKey        = null;
-        boolean wsAddressingEnabled = false;
-        String wsAddressingVersion  = null;
+        boolean separateListener      = false;
+        boolean wsSecurityEnabled     = false;
+        String wsSecPolicyKey         = null;
+        String inboundWsSecPolicyKey  = null;
+        String outboundWsSecPolicyKey = null;
+        boolean wsRMEnabled           = false;
+        String wsRMPolicyKey          = null;
+        boolean wsAddressingEnabled   = false;
+        String wsAddressingVersion    = null;
 
         if (endpoint != null) {
-            separateListener    = endpoint.isUseSeparateListener();
-            wsSecurityEnabled   = endpoint.isSecurityOn();
-            wsSecPolicyKey      = endpoint.getWsSecPolicyKey();
-            wsRMEnabled         = endpoint.isReliableMessagingOn();
-            wsRMPolicyKey       = endpoint.getWsRMPolicyKey();
-            wsAddressingEnabled = endpoint.isAddressingOn() || wsSecurityEnabled || wsRMEnabled;
-            wsAddressingVersion = endpoint.getAddressingVersion();
+            separateListener       = endpoint.isUseSeparateListener();
+            wsSecurityEnabled      = endpoint.isSecurityOn();
+            wsSecPolicyKey         = endpoint.getWsSecPolicyKey();
+            inboundWsSecPolicyKey  = endpoint.getInboundWsSecPolicyKey();
+            outboundWsSecPolicyKey = endpoint.getOutboundWsSecPolicyKey();
+            wsRMEnabled            = endpoint.isReliableMessagingOn();
+            wsRMPolicyKey          = endpoint.getWsRMPolicyKey();
+            wsAddressingEnabled    = endpoint.isAddressingOn() || wsSecurityEnabled || wsRMEnabled;
+            wsAddressingVersion    = endpoint.getAddressingVersion();
         }
 
         if (log.isDebugEnabled()) {
@@ -248,11 +253,20 @@
                 clientOptions.setProperty(
                     SynapseConstants.RAMPART_POLICY,
                     getPolicy(synapseOutMessageContext, wsSecPolicyKey));
+            } else {
+                if (inboundWsSecPolicyKey != null) {
+                    // todo: set the in message policy for rampart
+                    // blocked by [https://issues.apache.org/jira/browse/RAMPART-175]
+                }
+                if (outboundWsSecPolicyKey != null) {
+                    // todo: set the out message policy for rampart
+                    // blocked by [https://issues.apache.org/jira/browse/RAMPART-175]
+                }
             }
             // temporary workaround for https://issues.apache.org/jira/browse/WSCOMMONS-197
             if (axisOutMsgCtx.getEnvelope().getHeader() == null) {
                 SOAPFactory fac = axisOutMsgCtx.isSOAP11() ?
-                    OMAbstractFactory.getSOAP11Factory() : OMAbstractFactory.getSOAP12Factory();
+                        OMAbstractFactory.getSOAP11Factory() : OMAbstractFactory.getSOAP12Factory();
                 fac.createSOAPHeader(axisOutMsgCtx.getEnvelope());
             }
         }

Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/utils/EndpointDefinition.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/utils/EndpointDefinition.java?rev=666535&r1=666534&r2=666535&view=diff
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/utils/EndpointDefinition.java (original)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/utils/EndpointDefinition.java Tue Jun 10 22:55:58 2008
@@ -59,6 +59,14 @@
      */
     private String wsSecPolicyKey = null;
     /**
+     * The "key" for any Rampart Security Policy to be used for inbound messages
+     */
+    private String inboundWsSecPolicyKey = null;
+    /**
+     * The "key" for any Rampart Security Policy to be used for outbound messages
+     */
+    private String outboundWsSecPolicyKey = null;
+    /**
      * use a separate listener - implies addressing is on *
      */
     private boolean useSeparateListener = false;
@@ -220,7 +228,7 @@
     /**
      * Return the Rampart Security configuration policys' 'key' to be used (See Rampart)
      *
-     * @return the ORampart Security configuration policys' 'key' to be used (See Rampart)
+     * @return the Rampart Security configuration policys' 'key' to be used (See Rampart)
      */
     public String getWsSecPolicyKey() {
         return wsSecPolicyKey;
@@ -236,6 +244,45 @@
     }
 
     /**
+     * Return the Rampart Security configuration policys' 'key' to be used for inbound messages
+     * (See Rampart)
+     *
+     * @return the Rampart Security configuration policys' 'key' to be used for inbound messages
+     */
+    public String getInboundWsSecPolicyKey() {
+        return inboundWsSecPolicyKey;
+    }
+
+    /**
+     * Set the Rampart Security configuration policys' 'key' to be used for inbound messages
+     * (See Rampart)
+     *
+     * @param inboundWsSecPolicyKey the Rampart Security configuration policys' 'key' to be used
+     */
+    public void setInboundWsSecPolicyKey(String inboundWsSecPolicyKey) {
+        this.inboundWsSecPolicyKey = inboundWsSecPolicyKey;
+    }
+
+    /**
+     * Return the Rampart Security configuration policys' 'key' to be used for outbound messages
+     * (See Rampart)
+     *
+     * @return the ORampart Security configuration policys' 'key' to be used for outbound messages
+     */
+    public String getOutboundWsSecPolicyKey() {
+        return outboundWsSecPolicyKey;
+    }
+
+    /**
+     * Set the Rampart Security configuration policys' 'key' to be used (See Rampart)
+     *
+     * @param outboundWsSecPolicyKey the Rampart Security configuration policys' 'key' to be used
+     */
+    public void setOutboundWsSecPolicyKey(String outboundWsSecPolicyKey) {
+        this.outboundWsSecPolicyKey = outboundWsSecPolicyKey;
+    }
+
+    /**
      * Get the WS-RM configuration policys' 'key' to be used
      *
      * @return the WS-RM configuration policys' 'key' to be used