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 sh...@apache.org on 2008/03/25 04:10:08 UTC
svn commit: r640680 - in /webservices/rampart/trunk/c: include/
samples/sct_provider/ samples/server/secconv_echo/ src/secconv/ src/util/
Author: shankar
Date: Mon Mar 24 20:10:06 2008
New Revision: 640680
URL: http://svn.apache.org/viewvc?rev=640680&view=rev
Log:
(1) creating rampart_context in msg_ctx (earlier, it was on msg_ctx->conf_ctx->ctx) due to mod_axis2 crash. Rampart_context is Request scope, so has to be created in request scope container
(2) one method name change
Modified:
webservices/rampart/trunk/c/include/rampart_sct_provider.h
webservices/rampart/trunk/c/samples/sct_provider/sct_provider_hash_map.c
webservices/rampart/trunk/c/samples/sct_provider/sct_provider_stored_key.c
webservices/rampart/trunk/c/samples/server/secconv_echo/echo.c
webservices/rampart/trunk/c/src/secconv/sct_provider.c
webservices/rampart/trunk/c/src/util/rampart_engine.c
Modified: webservices/rampart/trunk/c/include/rampart_sct_provider.h
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/rampart_sct_provider.h?rev=640680&r1=640679&r2=640680&view=diff
==============================================================================
--- webservices/rampart/trunk/c/include/rampart_sct_provider.h (original)
+++ webservices/rampart/trunk/c/include/rampart_sct_provider.h Mon Mar 24 20:10:06 2008
@@ -125,7 +125,7 @@
axis2_msg_ctx_t* msg_ctx);
AXIS2_EXTERN axutil_hash_t* AXIS2_CALL
- sct_provider_get_sct_db(
+ sct_provider_get_sct_hash(
const axutil_env_t *env,
axis2_msg_ctx_t* msg_ctx);
Modified: webservices/rampart/trunk/c/samples/sct_provider/sct_provider_hash_map.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/samples/sct_provider/sct_provider_hash_map.c?rev=640680&r1=640679&r2=640680&view=diff
==============================================================================
--- webservices/rampart/trunk/c/samples/sct_provider/sct_provider_hash_map.c (original)
+++ webservices/rampart/trunk/c/samples/sct_provider/sct_provider_hash_map.c Mon Mar 24 20:10:06 2008
@@ -80,7 +80,8 @@
}
/*get the sct_db*/
- sct_db = sct_provider_get_sct_db(env, msg_ctx);
+ axutil_allocator_switch_to_global_pool(env->allocator);
+ sct_db = sct_provider_get_sct_hash(env, msg_ctx);
if(!sct_db)
{
AXIS2_LOG_INFO(env->log, "[rampart][sct_provider_sample] Cannot find sct datastore");
@@ -89,6 +90,7 @@
/*get the sct*/
sct = (security_context_token_t *)axutil_hash_get(sct_db, sct_db_lable, AXIS2_HASH_KEY_STRING);
+ axutil_allocator_switch_to_local_pool(env->allocator);
if(sct)
return sct;
Modified: webservices/rampart/trunk/c/samples/sct_provider/sct_provider_stored_key.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/samples/sct_provider/sct_provider_stored_key.c?rev=640680&r1=640679&r2=640680&view=diff
==============================================================================
--- webservices/rampart/trunk/c/samples/sct_provider/sct_provider_stored_key.c (original)
+++ webservices/rampart/trunk/c/samples/sct_provider/sct_provider_stored_key.c Mon Mar 24 20:10:06 2008
@@ -78,7 +78,7 @@
}
/*get the sct_db*/
- sct_db = sct_provider_get_sct_db(env, msg_ctx);
+ sct_db = sct_provider_get_sct_hash(env, msg_ctx);
if(!sct_db)
{
AXIS2_LOG_INFO(env->log, "[rampart][sct_provider_sample] Cannot find sct datastore");
Modified: webservices/rampart/trunk/c/samples/server/secconv_echo/echo.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/samples/server/secconv_echo/echo.c?rev=640680&r1=640679&r2=640680&view=diff
==============================================================================
--- webservices/rampart/trunk/c/samples/server/secconv_echo/echo.c (original)
+++ webservices/rampart/trunk/c/samples/server/secconv_echo/echo.c Mon Mar 24 20:10:06 2008
@@ -37,9 +37,6 @@
axiom_node_t *
build_om_payload_for_echo_svc_interop(const axutil_env_t *env, axis2_char_t *text);
-static axutil_hash_t *
-secconv_echo_get_sct_db(const axutil_env_t *env, axis2_msg_ctx_t* msg_ctx);
-
axiom_node_t *
axis2_echo_echo(const axutil_env_t *env, axiom_node_t *node, axis2_msg_ctx_t *msg_ctx)
{
@@ -128,6 +125,8 @@
requester_entropy = trust_rst_get_entropy(rst, env);;
+ axutil_allocator_switch_to_global_pool(env->allocator);
+
/*create global id, local id, and shared secret*/
global_id = oxs_util_generate_id(env,"urn:uuid:");
local_id = axutil_stracat(env, "#", oxs_util_generate_id(env, "sctId"));
@@ -142,7 +141,7 @@
sct = security_context_token_create(env);
security_context_token_set_global_identifier(sct, env, global_id);
security_context_token_set_local_identifier(sct, env, local_id);
-
+
if(requester_entropy)
{
oxs_buffer_t *buffer = NULL;
@@ -178,7 +177,7 @@
}
/*store SCT so that when server needs it, can be extracted*/
- db = sct_provider_get_sct_db(env, msg_ctx);
+ db = sct_provider_get_sct_hash(env, msg_ctx);
if(!db)
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart][secconv_service] Cannot get sct datastore");
@@ -186,7 +185,9 @@
return NULL;
}
+ axutil_hash_set_env(db, env);
axutil_hash_set(db, global_id, AXIS2_HASH_KEY_STRING, sct);
+ axutil_allocator_switch_to_local_pool(env->allocator);
/*create rstr and populate*/
rstr = trust_rstr_create(env);
@@ -242,49 +243,6 @@
/*return the node*/
return rstr_node;
-}
-
-static axutil_hash_t *
-secconv_echo_get_sct_db(const axutil_env_t *env,
- axis2_msg_ctx_t* msg_ctx)
-{
- axis2_conf_ctx_t *conf_ctx = NULL;
- axis2_ctx_t *ctx = NULL;
- axutil_property_t *property = NULL;
- axutil_hash_t *db = NULL;
-
- /*Get the conf ctx*/
- conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
- if(!conf_ctx)
- {
- AXIS2_LOG_ERROR(env->log,AXIS2_LOG_SI, "[rampart][secconv_service] Conf context is NULL ");
- return NULL;
- }
- ctx = axis2_conf_ctx_get_base(conf_ctx,env);
- if(!ctx)
- {
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,"[rampart][secconv_service] axis2 context is NULL ");
- return NULL;
- }
-
- /*Get the DB property*/
- property = axis2_ctx_get_property(ctx, env, RAMPART_SCT_PROVIDER_DB_PROB);
- if(property)
- {
- /*Get the DB*/
- db = (axutil_hash_t*)axutil_property_get_value(property, env);
- }
- else
- {
- axutil_property_t *db_prop = NULL;
-
- db = axutil_hash_make(env);
- db_prop = axutil_property_create(env);
- axutil_property_set_value(db_prop, env, db);
- axis2_ctx_set_property(ctx, env, RAMPART_SCT_PROVIDER_DB_PROB, db_prop);
- }
-
- return db;
}
axiom_node_t *
Modified: webservices/rampart/trunk/c/src/secconv/sct_provider.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/secconv/sct_provider.c?rev=640680&r1=640679&r2=640680&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/secconv/sct_provider.c (original)
+++ webservices/rampart/trunk/c/src/secconv/sct_provider.c Mon Mar 24 20:10:06 2008
@@ -155,7 +155,7 @@
}
AXIS2_EXTERN axutil_hash_t * AXIS2_CALL
-sct_provider_get_sct_db(const axutil_env_t *env, axis2_msg_ctx_t* msg_ctx)
+sct_provider_get_sct_hash(const axutil_env_t *env, axis2_msg_ctx_t* msg_ctx)
{
axis2_conf_ctx_t *conf_ctx = NULL;
axis2_ctx_t *ctx = NULL;
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=640680&r1=640679&r2=640680&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_engine.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_engine.c Mon Mar 24 20:10:06 2008
@@ -64,8 +64,8 @@
rp_secpolicy_t *secpolicy = NULL;
rampart_context_t *rampart_context = NULL;
axis2_status_t status = AXIS2_SUCCESS;
- axis2_conf_ctx_t *conf_ctx = NULL;
- axis2_ctx_t *ctx = NULL;
+ /*axis2_conf_ctx_t *conf_ctx = NULL;
+ axis2_ctx_t *ctx = NULL;*/
axis2_bool_t is_server_side = AXIS2_TRUE;
neethi_policy_t *policy = NULL;
axutil_property_t *property = NULL;
@@ -154,7 +154,7 @@
}
}
- conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx,env);
+ /*conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx,env);
if(!conf_ctx)
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
@@ -173,9 +173,14 @@
rampart_context = NULL;
return NULL;
}
+
+ property = axutil_property_create_with_args(env, AXIS2_SCOPE_REQUEST ,
+ AXIS2_TRUE, (void *)rampart_context_free, rampart_context);
+ axis2_ctx_set_property(ctx, env, RAMPART_CONTEXT, property);*/
+
property = axutil_property_create_with_args(env, AXIS2_SCOPE_REQUEST ,
AXIS2_TRUE, (void *)rampart_context_free, rampart_context);
- axis2_ctx_set_property(ctx, env, RAMPART_CONTEXT, property);
+ axis2_msg_ctx_set_property(msg_ctx, env, RAMPART_CONTEXT, property);
/*For the client side*/
if(!is_server_side)