axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kausha...@apache.org
Subject svn commit: r486550 - in /webservices/axis2/trunk/c/rampart: include/ samples/ samples/client/enc_echo/ samples/server/ samples/server/sec_echo/ src/omxmlsec/ src/omxmlsec/tokens/ src/util/ test/omxmlsec/
Date Wed, 13 Dec 2006 08:49:57 GMT
Author: kaushalye
Date: Wed Dec 13 00:49:56 2006
New Revision: 486550

URL: http://svn.apache.org/viewvc?view=rev&rev=486550
Log:
Adding sample service for rampart
Modified xml encryption

Added:
    webservices/axis2/trunk/c/rampart/samples/server/
    webservices/axis2/trunk/c/rampart/samples/server/Makefile.am
    webservices/axis2/trunk/c/rampart/samples/server/sec_echo/
    webservices/axis2/trunk/c/rampart/samples/server/sec_echo/Makefile.am
    webservices/axis2/trunk/c/rampart/samples/server/sec_echo/echo.c
    webservices/axis2/trunk/c/rampart/samples/server/sec_echo/echo.h
    webservices/axis2/trunk/c/rampart/samples/server/sec_echo/echo_skeleton.c
    webservices/axis2/trunk/c/rampart/samples/server/sec_echo/services.xml
Modified:
    webservices/axis2/trunk/c/rampart/include/oxs_axiom.h
    webservices/axis2/trunk/c/rampart/samples/Makefile.am
    webservices/axis2/trunk/c/rampart/samples/client/enc_echo/README.txt
    webservices/axis2/trunk/c/rampart/samples/client/enc_echo/deploy_client_repo.sh
    webservices/axis2/trunk/c/rampart/samples/client/enc_echo/update_n_run.sh
    webservices/axis2/trunk/c/rampart/samples/configure.ac
    webservices/axis2/trunk/c/rampart/src/omxmlsec/axiom.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/tokens/token_binary_security_token.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/tokens/token_reference_list.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/xml_encryption.c
    webservices/axis2/trunk/c/rampart/src/util/rampart_encryption.c
    webservices/axis2/trunk/c/rampart/src/util/rampart_sec_header_processor.c
    webservices/axis2/trunk/c/rampart/test/omxmlsec/test.c

Modified: webservices/axis2/trunk/c/rampart/include/oxs_axiom.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/oxs_axiom.h?view=diff&rev=486550&r1=486549&r2=486550
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/oxs_axiom.h (original)
+++ webservices/axis2/trunk/c/rampart/include/oxs_axiom.h Wed Dec 13 00:49:56 2006
@@ -45,6 +45,14 @@
                                          axis2_char_t* ns_uri,
                                          axis2_char_t* prefix);
 
+/**
+ * Traverse thru the node and its children. Check if the localname is equal to the given
name
+ * */
+AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+oxs_axiom_get_node_by_local_name(const axis2_env_t *env,
+    axiom_node_t *node,
+    axis2_char_t *local_name);
+
 AXIS2_EXTERN axiom_node_t* AXIS2_CALL
 oxs_axiom_get_node_by_id(const axis2_env_t *env,
     axiom_node_t *node,

Modified: webservices/axis2/trunk/c/rampart/samples/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/samples/Makefile.am?view=diff&rev=486550&r1=486549&r2=486550
==============================================================================
--- webservices/axis2/trunk/c/rampart/samples/Makefile.am (original)
+++ webservices/axis2/trunk/c/rampart/samples/Makefile.am Wed Dec 13 00:49:56 2006
@@ -1,3 +1,3 @@
 TESTS =
-SUBDIRS = callback client
+SUBDIRS = callback client server
 

Modified: webservices/axis2/trunk/c/rampart/samples/client/enc_echo/README.txt
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/samples/client/enc_echo/README.txt?view=diff&rev=486550&r1=486549&r2=486550
==============================================================================
--- webservices/axis2/trunk/c/rampart/samples/client/enc_echo/README.txt (original)
+++ webservices/axis2/trunk/c/rampart/samples/client/enc_echo/README.txt Wed Dec 13 00:49:56
2006
@@ -9,25 +9,25 @@
 
 2. Create client repository
     e.g. ~/client_home [CLIENT_HOME]
-    NOTE: You may use the AXIS2_HOME as the common repository for server and
+    NOTE: You may use the AXIS2C_HOME as the common repository for server and
     client. If so skip steps 3-5.
  
 3. Copy rampart/samples/client/enc_echo/data/axis2.xml to CLIENT_REPO
 
-4. Copy AXIS2_HOME/lib to CLIENT_HOME
+4. Copy AXIS2C_HOME/lib to CLIENT_HOME
 
-5. Copy AXIS2_HOME/modules to CLIENT_HOME
+5. Copy AXIS2C_HOME/modules to CLIENT_HOME
   
    
-6. Enable rampart in axis2.xml in the AXIS2_HOME and add In/Outflow parameters as
+6. Enable rampart in axis2.xml in the AXIS2C_HOME and add In/Outflow parameters as
     in rampart/samples/client/enc_eco/data/server.axis2.xml. (Or copy the
-    server.axis2.xml file to AXIS2_HOME/ directory and rename it as axis2.xml)
+    server.axis2.xml file to AXIS2C_HOME/ directory and rename it as axis2.xml)
 
 
     Before proceed check followings. 
     (*) The rampart module should be in the module directory of both
