Author: ruchithf
Date: Thu Aug 25 05:22:38 2005
New Revision: 240055

URL: http://svn.apache.org/viewcvs?rev=240055&view=rev
Log:
update to the security module: changed the WSDoAllHandler to pick the config 
information form the axis2.xml and service.xml and introduced mapping of the 
new axis2 parameters introduced due to the non-configurability module at the 
two flows

Added:
    
webservices/axis/trunk/java/modules/security/src/org/apache/axis2/security/handler/WSSHandlerConstants.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/maven.xml
    webservices/axis/trunk/java/modules/security/project.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/WSDoAllSender.java
    
webservices/axis/trunk/java/modules/security/src/org/apache/axis2/security/handler/WSDoAllHandler.java
    webservices/axis/trunk/java/modules/security/test-resources/axis2.xml

Modified: webservices/axis/trunk/java/modules/security/maven.xml
URL: 
http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/security/maven.xml?rev=240055&r1=240054&r2=240055&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/security/maven.xml (original)
+++ webservices/axis/trunk/java/modules/security/maven.xml Thu Aug 25 05:22:38 
2005
@@ -8,7 +8,16 @@
     xmlns:maven="jelly:maven"
     xmlns:deploy="deploy"
     xmlns:ant="jelly:ant">
+
+    <preGoal name="itest:compile">
+        <u:file var="file" name="${maven.itest.src}"/>
+        <j:if test="${!file.exists()}">
+            <j:expr value="${context.setVariable('maven.itest.skip', 
'true')}"/>
+        </j:if>
+    </preGoal>
+    
     <postGoal name="test:compile">
+
         <mkdir dir="target/classes/META-INF"/>
         <copy file="src/META-INF/module.xml"
             tofile="target/classes/META-INF/module.xml"/>
@@ -16,19 +25,80 @@
             tofile="target/axis2.xml"/>
         <mkdir dir="target/modules"/>
         <mkdir dir="target/modules/lib"/>
+
        <copy file="${maven.repo.local}/xml-security/jars/xmlsec-1.2.1.jar" 
todir="target/classes/lib"/>
        <copy file="${maven.repo.local}/bouncycastle/jars/bcprov-jdk13-128.jar" 
todir="target/classes/lib"/>
        <copy file="${maven.repo.local}/opensaml/jars/opensaml-1.0.1.jar" 
todir="target/classes/lib"/>
+
         <jar jarfile="target/security.mar" basedir="target/classes">
             <include name="**/*"/>
         </jar>
-        <copy file="target/security.mar"
-            tofile="target/modules/security.mar"/>
+        <copy file="target/security.mar" tofile="target/modules/security.mar"/>
+
     </postGoal>
-    <preGoal name="itest:compile">
-        <u:file var="file" name="${maven.itest.src}"/>
-        <j:if test="${!file.exists()}">
-            <j:expr value="${context.setVariable('maven.itest.skip', 
'true')}"/>
-        </j:if>
+
+    <preGoal name="java:compile">
+               <j:set var="interop.dir" value="target/interop"/>
+        <j:set var="work.dir" value="${interop.dir}/work"/>
+        <j:set var="class.dir" value="${interop.dir}/classes"/>
+
+        <mkdir dir="${interop.dir}"/>
+        <mkdir dir="${work.dir}"/>
+        <mkdir dir="${class.dir}"/>
+        
+               <!-- Run WSDL2Java -->
+        <java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
+                       <classpath refid="maven.dependency.classpath"/>
+                       <arg value="-uri"/>
+                       <arg file="interop/ping.wsdl"/>
+                       <arg value="-ss"/>
+                       <arg value="-o"/>
+                       <arg file="${work.dir}"/>
+                       <arg value="-p"/>
+                       <arg value="org.apache.axis2.oasis.ping"/>
+               </java>
+
+               <!-- move/copy schema stuff into class.dir -->
+       <copy todir="${class.dir}/schema">
+               <fileset dir="${work.dir}/schema"/>
+       </copy>
+               
+       <!-- copy the service impl -->
+       <copy file="interop/org/apache/axis2/oasis/ping/PingPortSkeleton.java" 
+               
tofile="${work.dir}/org/apache/axis2/oasis/ping/PingPortSkeleton.java" 
overwrite="yes"/>
+       
+       <copy file="test-resources/PWCallback.java" 
+               tofile="${work.dir}/org/apache/axis2/security/PWCallback.java" 
overwrite="yes"/>
+
+       <!-- This doesn't seem to work :-( -->
+       <!--Trying javac on this also doesn't work -->
+       <path id="src.dir" location="${work.dir}"/>
+        <addPath id="maven.src.dir" refid="src.dir"/>
     </preGoal>
