You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ru...@apache.org on 2005/09/24 17:01:28 UTC

svn commit: r291307 - in /webservices/axis2/trunk/java/modules: integration/test/org/apache/axis2/security/ security/src/org/apache/axis2/security/ security/src/org/apache/axis2/security/util/

Author: ruchithf
Date: Sat Sep 24 08:01:13 2005
New Revision: 291307

URL: http://svn.apache.org/viewcvs?rev=291307&view=rev
Log:
security module updated to enable the WSDoAllReceiver to get the signature values from a thread local reference at the client side

Modified:
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/InteropTestBase.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/WSDoAllReceiver.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/WSDoAllSender.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/util/Axis2Util.java

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/InteropTestBase.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/InteropTestBase.java?rev=291307&r1=291306&r2=291307&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/InteropTestBase.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/InteropTestBase.java Sat Sep 24 08:01:13 2005
@@ -129,12 +129,12 @@
 	 * Do test
 	 */
     public void testInterop() {
-//    	try {
-//    		InteropScenarioClient.main(new String[]{Constants.TESTING_PATH + clientRepo,targetEpr});
-//    	} catch (Exception e) {
-//    		e.printStackTrace();
-//    		fail("Error in introperating with " + targetEpr + ", client configuration: " + clientRepo);
-//    	}
+    	try {
+    		InteropScenarioClient.main(new String[]{Constants.TESTING_PATH + clientRepo,targetEpr});
+    	} catch (Exception e) {
+    		e.printStackTrace();
+    		fail("Error in introperating with " + targetEpr + ", client configuration: " + clientRepo);
+    	}
     }
     
     

Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/WSDoAllReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/WSDoAllReceiver.java?rev=291307&r1=291306&r2=291307&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/WSDoAllReceiver.java (original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/WSDoAllReceiver.java Sat Sep 24 08:01:13 2005
@@ -24,7 +24,6 @@
 
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.OperationContext;
 import org.apache.axis2.om.OMException;
 import org.apache.axis2.security.handler.WSDoAllHandler;
 import org.apache.axis2.security.handler.WSSHandlerConstants;
@@ -43,7 +42,6 @@
 import org.apache.ws.security.handler.WSHandlerResult;
 import org.apache.ws.security.message.token.Timestamp;
 import org.apache.ws.security.util.WSSecurityUtil;
-import org.apache.wsdl.WSDLConstants;
 import org.w3c.dom.Document;
 
 public class WSDoAllReceiver extends WSDoAllHandler {
@@ -59,12 +57,30 @@
 	public void invoke(MessageContext msgContext) throws AxisFault {
     	boolean doDebug = log.isDebugEnabled();
 
-    	//Copy the WSHandlerConstants.SEND_SIGV over to the new message 
-    	//context - if it exists
-    	if(!msgContext.isServerSide()) {//To make sure this is a response message 
-    		OperationContext opCtx = msgContext.getOperationContext();
-    		MessageContext outMsgCtx = opCtx.getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT);
-    		msgContext.setProperty(WSHandlerConstants.SEND_SIGV,outMsgCtx.getProperty(WSHandlerConstants.SEND_SIGV));
+    	/**
+    	 * Cannot do the following right now since we cannot access the req 
+    	 * mc when this handler runs in the client side.
+    	 * This is the same even if the handler is placed at the end of the 
+    	 * post dispatch phase
+    	 *     <inflow>
+         *			<handler name="SecurityInHandler" class="org.apache.axis2.security.WSDoAllReceiver">
+         *				<order phase="PostDispatch" phaseLast="true"/>
+         *			</handler>
+         *		</inflow> 
+    	 */
+    	
+//    	//Copy the WSHandlerConstants.SEND_SIGV over to the new message 
+//    	//context - if it exists
+//    	if(!msgContext.isServerSide()) {//To make sure this is a response message 
+//    		OperationContext opCtx = msgContext.getOperationContext();
+//    		MessageContext outMsgCtx = opCtx.getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT);
+//    		msgContext.setProperty(WSHandlerConstants.SEND_SIGV,outMsgCtx.getProperty(WSHandlerConstants.SEND_SIGV));
+//    	}
+//    	
+    	
+    	//Getting the signature values using a static hook
+    	if(!msgContext.isServerSide()) {
+    		msgContext.setProperty(WSHandlerConstants.SEND_SIGV,Axis2Util.getSignatureValues());
     	}
     	
         if (doDebug) {

Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/WSDoAllSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/WSDoAllSender.java?rev=291307&r1=291306&r2=291307&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/WSDoAllSender.java (original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/WSDoAllSender.java Sat Sep 24 08:01:13 2005
@@ -208,7 +208,6 @@
 	            MessageOptimizer.optimize(msgContext.getEnvelope(),optimizeParts);
             }
             
-            
             //Enable handler repetition
             String repeat;
             int repeatCount;
@@ -244,6 +243,19 @@
 		        	this.invoke(msgContext);
 		        }
 	        }
+	        
+            /**
+             * Set the signature values
+             * this is a bad way of doing this
+             * we shoudl be able to keep this in the message context and 
+             * retrieve the value at the response. But right now this is not 
+             * possible since we don't have access to the req mc at the response
+             * in the CLIENT side
+             */
+            if(!msgContext.isServerSide()) {
+            	Axis2Util.setSignatureValues((Vector)msgContext.getProperty(WSHandlerConstants.SEND_SIGV));
+            	
+            }
 
             if (doDebug) {
 				log.debug("WSDoAllSender: exit invoke()");

Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/util/Axis2Util.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/util/Axis2Util.java?rev=291307&r1=291306&r2=291307&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/util/Axis2Util.java (original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/util/Axis2Util.java Sat Sep 24 08:01:13 2005
@@ -18,6 +18,7 @@
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
+import java.util.Vector;
 
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.stream.XMLInputFactory;
@@ -41,6 +42,9 @@
  */
 public class Axis2Util {
 
+	private static ThreadLocal signatureValues = new ThreadLocal();
+	
+	
 	/**
 	 * Create a DOM Document using the SOAP Envelope
 	 * @param env An org.apache.axis2.soap.SOAPEnvelope instance 
@@ -160,5 +164,13 @@
 			throw new WSSecurityException(e.getMessage(),e);
 		}
 
+	}
+
+	public static Vector getSignatureValues() {
+		return (Vector)signatureValues.get();
+	}
+
+	public static void setSignatureValues(Vector signatureValues) {
+		Axis2Util.signatureValues.set(signatureValues);
 	}
 }