-        client(CLIENT_HOME/modules) and the server side(AXIS2_HOME/deploy/modules).
-    (*) AXIS2_HOME/axis2.xml and CLIENT_HOME/axis2.xml files should be configred to enable
rampart.
+        client(CLIENT_HOME/modules) and the server side(AXIS2C_HOME/deploy/modules).
+    (*) AXIS2C_HOME/axis2.xml and CLIENT_HOME/axis2.xml files should be configred to enable
rampart.
  
 8. To view the message flow use TCPMonitor
     Listen port: 9090 [specified as in the client argumanet]
@@ -38,7 +38,7 @@
 
 10. Run the echo sample 
      Syntax : ./echo [service_address] [client_home]
-     e.g.   : ./echo http://localhost:9090/axis2/services/echo /home/kau/client_home   
+     e.g.   : ./echo http://localhost:9090/axis2/services/echo ~/client_home   
 
 11. You should be able to see the security token is attached to the header of
     the SOAP message in the TCP Monitor.

Modified: webservices/axis2/trunk/c/rampart/samples/client/enc_echo/deploy_client_repo.sh
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/samples/client/enc_echo/deploy_client_repo.sh?view=diff&rev=486550&r1=486549&r2=486550
==============================================================================
--- webservices/axis2/trunk/c/rampart/samples/client/enc_echo/deploy_client_repo.sh (original)
+++ webservices/axis2/trunk/c/rampart/samples/client/enc_echo/deploy_client_repo.sh Wed Dec
13 00:49:56 2006
@@ -14,8 +14,9 @@
 
 
 #copy [client]axis2.xml to CLIENT_REPO
-echo "Copying axis2.xml to client_repo"
-cp data/client.enc.axis2.xml $CLIENT_REPO/axis2.xml
+#Removed: We are using our own service. So no need to replace the axis2.xml in the server

+#echo "Copying axis2.xml to client_repo"
+#cp data/client.enc.axis2.xml $CLIENT_REPO/axis2.xml
 
 #copy [server]axis2.xml to AXIS2C_HOME
 echo "Copying axis2.xml to AXIS2C_HOME"
@@ -29,4 +30,4 @@
 echo "Copying latest modules to client_repo"
 cp -r $AXIS2C_HOME/modules $CLIENT_REPO/
 
-echo "WARNING: Make sure that you have correct configurations in server/client axis2.xml
files"
+echo "WARNING: Make sure that you have correct configurations in sec_echo/services.xml file"

Modified: webservices/axis2/trunk/c/rampart/samples/client/enc_echo/update_n_run.sh
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/samples/client/enc_echo/update_n_run.sh?view=diff&rev=486550&r1=486549&r2=486550
==============================================================================
--- webservices/axis2/trunk/c/rampart/samples/client/enc_echo/update_n_run.sh (original)
+++ webservices/axis2/trunk/c/rampart/samples/client/enc_echo/update_n_run.sh Wed Dec 13 00:49:56
2006
@@ -7,4 +7,4 @@
 cp -r $AXIS2C_HOME/modules/rampart $CLIENT_REPO/modules
 
 #RUN
-./echo http://localhost:9090/axis2/services/echo $CLIENT_REPO
+./echo http://localhost:9090/axis2/services/sec_echo $CLIENT_REPO