+
+       <!--Create the service.aar" -->
+    <postGoal name="java:compile">
+
+               <j:set var="interop.dir" value="target/interop"/>
+        <j:set var="work.dir" value="${interop.dir}/work"/>
+        <j:set var="class.dir" value="${interop.dir}/classes"/>
+        
+       <!-- Create the META-INF directory -->
+       <mkdir dir="${class.dir}/META-INF"/>
+       
+       <!-- copy the service.xml-->
+               <copy file="interop/service.xml" 
+                       tofile="${class.dir}/META-INF/service.xml" 
overwrite="yes"/>            
+               
+               
+               <jar jarfile="target/interop_service.aar" 
basedir="target/interop/classes">
+            <include name="**/*"/>
+        </jar>
+        
+        <jar jarfile="target/pwcb.mar" basedir="target/classes">
+            <include name="org/apache/axis2/security/PWCallback.class"/>
+        </jar>
+
+    </postGoal>
+
 </project>

Modified: webservices/axis/trunk/java/modules/security/project.xml
URL: 
http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/security/project.xml?rev=240055&r1=240054&r2=240055&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/security/project.xml (original)
+++ webservices/axis/trunk/java/modules/security/project.xml Thu Aug 25 
05:22:38 2005
@@ -46,9 +46,17 @@
             <groupId>axis2</groupId>
             <artifactId>axis2-core</artifactId>
             <version>${pom.currentVersion}</version>
-        </dependency>
+        </dependency>        
         <!-- external JARs -->
         <dependency>
+            <groupId>axis</groupId>
+            <artifactId>axis-wsdl4j</artifactId>
+            <version>1.2</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
             <groupId>commons-logging</groupId>
             <artifactId>commons-logging</artifactId>
             <version>1.0.3</version>
@@ -108,7 +116,6 @@
                 <module>true</module>
             </properties>
         </dependency>
-        
         <dependency>
             <groupId>wss4j</groupId>
             <artifactId>wss4j</artifactId>
@@ -117,7 +124,6 @@
                 <module>true</module>
             </properties>
         </dependency>
-
         <dependency>
             <groupId>xml-security</groupId>
             <artifactId>xmlsec</artifactId>
@@ -142,7 +148,14 @@
                 <module>true</module>
             </properties>
         </dependency>
-
+        <dependency>
+            <groupId>xmlbeans</groupId>
+            <artifactId>xbean</artifactId>
+            <version>2.0.0-beta1</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
     </dependencies>
 
     <reports/>

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=240055&r1=240054&r2=240055&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
 Thu Aug 25 05:22:38 2005
