axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ruchi...@apache.org
Subject svn commit: r240210 - in /webservices/axis/trunk/java/modules/security: interop/ src/org/apache/axis2/security/ src/org/apache/axis2/security/handler/ src/org/apache/axis2/security/util/ test-resources/
Date Fri, 26 Aug 2005 11:38:21 GMT
Author: ruchithf
Date: Fri Aug 26 04:38:08 2005
New Revision: 240210

URL: http://svn.apache.org/viewcvs?rev=240210&view=rev
Log:
Bug fixes for secuity handlers: Added missing parameter name mappings and corrected the extraction
of parameters from the message context in the hanlders

Modified:
    webservices/axis/trunk/java/modules/security/interop/service.xml
    webservices/axis/trunk/java/modules/security/src/org/apache/axis2/security/WSDoAllReceiver.java
    webservices/axis/trunk/java/modules/security/src/org/apache/axis2/security/handler/WSDoAllHandler.java
    webservices/axis/trunk/java/modules/security/src/org/apache/axis2/security/util/WSHandlerConstantsMapper.java
    webservices/axis/trunk/java/modules/security/test-resources/PWCallback.java

Modified: webservices/axis/trunk/java/modules/security/interop/service.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/security/interop/service.xml?rev=240210&r1=240209&r2=240210&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/security/interop/service.xml (original)
+++ webservices/axis/trunk/java/modules/security/interop/service.xml Fri Aug 26 04:38:08 2005
@@ -4,14 +4,5 @@
 	<!--Mounting the method Ping-->
 	<operation name="Ping">
 		<messageReceiver class="org.apache.axis2.oasis.ping.PingPortMessageReceiver"/>
-	</operation>
-    <inflow>
-		<parameter name="action" locked="xsd:false">UsernameToken</parameter>
-		<parameter name="passwordCallbackClass" locked="xsd:false">org.ruchith.sample1.PWCallback</parameter>
-    </inflow>
-
-    <outflow>
-		<parameter name="action" locked="xsd:false">NoSecurity</parameter>
-    </outflow>
-    
+	</operation>    
 </service>

Modified: webservices/axis/trunk/java/modules/security/src/org/apache/axis2/security/WSDoAllReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/security/src/org/apache/axis2/security/WSDoAllReceiver.java?rev=240210&r1=240209&r2=240210&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/security/src/org/apache/axis2/security/WSDoAllReceiver.java
(original)
+++ webservices/axis/trunk/java/modules/security/src/org/apache/axis2/security/WSDoAllReceiver.java
Fri Aug 26 04:38:08 2005
@@ -61,7 +61,6 @@
         if (doDebug) {
             log.debug("WSDoAllReceiver: enter invoke() ");
         }