Modified: webservices/axis2/trunk/c/rampart/samples/configure.ac
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/samples/configure.ac?view=diff&rev=486550&r1=486549&r2=486550
==============================================================================
--- webservices/axis2/trunk/c/rampart/samples/configure.ac (original)
+++ webservices/axis2/trunk/c/rampart/samples/configure.ac Wed Dec 13 00:49:56 2006
@@ -78,6 +78,8 @@
 AC_CONFIG_FILES([Makefile \
         callback/Makefile \
         callback/htpasswd_callback/Makefile \
+        server/Makefile \
+        server/sec_echo/Makefile \
         client/Makefile
         client/enc_echo/Makefile \
         client/enc_echo/data/Makefile \

Added: webservices/axis2/trunk/c/rampart/samples/server/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/samples/server/Makefile.am?view=auto&rev=486550
==============================================================================
--- webservices/axis2/trunk/c/rampart/samples/server/Makefile.am (added)
+++ webservices/axis2/trunk/c/rampart/samples/server/Makefile.am Wed Dec 13 00:49:56 2006
@@ -0,0 +1,4 @@
+samplesdir=$(prefix)/samples/server
+SUBDIRS = sec_echo 
+#EXTRA_DIST = axis2.xml axis2.log
+#samples_DATA=  Makefile.am Makefile.in

Added: webservices/axis2/trunk/c/rampart/samples/server/sec_echo/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/samples/server/sec_echo/Makefile.am?view=auto&rev=486550
==============================================================================
--- webservices/axis2/trunk/c/rampart/samples/server/sec_echo/Makefile.am (added)
+++ webservices/axis2/trunk/c/rampart/samples/server/sec_echo/Makefile.am Wed Dec 13 00:49:56
2006
@@ -0,0 +1,13 @@
+prglibdir=$(prefix)/services/sec_echo
+samplesdir=$(prefix)/samples/server/sec_echo
+prglib_LTLIBRARIES = libecho.la
+samples_DATA=echo.c echo_skeleton.c echo.h services.xml Makefile.am Makefile.in
+prglib_DATA= services.xml
+EXTRA_DIST = services.xml
+noinst_HEADERS = echo.h
+SUBDIRS =
+libecho_la_SOURCES = echo.c echo_skeleton.c
+libecho_la_LIBADD  =
+INCLUDES = -I$(AXIS2C_HOME)/include \
+			@UTILINC@ \
+			@AXIOMINC@

Added: webservices/axis2/trunk/c/rampart/samples/server/sec_echo/echo.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/samples/server/sec_echo/echo.c?view=auto&rev=486550
==============================================================================
--- webservices/axis2/trunk/c/rampart/samples/server/sec_echo/echo.c (added)
+++ webservices/axis2/trunk/c/rampart/samples/server/sec_echo/echo.c Wed Dec 13 00:49:56 2006
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+#include "echo.h"
+#include <axiom_xml_writer.h>
+#include <axiom_util.h>
+#include <stdio.h>
+
+axiom_node_t *
+build_om_programatically(const axis2_env_t *env, axis2_char_t *text);
+
+axiom_node_t *
+axis2_echo_echo(const axis2_env_t *env, axiom_node_t *node)
+{
+    axiom_node_t *ret_node = NULL;
+    axis2_char_t *name = NULL;
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    name = axiom_util_get_localname(node, env);
+     
+    ret_node = build_om_programatically(env, name);
+    return ret_node;
+}
+
+/* Builds the response content */
+axiom_node_t *
+build_om_programatically(const axis2_env_t *env, axis2_char_t *text)
+{
+    axiom_node_t *echo_om_node = NULL;
+    axiom_element_t* echo_om_ele = NULL;
+    axiom_node_t* text_om_node = NULL;
+    axiom_element_t * text_om_ele = NULL;
+    axiom_namespace_t *ns1 = NULL;
+
+    ns1 = axiom_namespace_create(env, "http://ws.apache.org/axis2/rampart/samples", "ns1");
+
+    echo_om_ele = axiom_element_create(env, NULL, "RecievedNode", ns1, &echo_om_node);
+
+    text_om_ele = axiom_element_create(env, echo_om_node, "LocalName", NULL, &text_om_node);
+
+    AXIOM_ELEMENT_SET_TEXT(text_om_ele, env, text, text_om_node);
+
+    return echo_om_node;
+}
+

Added: webservices/axis2/trunk/c/rampart/samples/server/sec_echo/echo.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/samples/server/sec_echo/echo.h?view=auto&rev=486550
==============================================================================
--- webservices/axis2/trunk/c/rampart/samples/server/sec_echo/echo.h (added)
+++ webservices/axis2/trunk/c/rampart/samples/server/sec_echo/echo.h Wed Dec 13 00:49:56 2006
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+#ifndef CALC_H
+#define CALC_H
+
+
+#include <axis2_svc_skeleton.h>
+#include <axis2_log_default.h>
+#include <axis2_error_default.h>
+#include <axiom_text.h>
+#include <axiom_node.h>
+#include <axiom_element.h>
+
+axiom_node_t *axis2_echo_echo(const axis2_env_t *env, axiom_node_t *node);
+
+#endif /* CALC_H*/

Added: webservices/axis2/trunk/c/rampart/samples/server/sec_echo/echo_skeleton.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/samples/server/sec_echo/echo_skeleton.c?view=auto&rev=486550
==============================================================================
--- webservices/axis2/trunk/c/rampart/samples/server/sec_echo/echo_skeleton.c (added)
+++ webservices/axis2/trunk/c/rampart/samples/server/sec_echo/echo_skeleton.c Wed Dec 13 00:49:56
2006
@@ -0,0 +1,174 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+#include <axis2_svc_skeleton.h>
+#include "echo.h"
+#include <axis2_array_list.h>
+#include <axis2_msg_ctx.h>
+#include <stdio.h>
+
+int AXIS2_CALL
+echo_free(axis2_svc_skeleton_t *svc_skeleton,
+        const axis2_env_t *env);
+
+/*
+ * This method invokes the right service method
+ */
+axiom_node_t* AXIS2_CALL
+echo_invoke(axis2_svc_skeleton_t *svc_skeleton,
+        const axis2_env_t *env,
+        axiom_node_t *node,
+        axis2_msg_ctx_t *msg_ctx);
+
+
+int AXIS2_CALL
+echo_init(axis2_svc_skeleton_t *svc_skeleton,
+        const axis2_env_t *env);
+
+axiom_node_t* AXIS2_CALL
+echo_on_fault(axis2_svc_skeleton_t *svc_skeli,
+        const axis2_env_t *env, axiom_node_t *node);
+
+/*Create function */
+axis2_svc_skeleton_t *
+axis2_echo_create(const axis2_env_t *env)
+{
+    axis2_svc_skeleton_t *svc_skeleton = NULL;
+    /* Allocate memory for the structs */
+    svc_skeleton = AXIS2_MALLOC(env->allocator,
+            sizeof(axis2_svc_skeleton_t));
+
+    svc_skeleton->ops = AXIS2_MALLOC(
+                env->allocator, sizeof(axis2_svc_skeleton_ops_t));
+
+    svc_skeleton->func_array = NULL;
+    /* Assign function pointers */
+    svc_skeleton->ops->free = echo_free;
+    svc_skeleton->ops->init = echo_init;
+    svc_skeleton->ops->invoke = echo_invoke;
+    svc_skeleton->ops->on_fault = echo_on_fault;
+
+    return svc_skeleton;
+}
+
+/* Initialize the service */
+int AXIS2_CALL
+echo_init(axis2_svc_skeleton_t *svc_skeleton,
+        const axis2_env_t *env)
+{
+    svc_skeleton->func_array = axis2_array_list_create(env, 0);
+    /* Add the implemented operation names of the service to
+     * the array list of functions 
+     */
+    AXIS2_ARRAY_LIST_ADD(svc_skeleton->func_array, env, "echoString");
+    /* Any initialization stuff of echo service should go here */
+    return AXIS2_SUCCESS;
+}
+
+/*
+ * This method invokes the right service method
+ */
+axiom_node_t* AXIS2_CALL
+echo_invoke(axis2_svc_skeleton_t *svc_skeleton,
+        const axis2_env_t *env,
+        axiom_node_t *node,
+        axis2_msg_ctx_t *msg_ctx)
+{
+    /* Invoke the business logic.
+     * Depending on the function name invoke the correct impl method.
+     * We have only echo in this sample, hence invoke echo method.
+     * To see how to deal with multiple impl methods, have a look at the
+     * math sample.
+     */
+
+    return axis2_echo_echo(env, node);
+}
+
+/* On fault, handle the fault */
+axiom_node_t* AXIS2_CALL
+echo_on_fault(axis2_svc_skeleton_t *svc_skeli,
+        const axis2_env_t *env, axiom_node_t *node)
+{
+    /* Here we are just setting a simple error message inside an element
+     * called 'EchoServiceError' 
+     */
+    axiom_node_t *error_node = NULL;
+    axiom_node_t *text_node = NULL;
+    axiom_element_t *error_ele = NULL;
+    
+	error_ele = axiom_element_create(env, NULL, "EchoServiceError", NULL,  &error_node);
+    AXIOM_ELEMENT_SET_TEXT(error_ele, env, "Echo service failed ", text_node);
+    return error_node;
+}
+
+/* Free the resources used */
+int AXIS2_CALL
+echo_free(axis2_svc_skeleton_t *svc_skeleton,
+        const axis2_env_t *env)
+{
+    /* Free the function array */
+    if (svc_skeleton->func_array)
+    {
+        AXIS2_ARRAY_LIST_FREE(svc_skeleton->func_array, env);
+        svc_skeleton->func_array = NULL;
+    }
+
+    /* Free the function array */
+    if (svc_skeleton->ops)
+    {
+        AXIS2_FREE(env->allocator, svc_skeleton->ops);
+        svc_skeleton->ops = NULL;
+    }
+
+    /* Free the service skeleton */
+    if (svc_skeleton)
+    {
+        AXIS2_FREE(env->allocator, svc_skeleton);
+        svc_skeleton = NULL;
+    }
+
+    return AXIS2_SUCCESS;
+}
+
+
+/**
+ * Following block distinguish the exposed part of the dll.
+ */
+AXIS2_EXPORT int
+axis2_get_instance(axis2_svc_skeleton_t **inst,
+        const axis2_env_t *env)
+{
+    *inst = axis2_echo_create(env);
+    if (!(*inst))
+    {
+        return AXIS2_FAILURE;
+    }
+
+    return AXIS2_SUCCESS;
+}
+
+AXIS2_EXPORT int
+axis2_remove_instance(axis2_svc_skeleton_t *inst,
+        const axis2_env_t *env)
+{
+    axis2_status_t status = AXIS2_FAILURE;
+    if (inst)
+    {
+        status = AXIS2_SVC_SKELETON_FREE(inst, env);
+    }
+    return status;
+}
+

Added: webservices/axis2/trunk/c/rampart/samples/server/sec_echo/services.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/samples/server/sec_echo/services.xml?view=auto&rev=486550
==============================================================================
--- webservices/axis2/trunk/c/rampart/samples/server/sec_echo/services.xml (added)
+++ webservices/axis2/trunk/c/rampart/samples/server/sec_echo/services.xml Wed Dec 13 00:49:56
2006
@@ -0,0 +1,43 @@
+<service name="echo">
+    <parameter name="ServiceClass" locked="xsd:false">echo</parameter>
+
+   <description>
+        This is a testing service , to test the system is working or not
+   </description>
+    <!--Rampart configurations START -->
+    <module ref="rampart"/>
+
+    <parameter name="OutflowSecurity">
+      <action>
+        <items>Timestamp</items>
+        <user>Gampola</user>
+        <passwordType>passwordDigest</passwordType>
+        <!--Following should be changed with your DLL or SO path-->
+        <passwordCallbackClass>/home/kau/axis2/c/deploy/bin/samples/rampart/callback/libpwcb.so</passwordCallbackClass>
+        <timeToLive>360</timeToLive>
+        <encryptionKeyTransportAlgorithm>http://www.w3.org/2001/04/xmlenc#rsa-1_5</encryptionKeyTransportAlgorithm>
+        <encryptionSymAlgorithm>http://www.w3.org/2001/04/xmlenc#aes256-cbc</encryptionSymAlgorithm>
+        <encryptionPropFile>/home/kau/axis2/c/rampart/samples/keys/bhome/a_cert.cert</encryptionPropFile>
+        <!--encryptionKeyIdentifier options : Embedded IssuerSerial DirectReference KeyIdentifier-->
+        <encryptionKeyIdentifier>IssuerSerial</encryptionKeyIdentifier>
+      </action>
+    </parameter>
+
+
+    <!--passwordCallbackClass should be changed with your DLL or SO path-->
+    <parameter name="InflowSecurity">
+      <action>
+        <items>Encrypt</items>
+        <passwordCallbackClass>/home/kau/axis2/c/deploy/bin/samples/rampart/callback/libpwcb.so</passwordCallbackClass>
+        <decryptionPropFile>/home/kau/axis2/c/rampart/samples/keys/bhome/b_store.pfx</decryptionPropFile>
+        <encryptionUser>b</encryptionUser>
+      </action>
+    </parameter>
+    <!--Rampart configurations END -->
+
+    <operation name="echoString">
+            <!--messageReceiver class="axis2_receivers" /-->
+        <parameter name="wsamapping" >http://ws.apache.org/axis2/c/samples/sec_echo</parameter>
+    </operation>
+
+</service>

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/axiom.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/axiom.c?view=diff&rev=486550&r1=486549&r2=486550
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/axiom.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/axiom.c Wed Dec 13 00:49:56 2006
@@ -62,6 +62,46 @@
 
     return counter;
 }
+
+/**
+ * Traverse thru the node and its children. Check if the localname is equal to the given
name
+ * */
+AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+oxs_axiom_get_node_by_local_name(const axis2_env_t *env,
+    axiom_node_t *node,
+    axis2_char_t *local_name)
+{
+    axis2_char_t *temp_name = NULL;
+    
+    if(!node){return NULL;}
+    
+    if(AXIOM_NODE_GET_NODE_TYPE(node, env) != AXIOM_ELEMENT){return NULL;}
+
+    temp_name = axiom_util_get_localname(node, env);
+    AXIS2_LOG_INFO(env->log, "[rampart][axiom] Checking node %s for %s", temp_name, local_name
);
+
+    if(0 == AXIS2_STRCMP(temp_name, local_name) ){
+        /*Gottcha.. return this node*/
+        return node;
+    }else{
+        /*Doesn't match? Get the first child*/    
+        axiom_node_t *temp_node = NULL;
+
+        temp_node = AXIOM_NODE_GET_FIRST_CHILD(node, env);
+        while (temp_node)
+        {
+            axiom_node_t *res_node = NULL;       
+            res_node = oxs_axiom_get_node_by_local_name(env, temp_node, local_name);
+            if(res_node){
+                return res_node;
+            }
+            temp_node = AXIOM_NODE_GET_NEXT_SIBLING(temp_node, env);
+        } 
+    
+    }
+    return NULL;
+}
+
 /**
  * Traverse thru the node and its children. Check if the id attribute is equal to the given
value
  * */
@@ -103,6 +143,8 @@
     }
     return NULL;
 }
