You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rampart-dev@ws.apache.org by na...@apache.org on 2008/06/12 14:56:56 UTC

svn commit: r667065 - /webservices/rampart/trunk/java/modules/rampart-core/src/main/java/org/apache/rampart/RampartMessageData.java

Author: nandana
Date: Thu Jun 12 05:56:56 2008
New Revision: 667065

URL: http://svn.apache.org/viewvc?rev=667065&view=rev
Log:
RAMPART-175 Allow ability to specify message level policies using client's options

Modified:
    webservices/rampart/trunk/java/modules/rampart-core/src/main/java/org/apache/rampart/RampartMessageData.java

Modified: webservices/rampart/trunk/java/modules/rampart-core/src/main/java/org/apache/rampart/RampartMessageData.java
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/java/modules/rampart-core/src/main/java/org/apache/rampart/RampartMessageData.java?rev=667065&r1=667064&r2=667065&view=diff
==============================================================================
--- webservices/rampart/trunk/java/modules/rampart-core/src/main/java/org/apache/rampart/RampartMessageData.java (original)
+++ webservices/rampart/trunk/java/modules/rampart-core/src/main/java/org/apache/rampart/RampartMessageData.java Thu Jun 12 05:56:56 2008
@@ -63,6 +63,10 @@
      */
     public final static String KEY_RAMPART_POLICY = "rampartPolicy";
     
+    public final static String KEY_RAMPART_IN_POLICY = "rampartInPolicy";
+        
+    public final static String KEY_RAMPART_OUT_POLICY = "rampartOutPolicy";
+    
     /**
      * Key to hold the populated RampartPolicyData object
      */
@@ -191,6 +195,35 @@
                 this.servicePolicy = (Policy)msgCtx.getProperty(KEY_RAMPART_POLICY);
             }
             
+            
+            // Checking which flow we are in
+            int flow = msgCtx.getFLOW();
+            
+            // If we are IN flow or IN_FAULT flow and the KEY_RAMPART_IN_POLICY is set , we set the
+            // merge that policy to the KEY_RAMPART_POLICY if it is present. Else we set 
+            // KEY_RAMPART_IN_POLICY as the service policy
+            if ( (flow == MessageContext.IN_FLOW || flow == MessageContext.IN_FAULT_FLOW ) 
+                    &&  msgCtx.getProperty(KEY_RAMPART_IN_POLICY) != null) {
+                if ( this.servicePolicy == null ) {
+                    this.servicePolicy = (Policy)msgCtx.getProperty(KEY_RAMPART_IN_POLICY);
+                } else {
+                    this.servicePolicy = this.servicePolicy.merge((Policy)msgCtx
+                            .getProperty(KEY_RAMPART_IN_POLICY));
+                }
+                
+            // If we are OUT flow or OUT_FAULT flow and the KEY_RAMPART_OUT_POLICY is set , we set 
+            // the merge that policy to the KEY_RAMPART_POLICY if it is present. Else we set 
+            // KEY_RAMPART_OUT_POLICY as the service policy    
+            } else if ( (flow == MessageContext.OUT_FLOW || flow == MessageContext.OUT_FAULT_FLOW ) 
+                    &&  msgCtx.getProperty(KEY_RAMPART_OUT_POLICY) != null) {
+                if (this.servicePolicy == null) {
+                    this.servicePolicy = (Policy)msgCtx.getProperty(KEY_RAMPART_OUT_POLICY);
+                } else {
+                    this.servicePolicy = this.servicePolicy.merge((Policy)msgCtx
+                            .getProperty(KEY_RAMPART_OUT_POLICY));
+                }
+            }
+            
             /*
              * Init policy:
              * When creating the RampartMessageData instance we 
@@ -238,6 +271,7 @@
                         rc.setSigCryptoConfig(rampartConfig.getSigCryptoConfig());
                         rc.setDecCryptoConfig(rampartConfig.getDecCryptoConfig());
                         rc.setUser(rampartConfig.getUser());
+                        rc.setUserCertAlias(rc.getUserCertAlias());
                         rc.setEncryptionUser(rampartConfig.getEncryptionUser());
                         rc.setPwCbClass(rampartConfig.getPwCbClass());
                         rc.setSSLConfig(rampartConfig.getSSLConfig());