-
         reqData = new RequestData();
         
         try {
@@ -70,8 +69,7 @@
             Vector actions = new Vector();
             String action = null;
             if ((action = (String) getOption(WSHandlerConstants.ACTION)) == null) {
-                action = (String) msgContext
-                        .getProperty(WSHandlerConstants.ACTION);
+                action = (String) getProperty(msgContext, WSHandlerConstants.ACTION);
             }
             if (action == null) {
                 throw new AxisFault("WSDoAllReceiver: No action defined");
@@ -174,6 +172,7 @@
 			Iterator headers = header.examineHeaderBlocks(actor);
 			
 			SOAPHeaderBlock headerBlock = null;
+			
 			while(headers.hasNext()) { //Find the wsse header
 				SOAPHeaderBlock hb = (SOAPHeaderBlock)headers.next();
                 if (hb.getLocalName().equals(WSConstants.WSSE_LN)
@@ -231,8 +230,7 @@
                  if (timestamp != null) {
                      String ttl = null;
                      if ((ttl = (String) getOption(WSHandlerConstants.TTL_TIMESTAMP)) ==
null) {
-                         ttl = (String) msgContext
-                                 .getProperty(WSHandlerConstants.TTL_TIMESTAMP);
+                         ttl = (String) getProperty(msgContext,WSHandlerConstants.TTL_TIMESTAMP);
                      }
                      int ttl_i = 0;
                      if (ttl != null) {
@@ -278,8 +276,7 @@
              * USE_REQ_SIG_CERT to encrypt
              */
              Vector results = null;
-             if ((results = (Vector) msgContext
-                     .getProperty(WSHandlerConstants.RECV_RESULTS)) == null) {
+             if ((results = (Vector) getProperty(msgContext, WSHandlerConstants.RECV_RESULTS))
== null) {
                  results = new Vector();
                  msgContext
                          .setProperty(WSHandlerConstants.RECV_RESULTS, results);

Modified: webservices/axis/trunk/java/modules/security/src/org/apache/axis2/security/handler/WSDoAllHandler.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/security/src/org/apache/axis2/security/handler/WSDoAllHandler.java?rev=240210&r1=240209&r2=240210&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/security/src/org/apache/axis2/security/handler/WSDoAllHandler.java
(original)
+++ webservices/axis/trunk/java/modules/security/src/org/apache/axis2/security/handler/WSDoAllHandler.java
Fri Aug 26 04:38:08 2005
@@ -19,7 +19,10 @@
 import javax.xml.namespace.QName;
 
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.OperationContext;
+import org.apache.axis2.context.ServiceContext;
 import org.apache.axis2.description.HandlerDescription;
 import org.apache.axis2.description.OperationDescription;
 import org.apache.axis2.description.Parameter;
@@ -138,6 +141,7 @@
 
     public Object getProperty(Object msgContext, String axisKey) {
     	String key = WSHandlerConstantsMapper.getMapping(axisKey,inHandler);
+    	System.out.println("Axis key: " + axisKey + " Key : " + key);
         return ((MessageContext)msgContext).getProperty(key);
     }
 
@@ -168,39 +172,49 @@
     	String key  = WSHandlerConstantsMapper.getMapping(axisKey,inHandler);
     	
     	MessageContext msgContext = (MessageContext)this.reqData.getMsgContext();
-    	
-    	//If the parameters are set globally in the axis2.xml 
-    	AxisConfiguration axisConfig = msgContext.getSystemContext().getAxisConfiguration();
-    	
-    	//If the parameters are set in the scope of the service in service.xml
-    	ServiceDescription serviceDesc = msgContext.getServiceContext().getServiceConfig();
-    	
-    	//If the parameters are set in the scope of an peration in service.xml
-    	OperationDescription operationDesc = msgContext.getOperationContext().getAxisOperation();
-    	
     	Object value = null;
     	
-    	//if the operation desc is available
-    	if(operationDesc != null) {
-    		Parameter parameter = operationDesc.getParameter(key);
-			value = (parameter!=null)?parameter.getValue():null; 
-    	}
-    	
-    	//If the parameter is not found in the operation desc and if the 
-    	//service desc is available
-    	if(value == null && serviceDesc != null) {
-    		Parameter parameter = serviceDesc.getParameter(key);
-			value = (parameter!=null)?parameter.getValue():null;
-    	}
-    		
-    	//If the parameter is not found in the service desc the look at the 
-    	//global config - axis config
-    	if(value == null && axisConfig != null) {
-    		Parameter parameter = axisConfig.getParameter(key);
-			value = (parameter!=null)?parameter.getValue():null;
-    	}
     	
-    	//---------------------------------------------------------------------
+    	// If the parameters are set in the scope of an peration in service.xml
+		OperationContext operationContext = msgContext.getOperationContext();
+		if (operationContext != null) {
+			OperationDescription operationDesc = operationContext
+					.getAxisOperation();
+
+			// if the operation desc is available
+			if (operationDesc != null) {
+				Parameter parameter = operationDesc.getParameter(key);
+				value = (parameter != null) ? parameter.getValue() : null;
+			}
+		}
+
+		// If the parameters are set in the scope of the service in service.xml
+		ServiceContext serviceContext = msgContext.getServiceContext();
+		if (serviceContext != null) {
+			ServiceDescription serviceDesc = serviceContext.getServiceConfig();
+
+			// If the parameter is not found in the operation desc and if the
+			// service desc is available
+			if (value == null && serviceDesc != null) {
+				Parameter parameter = serviceDesc.getParameter(key);
+				value = (parameter != null) ? parameter.getValue() : null;
+			}
+		}
+
+		// If the parameters are set globally in the axis2.xml
+		ConfigurationContext systemContext = msgContext.getSystemContext();
+		if (systemContext != null) {
+			AxisConfiguration axisConfig = systemContext.getAxisConfiguration();
+
+			// If the parameter is not found in the service desc the look at the
+			// global config - axis config
+			if (value == null && axisConfig != null) {
+				Parameter parameter = axisConfig.getParameter(key);
+				value = (parameter != null) ? parameter.getValue() : null;
+			}
+		}
+		
+    	// ---------------------------------------------------------------------
     	//If value is still null this point then the user has not set the value
     	  
     	

Modified: webservices/axis/trunk/java/modules/security/src/org/apache/axis2/security/util/WSHandlerConstantsMapper.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/security/src/org/apache/axis2/security/util/WSHandlerConstantsMapper.java?rev=240210&r1=240209&r2=240210&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/security/src/org/apache/axis2/security/util/WSHandlerConstantsMapper.java
(original)
+++ webservices/axis/trunk/java/modules/security/src/org/apache/axis2/security/util/WSHandlerConstantsMapper.java
Fri Aug 26 04:38:08 2005
@@ -34,13 +34,16 @@
 	
 	static {
 		//Mapping the in handler constants
-		inHandlerConstants.put(WSHandlerConstants.ACTION,WSSHandlerConstants.In.ACTION);
-		
-		
+		inHandlerConstants.put(WSHandlerConstants.ACTION, WSSHandlerConstants.In.ACTION);
+		inHandlerConstants.put(WSHandlerConstants.PW_CALLBACK_CLASS, WSSHandlerConstants.In.PW_CALLBACK_CLASS);
+		inHandlerConstants.put(WSHandlerConstants.SIG_PROP_FILE, WSSHandlerConstants.In.SIG_PROP_FILE);
+		inHandlerConstants.put(WSHandlerConstants.SIG_KEY_ID, WSSHandlerConstants.In.SIG_KEY_ID);
 		
 		//Mapping the out handler constants
 		outHandlerConstants.put(WSHandlerConstants.ACTION, WSSHandlerConstants.Out.ACTION);
-		
+		outHandlerConstants.put(WSHandlerConstants.PW_CALLBACK_CLASS, WSSHandlerConstants.Out.PW_CALLBACK_CLASS);
+		outHandlerConstants.put(WSHandlerConstants.SIG_PROP_FILE, WSSHandlerConstants.Out.SIG_PROP_FILE);
+		outHandlerConstants.put(WSHandlerConstants.SIG_KEY_ID, WSSHandlerConstants.Out.SIG_KEY_ID);
 		
 	}
 	

Modified: webservices/axis/trunk/java/modules/security/test-resources/PWCallback.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/security/test-resources/PWCallback.java?rev=240210&r1=240209&r2=240210&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/security/test-resources/PWCallback.java (original)
+++ webservices/axis/trunk/java/modules/security/test-resources/PWCallback.java Fri Aug 26
04:38:08 2005
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.axis2.security;
 
 



Mime
View raw message