+
+
 AXIS2_EXTERN axis2_char_t* AXIS2_CALL
 oxs_axiom_get_attribute_value_of_node_by_name(const axis2_env_t *env,
     axiom_node_t *node,

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/tokens/token_binary_security_token.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/tokens/token_binary_security_token.c?view=diff&rev=486550&r1=486549&r2=486550
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/tokens/token_binary_security_token.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/tokens/token_binary_security_token.c Wed
Dec 13 00:49:56 2006
@@ -32,6 +32,7 @@
         axis2_char_t* data)
 {
     axiom_node_t *binary_security_token_node = NULL;
+    axiom_node_t *first_child_of_parent = NULL;
     axiom_element_t *binary_security_token_ele = NULL;
     axiom_attribute_t *encoding_type_att = NULL;
     axiom_attribute_t *value_type_att = NULL;
@@ -50,6 +51,16 @@
         return NULL;
     }
 
+    /*Binary security token must be added as the first child of the paretn*/
+    binary_security_token_node = AXIOM_NODE_DETACH(binary_security_token_node, env);
+    first_child_of_parent = AXIOM_NODE_GET_FIRST_CHILD(parent, env);
+    if(first_child_of_parent){
+        /*If there is a child add bst before it*/
+        AXIOM_NODE_INSERT_SIBLING_BEFORE(first_child_of_parent, env, binary_security_token_node);
+    }else{
+        /*If there are no children just add the bst*/
+        AXIOM_NODE_ADD_CHILD(parent, env, binary_security_token_node);
+    }
     if (!id)
     {
         id = oxs_util_generate_id(env,(axis2_char_t*)OXS_CERT_ID);
@@ -67,6 +78,7 @@
     if(data){
          ret  = AXIOM_ELEMENT_SET_TEXT(binary_security_token_ele, env, data, binary_security_token_node);
     }
+
     return binary_security_token_node;
 
 }

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/tokens/token_reference_list.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/tokens/token_reference_list.c?view=diff&rev=486550&r1=486549&r2=486550
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/tokens/token_reference_list.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/tokens/token_reference_list.c Wed Dec 13
00:49:56 2006
@@ -94,6 +94,12 @@
     iter = AXIOM_ELEMENT_GET_CHILDREN_WITH_QNAME(ref_list_ele, env, qname, ref_list_node);
     AXIS2_QNAME_FREE(qname, env);
     qname = NULL;
