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 ka...@apache.org on 2008/01/25 05:44:39 UTC

svn commit: r615107 - in /webservices/rampart/trunk/c/src/util: Makefile.am rampart_config.c rampart_context.c rampart_engine.c

Author: kaushalye
Date: Thu Jan 24 20:44:38 2008
New Revision: 615107

URL: http://svn.apache.org/viewvc?rev=615107&view=rev
Log:
adding rampart config structure for client side configurations

Added:
    webservices/rampart/trunk/c/src/util/rampart_config.c
Modified:
    webservices/rampart/trunk/c/src/util/Makefile.am
    webservices/rampart/trunk/c/src/util/rampart_context.c
    webservices/rampart/trunk/c/src/util/rampart_engine.c

Modified: webservices/rampart/trunk/c/src/util/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/Makefile.am?rev=615107&r1=615106&r2=615107&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/Makefile.am (original)
+++ webservices/rampart/trunk/c/src/util/Makefile.am Thu Jan 24 20:44:38 2008
@@ -7,7 +7,7 @@
 							rampart_encryption.c rampart_sec_header_processor.c rampart_sec_processed_result.c \
 							rampart_sec_header_builder.c rampart_context.c rampart_token_processor.c rampart_signature.c \
 							rampart_token_builder.c rampart_rd_record.c rampart_replay_detector.c rampart_engine.c \
-							rampart_policy_validator.c rampart_error.c
+							rampart_policy_validator.c rampart_error.c rampart_config.c
 
 
 librampart_util_la_LIBADD  = -lssl \