@@ -48,8 +48,13 @@
 public class WSDoAllReceiver extends WSDoAllHandler {
 
     protected static Log log = 
LogFactory.getLog(WSDoAllReceiver.class.getName());
-
-       
+    
+    
+    public WSDoAllReceiver() {
+       super();
+       inHandler = true;
+    }
+    
        public void invoke(MessageContext msgContext) throws AxisFault {
        doDebug = log.isDebugEnabled();
 
@@ -57,7 +62,7 @@
             log.debug("WSDoAllReceiver: enter invoke() ");
         }
 
-        RequestData reqData = new RequestData();
+        reqData = new RequestData();
         
         try {
                reqData.setMsgContext(msgContext);
@@ -269,6 +274,8 @@
              /*
              * All ok up to this point. Now construct and setup the security
              * result structure. The service may fetch this and check it.
+             * Also the DoAllSender will use this in certain situations such 
as:
+             * USE_REQ_SIG_CERT to encrypt
              */
              Vector results = null;
              if ((results = (Vector) msgContext
@@ -282,6 +289,7 @@
              if (doDebug) {
                  log.debug("WSDoAllReceiver: exit invoke()");
              }
+             
         } catch (WSSecurityException wssEx) {
                throw new AxisFault(wssEx);
         } finally {
@@ -289,6 +297,6 @@
             reqData = null;
         }
         
-       
     }
+
 }

Modified: 
webservices/axis/trunk/java/modules/security/src/org/apache/axis2/security/WSDoAllSender.java
URL: 
http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/security/src/org/apache/axis2/security/WSDoAllSender.java?rev=240055&r1=240054&r2=240055&view=diff
==============================================================================
--- 
webservices/axis/trunk/java/modules/security/src/org/apache/axis2/security/WSDoAllSender.java
 (original)
+++ 
webservices/axis/trunk/java/modules/security/src/org/apache/axis2/security/WSDoAllSender.java
 Thu Aug 25 05:22:38 2005
@@ -22,6 +22,7 @@
 
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.OperationContext;
 import org.apache.axis2.security.handler.WSDoAllHandler;
 import org.apache.axis2.security.util.Axis2Util;
 import org.apache.axis2.soap.SOAPEnvelope;
@@ -32,12 +33,18 @@
 import org.apache.ws.security.handler.RequestData;
 import org.apache.ws.security.handler.WSHandlerConstants;
 import org.apache.ws.security.util.WSSecurityUtil;
+import org.apache.wsdl.WSDLConstants;
 import org.w3c.dom.Document;
 
 public class WSDoAllSender extends WSDoAllHandler {
 
        protected static Log log = 
LogFactory.getLog(WSDoAllSender.class.getName());
        
+    public WSDoAllSender() {
+       super();
+       inHandler = false;
+    }
+       
        public void invoke(MessageContext msgContext) throws AxisFault {
                
         doDebug = log.isDebugEnabled();
@@ -46,6 +53,18 @@
             log.debug("WSDoAllSender: enter invoke()");
         }
 
+        /*
+         * Copy the RECV_RESULTS over to the current message context
+         * - IF available 
+         */
+        OperationContext opCtx = msgContext.getOperationContext();
+        MessageContext inMsgCtx;
+        if(opCtx != null && 
+                       (inMsgCtx = 
opCtx.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN)) != null) {
+               msgContext.setProperty(WSHandlerConstants.RECV_RESULTS, 
+                               
inMsgCtx.getProperty(WSHandlerConstants.RECV_RESULTS));
+        }
+        
         RequestData reqData = new RequestData();
 
         reqData.setNoSerialization(false);

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=240055&r1=240054&r2=240055&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
 Thu Aug 25 05:22:38 2005
@@ -16,15 +16,19 @@
 
 package org.apache.axis2.security.handler;
 
+import javax.xml.namespace.QName;
+
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.description.HandlerDescription;
+import org.apache.axis2.description.OperationDescription;
 import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.ServiceDescription;
+import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.Handler;
+import org.apache.ws.security.handler.RequestData;
 import org.apache.ws.security.handler.WSHandler;
 
-import javax.xml.namespace.QName;
-
 /**
  * Class WSDoAllHandler
  */
@@ -44,7 +48,23 @@
      * Field handlerDesc
      */
     protected HandlerDescription handlerDesc;
-
+    
+    /**
+     * This is used to get hold of the message context to extract the
+     * configuration information (from axis2.xml and service.xml)
+     * out of it 
+     */
+    protected RequestData reqData;
+    
+    /**
+     * In Axis2 the user cannot set inflow and outflow parameters
+     * Therefore we need to map the Axis2 specific inflow and outflow 
+     * parameters to WSS4J params
+     * 
+     * Knowledge of inhandler and out handler is used to get the mapped value
+     */
+    protected boolean inHandler;
+    
     /**
      * Constructor AbstractHandler
      */
@@ -115,11 +135,6 @@
     }
 
 
-    public Object getOption(String key) {
-        Parameter parameter = this.handlerDesc.getParameter(key);
-               return (parameter== null)?null:parameter.getValue();
-    }
-
     public Object getProperty(Object msgContext, String key) {
         return ((MessageContext)msgContext).getProperty(key);
     }
@@ -140,5 +155,54 @@
         ((MessageContext)msgContext).setProperty(WSS_USERNAME,username);
     }
     
-        
+       /**
+        * Get optoin should extract the configuration 
+        * values from the service.xml and/or axis2.xml
+        * Values set in the service.xml takes prority over values of the
+        * axis2.xml
+        */
+    public Object getOption(String key) {
+       
+       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) {
+               value = operationDesc.getParameter(key); 
+       }
+       
+       //If the parameter is not found in the operation desc and if the 
+       //service desc is available
+       if(value == null && serviceDesc != null) {
+               value = serviceDesc.getParameter(key);
+       }
+               
+       //If the parameter is not found in the service desc the look at the 
+       //global config - axis config
+       if(value == null && axisConfig != null) {
+               value = axisConfig.getParameter(key);
+       }
+       
+       //---------------------------------------------------------------------
+       //If value is still null this point then the user has not set the value
+         
+       
+       //Look in the handlerDesc for the value
+       if(value == null) {
+               Parameter parameter = this.handlerDesc.getParameter(key);
+               value = (parameter== null)?null:parameter.getValue();
+       }
+       
+       return value;
+    }
 }