+    
+    if(!iter){
+        oxs_error(ERROR_LOCATION, OXS_ERROR_INVALID_DATA,
+                        "There are no children for %s", OXS_NODE_DATA_REFERENCE);
+        return NULL;
+    }
 
     list = axis2_array_list_create(env, 0);
 

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/xml_encryption.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/xml_encryption.c?view=diff&rev=486550&r1=486549&r2=486550
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/xml_encryption.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/xml_encryption.c Wed Dec 13 00:49:56 2006
@@ -82,7 +82,7 @@
 
 /**
 *  
-*   <BinarySecurityToken ID="CertID">KJDSsdlDJjsd</BinarySecurityToken>
+*   <BinarySecurityToken ID="CertID">KJDSsdlDJjsd=</BinarySecurityToken>
 *   <KeyInfo>
 *       <SecurityTokenReference>
 *           <Reference URI="CertID"/>

Modified: webservices/axis2/trunk/c/rampart/src/util/rampart_encryption.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/util/rampart_encryption.c?view=diff&rev=486550&r1=486549&r2=486550
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/util/rampart_encryption.c (original)
+++ webservices/axis2/trunk/c/rampart/src/util/rampart_encryption.c Wed Dec 13 00:49:56 2006
@@ -53,15 +53,13 @@
     axiom_soap_envelope_t *soap_envelope,
     axis2_array_list_t *nodes_to_encrypt)
 {
-    axis2_array_list_t *str_list =  NULL;
     axis2_char_t *encryption_parts = NULL;
-    int size, i = 0;
 
     /*Get encryption parts*/
     encryption_parts =  AXIS2_STRDUP(RAMPART_ACTIONS_GET_ENCRYPTION_PARTS(actions, env),
env);
     /*If no encryption parts are specified use body as default... 
      * Well...hmmm.. the child of the body infact*/