Added: webservices/rampart/trunk/c/src/util/rampart_config.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_config.c?rev=615107&view=auto
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_config.c (added)
+++ webservices/rampart/trunk/c/src/util/rampart_config.c Thu Jan 24 20:44:38 2008
@@ -0,0 +1,166 @@
+/*
+ * 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 <rampart_config.h>
+#include <rampart_constants.h>
+
+struct rampart_config_t
+{
+    /*****************************/
+    axis2_char_t *username;
+    axis2_char_t *password;
+    axis2_char_t *password_type;
+    int ttl;
+};
+
+
+
+AXIS2_EXTERN rampart_config_t *AXIS2_CALL
+rampart_config_create(const axutil_env_t *env)
+{
+    rampart_config_t *rampart_config = NULL;
+
+    AXIS2_ENV_CHECK(env, NULL);
+
+    rampart_config =  (rampart_config_t *) AXIS2_MALLOC (env->allocator,
+                       sizeof (rampart_config_t));
+
+    if(rampart_config == NULL)
+    {
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+    rampart_config->username = NULL;
+    rampart_config->password = NULL;
+    rampart_config->password_type = NULL;
+
+    return rampart_config;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rampart_config_free(rampart_config_t *rampart_config,
+                     const axutil_env_t *env)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+
+        /*TODO Free*/
+        AXIS2_FREE(env->allocator,rampart_config);
+        rampart_config = NULL;
+    return;
+}
+
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rampart_config_set_username(rampart_config_t *rampart_config,
+                         const axutil_env_t *env,
+                         axis2_char_t *username)
+{
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK(env->error, username, AXIS2_FAILURE);
+
+    rampart_config->username = username;
+    return AXIS2_SUCCESS;
+
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rampart_config_set_password(rampart_config_t *rampart_config,
+                             const axutil_env_t *env,
+                             axis2_char_t *password)
+{
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK(env->error,password,AXIS2_FAILURE);
+
+    rampart_config->password = password;
+    return AXIS2_SUCCESS;
+}
+
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rampart_config_set_password_type(rampart_config_t *rampart_config,
+                                  const axutil_env_t *env,
+                                  axis2_char_t *password_type)
+{
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK(env->error,password_type,AXIS2_FAILURE);
+
+    rampart_config->password_type = password_type;
+    return AXIS2_SUCCESS;
+
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rampart_config_set_ttl(rampart_config_t *rampart_config,
+                        const axutil_env_t *env,
+                        int ttl)
+{
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK(env->error,ttl,AXIS2_FAILURE);
+
+    rampart_config->ttl = ttl;
+    return AXIS2_SUCCESS;
+}
+
+
+
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rampart_config_get_username(
+    rampart_config_t *rampart_config,
+    const axutil_env_t *env)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    return rampart_config->username;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rampart_config_get_password(
+    rampart_config_t *rampart_config,
+    const axutil_env_t *env)
+{
+    AXIS2_ENV_CHECK(env, NULL);
+
+    return rampart_config->password;
+}
+
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rampart_config_get_password_type(
+    rampart_config_t *rampart_config,
+    const axutil_env_t *env)
+{
+    AXIS2_ENV_CHECK(env,NULL);
+
+    return rampart_config->password_type;
+}
+
+AXIS2_EXTERN int AXIS2_CALL
+rampart_config_get_ttl(
+    rampart_config_t *rampart_config,
+    const axutil_env_t *env)
+{
+    AXIS2_ENV_CHECK(env,NULL);
+
+    return rampart_config->ttl;
+}
+

Modified: webservices/rampart/trunk/c/src/util/rampart_context.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_context.c?rev=615107&r1=615106&r2=615107&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_context.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_context.c Thu Jan 24 20:44:38 2008
@@ -33,12 +33,12 @@
     axis2_key_type_t receiver_certificate_type;
     axis2_char_t *user;
     axis2_char_t *password;
+    axis2_char_t *password_type;
     axis2_char_t *prv_key_password;
     password_callback_fn pwcb_function;
     rampart_is_replayed_fn is_replayed_function;
     int ttl;
     axis2_char_t *rd_val;
-    axis2_char_t *password_type;
     axis2_char_t *private_key_file;
     axis2_char_t *certificate_file;
     axis2_char_t *reciever_certificate_file;

Modified: webservices/rampart/trunk/c/src/util/rampart_engine.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_engine.c?rev=615107&r1=615106&r2=615107&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_engine.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_engine.c Thu Jan 24 20:44:38 2008
@@ -71,6 +71,7 @@
 
     is_server_side = axis2_msg_ctx_get_server_side(msg_ctx, env);
 
+    /*Server, Outflow*/
     if(is_server_side || !is_inflow)
     {
         policy = build_policy(env, msg_ctx, is_inflow);
@@ -90,24 +91,16 @@
         {
             return (rampart_context_t *)axutil_property_get_value(property, env);
         }
-
         else
         {
             rampart_create_fault_envelope(env, RAMPART_FAULT_FAILED_CHECK,
-                                          "Error in the Internal configuration.", RAMPART_FAULT_IN_POLICY, msg_ctx);
+                                          "Error in the Internal security policy configuration.", RAMPART_FAULT_IN_POLICY, msg_ctx);
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                             "[rampart][rampart_engine] Cannot get saved rampart_context");
             return NULL;
         }
     }
 
-    /*secpolicy = rp_secpolicy_builder_build(env, policy);
-    if(!secpolicy)
-    {
-        AXIS2_LOG_INFO(env->log, "[rampart][rampart_engine] Cannot create security policy from policy.");
-        return NULL;
-    }
-    */
     value = rampart_get_rampart_configuration(env, msg_ctx, RAMPART_CONFIGURATION);
     if(value)
     {
@@ -119,7 +112,7 @@
             if(!secpolicy)
             {
                 rampart_create_fault_envelope(env, RAMPART_FAULT_FAILED_CHECK,
-                                              "Error in the Internal configuration.", RAMPART_FAULT_IN_POLICY, msg_ctx);
+                                              "Error in the Internal security policy configuration.", RAMPART_FAULT_IN_POLICY, msg_ctx);
                 AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                                 "[rampart][rampart_engine] Cannot create security policy from policy.");
 
@@ -128,7 +121,6 @@
             rampart_context_set_secpolicy(rampart_context, env, secpolicy);
         }
     }
-
     else
     {
         rampart_context = rampart_context_create(env);
@@ -146,9 +138,7 @@
         }
 
         rampart_context_set_secpolicy(rampart_context, env, secpolicy);
-
         status = set_rampart_user_properties(env, rampart_context);
-
         if(status != AXIS2_SUCCESS)
         {
             rampart_create_fault_envelope(env, RAMPART_FAULT_FAILED_CHECK,
@@ -162,6 +152,7 @@
         }
     }
 
+    /*For the client side*/
     if(!is_server_side)
     {
         conf_ctx =  axis2_msg_ctx_get_conf_ctx(msg_ctx,env);