Added: 
webservices/axis/trunk/java/modules/security/src/org/apache/axis2/security/handler/WSSHandlerConstants.java
URL: 
http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/security/src/org/apache/axis2/security/handler/WSSHandlerConstants.java?rev=240055&view=auto
==============================================================================
--- 
webservices/axis/trunk/java/modules/security/src/org/apache/axis2/security/handler/WSSHandlerConstants.java
 (added)
+++ 
webservices/axis/trunk/java/modules/security/src/org/apache/axis2/security/handler/WSSHandlerConstants.java
 Thu Aug 25 05:22:38 2005
@@ -0,0 +1,40 @@
+/*
+ * 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.handler;
+
+/**
+ * 
+ * @author Ruchith Fernando ([EMAIL PROTECTED])
+ */
+public interface WSSHandlerConstants {
+
+       interface In {
+               public static final String ACTION = "InAction";
+               public static final String PW_CALLBACK_CLASS = 
"InPasswordCallbackClass";
+               public static final String SIG_PROP_FILE = 
"InSignaturePropFile";
+               public static final String SIG_KEY_ID = 
"InSignatureKeyIdentifier";
+       }
+       
+       interface Out {
+               public static final String ACTION = "OutAction";
+               public static final String PW_CALLBACK_CLASS = 
"OutPasswordCallbackClass";
+               public static final String SIG_PROP_FILE = 
"OutSignaturePropFile";
+               public static final String SIG_KEY_ID = 
"OutSignatureKeyIdentifier";
+       }
+       
+       
+       
+}

Added: 
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=240055&view=auto
==============================================================================
--- 
webservices/axis/trunk/java/modules/security/src/org/apache/axis2/security/util/WSHandlerConstantsMapper.java
 (added)
+++ 
webservices/axis/trunk/java/modules/security/src/org/apache/axis2/security/util/WSHandlerConstantsMapper.java
 Thu Aug 25 05:22:38 2005
@@ -0,0 +1,63 @@
+/*
+ * 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.util;
+
+import java.util.Hashtable;
+
+import org.apache.axis2.security.handler.WSSHandlerConstants;
+import org.apache.ws.security.handler.WSHandlerConstants;
+
+/**
+ * 
+ * 
+ * @author Ruchith Fernando ([EMAIL PROTECTED])
+ */
+public class WSHandlerConstantsMapper {
+
+       private static Hashtable inHandlerConstants = new Hashtable();
+       
+       private static Hashtable outHandlerConstants = new Hashtable();
+
+       
+       static {
+               //Mapping the in handler constants
+               
inHandlerConstants.put(WSHandlerConstants.ACTION,WSSHandlerConstants.In.ACTION);
+               
+               
+               
+               //Mapping the out handler constants
+               outHandlerConstants.put(WSHandlerConstants.ACTION, 
WSSHandlerConstants.Out.ACTION);
+               
+               
+       }
+       
+       /**
+        * If the mapping is there then the mapped value will be returned
+        * Otherwise the original value will be returned since no mapping was 
required
+        * @param axiskey
+        * @return
+        */
+       public static String getMapping(String axiskey, boolean inHandler) {
+               String newKey = null;
+               if(inHandler) {
+                       newKey = (String)inHandlerConstants.get(axiskey);
+               } else {
+                       newKey = (String)outHandlerConstants.get(axiskey);
+               }
+               return (newKey == null)?axiskey:newKey;
+       }
+       
+}