-    if((!encryption_parts) || (0 == AXIS2_STRCMP(encryption_parts, " "))){
+    if((!encryption_parts) || (0 == AXIS2_STRCMP(encryption_parts, "") || (0 == AXIS2_STRCMP(encryption_parts,
"Body")))){
         axiom_soap_body_t *body = NULL;
         axiom_node_t *body_node = NULL;
         axiom_node_t *body_child_node = NULL;
@@ -72,15 +70,33 @@
         body_child_node = AXIOM_NODE_GET_FIRST_CHILD(body_node, env);
         AXIS2_ARRAY_LIST_ADD(nodes_to_encrypt, env, body_child_node);
         return AXIS2_SUCCESS;
+    }else if(0 == AXIS2_STRCMP(encryption_parts, "Header")){
+        AXIS2_LOG_INFO(env->log, "[rampart][rampart_encryption] We do not encrypt SOAP
headers");
+        return AXIS2_SUCCESS;
+    }else{
+        axis2_array_list_t *str_list =  NULL;
+        axiom_node_t *envelope_node = NULL;
+        axiom_node_t *node = NULL;
+        axis2_char_t *local_name = NULL;
+        int size, i = 0;
+
+        AXIS2_LOG_INFO(env->log, "[rampart][rampart_encryption] EncryptionParts specified
= %s", encryption_parts);
+        envelope_node = AXIOM_SOAP_ENVELOPE_GET_BASE_NODE(soap_envelope, env);
+        /*Tokenize*/
+        str_list = axis2_tokenize(env, encryption_parts, ' ');
+        size = AXIS2_ARRAY_LIST_SIZE(str_list, env);
+        for(i=0 ; i < size ; i++ ){
+            local_name = AXIS2_ARRAY_LIST_GET(str_list, env, i);
+            if(0 == AXIS2_STRCMP(local_name, "Security")){
+                AXIS2_LOG_INFO(env->log, "[rampart][rampart_encryption] We do not encrypt
%s", local_name);
+                continue;
+            }
+            node = oxs_axiom_get_node_by_local_name(env, envelope_node, local_name);
+            AXIS2_ARRAY_LIST_ADD(nodes_to_encrypt, env, node);
+        }
+        return AXIS2_SUCCESS;
     }
 
-    /*Tokenize*/
-    str_list = axis2_tokenize(env, encryption_parts, ' ');
-    size = AXIS2_ARRAY_LIST_SIZE(str_list, env);
-    /*Find the node and add to the list*/
-    for(i=0 ; i < size ; i++ ){
-        /*TODO*/
-    }
     return AXIS2_SUCCESS;
 }
 
@@ -170,11 +186,9 @@
     oxs_asym_ctx_set_password(asym_ctx, env, password);
     oxs_asym_ctx_set_operation(asym_ctx, env, OXS_ASYM_CTX_OPERATION_PUB_ENCRYPT);
     oxs_asym_ctx_set_st_ref_pattern(asym_ctx, env, eki);
-    /*TODO This should be taken from the configurations*/
-    /*oxs_asym_ctx_set_format(asym_ctx, env, OXS_ASYM_CTX_FORMAT_PEM);*/
     oxs_asym_ctx_set_format(asym_ctx, env, oxs_util_get_format_by_file_extension(env, certificate_file));
     /*Encrypt the session key*/
-    status = oxs_xml_enc_encrypt_key(env, asym_ctx, sec_node,session_key, id_list);    
+    status = oxs_xml_enc_encrypt_key(env, asym_ctx, sec_node, session_key, id_list);    
     if(AXIS2_FAILURE == status){
         return AXIS2_FAILURE;
     }

Modified: webservices/axis2/trunk/c/rampart/src/util/rampart_sec_header_processor.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/util/rampart_sec_header_processor.c?view=diff&rev=486550&r1=486549&r2=486550
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/util/rampart_sec_header_processor.c (original)
+++ webservices/axis2/trunk/c/rampart/src/util/rampart_sec_header_processor.c Wed Dec 13 00:49:56
2006
@@ -121,7 +121,7 @@
     ref_list_node = oxs_axiom_get_first_child_node_by_name(env, encrypted_key_node, OXS_NODE_REFERENCE_LIST,
NULL, NULL);
     reference_list = oxs_token_get_reference_list_data(env, ref_list_node);
     /*If there are no references. Nothing to do. Return success*/
-    if(0 == AXIS2_ARRAY_LIST_SIZE(reference_list, env)){
+    if((!reference_list) || (0 == AXIS2_ARRAY_LIST_SIZE(reference_list, env))){
         AXIS2_LOG_INFO(env->log, "[rampart][shp] Reference List is empty");
         return AXIS2_SUCCESS;
     }
@@ -177,7 +177,10 @@
         enc_data_node = oxs_axiom_get_node_by_id(env, envelope_node, OXS_ATTR_ID, id2);
         if(!enc_data_node){
             AXIS2_LOG_INFO(env->log, "[rampart][shp] Node with ID=%s cannot be found",
id);
-            continue;
+            /*continue;*/
+            rampart_create_fault_envelope(env, RAMPART_FAULT_FAILED_CHECK,
+                                "Cannot find EncryptedData element", RAMPART_FAULT_IN_ENCRYPTED_DATA,
msg_ctx);
+            return AXIS2_FAILURE;
         }
         /*Create an enc_ctx*/    
         ctx = oxs_ctx_create(env);

Modified: webservices/axis2/trunk/c/rampart/test/omxmlsec/test.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/test/omxmlsec/test.c?view=diff&rev=486550&r1=486549&r2=486550
==============================================================================
--- webservices/axis2/trunk/c/rampart/test/omxmlsec/test.c (original)
+++ webservices/axis2/trunk/c/rampart/test/omxmlsec/test.c Wed Dec 13 00:49:56 2006
@@ -69,7 +69,7 @@
 {
     oxs_key_t *key = NULL;
     key = oxs_key_create(env);
-    OXS_KEY_POPULATE(key, env, (unsigned char*)"12345678123456781234567812345678", "session_key",
 32, OXS_KEY_USAGE_DECRYPT);
+    OXS_KEY_POPULATE(key, env, (unsigned char*)"012345670123456701234567", "session_key",
 32, OXS_KEY_USAGE_DECRYPT);
     return key;
 }
 
@@ -146,7 +146,7 @@
     OXS_CTX_SET_KEY(ctx, env, key);
 
     /*Set algorithm*/
-    OXS_CTX_SET_ENC_MTD_ALGORITHM(ctx, env, OXS_HREF_AES_256_CBC);
+    OXS_CTX_SET_ENC_MTD_ALGORITHM(ctx, env, OXS_HREF_DES3_CBC);
 
     /*Get the node to be encrypted*/
     enc_node = AXIOM_NODE_GET_FIRST_CHILD(tmpl, env);



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message