Added: 
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=240055&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/security/test-resources/PWCallback.java 
(added)
+++ webservices/axis/trunk/java/modules/security/test-resources/PWCallback.java 
Thu Aug 25 05:22:38 2005
@@ -0,0 +1,174 @@
+package org.apache.axis2.security;
+
+
+import org.apache.ws.security.WSPasswordCallback;
+
+
+
+import javax.security.auth.callback.Callback;
+
+import javax.security.auth.callback.CallbackHandler;
+
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+import java.io.IOException;
+
+
+
+/**
+
+ * Class PWCallback
+
+ */
+
+public class PWCallback implements CallbackHandler {
+
+
+
+    /** Field key */
+
+    private static final byte[] key = {
+
+        (byte) 0x31, (byte) 0xfd, (byte) 0xcb, (byte) 0xda, (byte) 0xfb,
+
+        (byte) 0xcd, (byte) 0x6b, (byte) 0xa8, (byte) 0xe6, (byte) 0x19,
+
+        (byte) 0xa7, (byte) 0xbf, (byte) 0x51, (byte) 0xf7, (byte) 0xc7,
+
+        (byte) 0x3e, (byte) 0x80, (byte) 0xae, (byte) 0x98, (byte) 0x51,
+
+        (byte) 0xc8, (byte) 0x51, (byte) 0x34, (byte) 0x04,
+
+    };
+
+
+
+    /*
+
+     * (non-Javadoc)
+
+     * @see 
javax.security.auth.callback.CallbackHandler#handle(javax.security.auth.callback.Callback[])
+
+     */
+
+
+
+    /**
+
+     * Method handle
+
+     * 
+
+     * @param callbacks 
+
+     * @throws java.io.IOException                  
+
+     * @throws javax.security.auth.callback.UnsupportedCallbackException 
+
+     */
+
+    public void handle(Callback[] callbacks)
+
+            throws IOException, UnsupportedCallbackException {
+
+
+
+        for (int i = 0; i < callbacks.length; i++) {
+
+            if (callbacks[i] instanceof WSPasswordCallback) {
+
+                WSPasswordCallback pc = (WSPasswordCallback) callbacks[i];
+
+
+
+                /*
+
+                 * This usage type is used only in case we received a
+
+                 * username token with a password of type PasswordText or
+
+                 * an unknown password type.
+
+                 * 
+
+                 * This case the WSPasswordCallback object contains the
+
+                 * identifier (aka username), the password we received, and
+
+                 * the password type string to identify the type.
+
+                 * 
+
+                 * Here we perform only a very simple check.
+
+                 */
+
+                if (pc.getUsage() == 
WSPasswordCallback.USERNAME_TOKEN_UNKNOWN) {
+
+                       if(pc.getIdentifer().equals("Ron") && 
pc.getPassword().equals("noR")) {
+
+                        return;
+
+                       }
+
+                    if (pc.getPassword().equals("sirhC")) {
+
+                        return;
+
+                    }                  
+
+                    throw new UnsupportedCallbackException(callbacks[i],
+
+                    "check failed");
+
+                }
+
+                /*
+
+                 * here call a function/method to lookup the password for
+
+                 * the given identifier (e.g. a user name or keystore alias)
+
+                 * e.g.: 
pc.setPassword(passStore.getPassword(pc.getIdentfifier))
+
+                 * for Testing we supply a fixed name here.
+
+                 */
+
+                if (pc.getUsage() == WSPasswordCallback.KEY_NAME) {
+
+                    pc.setKey(key);
+
+                } else if(pc.getIdentifer().equals("alice")) {
+
+                    pc.setPassword("password");
+
+                } else if(pc.getIdentifer().equals("bob")) {
+
+                    pc.setPassword("password");
+
+                } else if(pc.getIdentifer().equals("Ron")) {
+
+                    pc.setPassword("noR");
+
+                } else {
+
+                    pc.setPassword("sirhC");
+
+                }
+
+            } else {
+
+                throw new UnsupportedCallbackException(callbacks[i],
+
+                        "Unrecognized Callback");
+
+            }
+
+        }
+
+    }
+
+}
+
+

Modified: webservices/axis/trunk/java/modules/security/test-resources/axis2.xml
URL: 
http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/security/test-resources/axis2.xml?rev=240055&r1=240054&r2=240055&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/security/test-resources/axis2.xml 
(original)
+++ webservices/axis/trunk/java/modules/security/test-resources/axis2.xml Thu 
Aug 25 05:22:38 2005
@@ -4,6 +4,12 @@
 
     <messageReceiver mep="INOUT" 
class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
 
+
+    <!-- This is only till we get the service specific parameters fixed in 
service.xml -->
+       <parameter name="InAction" locked="xsd:false">UsernameToken</parameter>
+       <parameter name="passwordCallbackClass" 
locked="xsd:false">org.apache.axis2.security.PWCallback</parameter>
+
+
     <transportReceiver name="http">
     </transportReceiver>
     <transportSender name="http" 
class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
@@ -11,6 +17,7 @@
     </transportSender>
 
     <module ref="security"/>
+    
     <phaseOrder type="inflow">
         <!--  System pre defined phases       -->
         <phase name="TransportIn"/>


Reply via email to