You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ka...@apache.org on 2007/02/27 13:34:49 UTC
svn commit: r512233 - in /webservices/axis2/trunk/c/rampart:
include/rampart_constants.h include/rampart_handler_util.h
src/handlers/rampart_in_handler.c src/handlers/rampart_out_handler.c
src/util/rampart_engine.c src/util/rampart_handler_util.c
Author: kaushalye
Date: Tue Feb 27 04:34:47 2007
New Revision: 512233
URL: http://svn.apache.org/viewvc?view=rev&rev=512233
Log:
Applying the patch in AXIS2C-535.
Modified:
webservices/axis2/trunk/c/rampart/include/rampart_constants.h
webservices/axis2/trunk/c/rampart/include/rampart_handler_util.h
webservices/axis2/trunk/c/rampart/src/handlers/rampart_in_handler.c
webservices/axis2/trunk/c/rampart/src/handlers/rampart_out_handler.c
webservices/axis2/trunk/c/rampart/src/util/rampart_engine.c
webservices/axis2/trunk/c/rampart/src/util/rampart_handler_util.c
Modified: webservices/axis2/trunk/c/rampart/include/rampart_constants.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/rampart_constants.h?view=diff&rev=512233&r1=512232&r2=512233
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/rampart_constants.h (original)
+++ webservices/axis2/trunk/c/rampart/include/rampart_constants.h Tue Feb 27 04:34:47 2007
@@ -46,7 +46,8 @@
#define RAMPART_SECURITY_TIMESTAMP "Timestamp"
#define RAMPART_SECURITY_TIMESTAMP_CREATED "Created"
#define RAMPART_SECURITY_TIMESTAMP_EXPIRES "Expires"
-
+#define RAMPART_RAMPART "rampart"
+
/*Rampart URIs*/
#define RAMPART_WSSE "wsse"
#define RAMPART_WSSE_XMLNS "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
Modified: webservices/axis2/trunk/c/rampart/include/rampart_handler_util.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/rampart_handler_util.h?view=diff&rev=512233&r1=512232&r2=512233
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/rampart_handler_util.h (original)
+++ webservices/axis2/trunk/c/rampart/include/rampart_handler_util.h Tue Feb 27 04:34:47 2007
@@ -158,6 +158,11 @@
axis2_msg_ctx_t *msg_ctx,
axis2_char_t *param_name);
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rampart_is_rampart_engaged(const axis2_env_t *env,
+ axis2_msg_ctx_t *msg_ctx);
+
+
/** @} */
#ifdef __cplusplus
Modified: webservices/axis2/trunk/c/rampart/src/handlers/rampart_in_handler.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/handlers/rampart_in_handler.c?view=diff&rev=512233&r1=512232&r2=512233
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/handlers/rampart_in_handler.c (original)
+++ webservices/axis2/trunk/c/rampart/src/handlers/rampart_in_handler.c Tue Feb 27 04:34:47 2007
@@ -108,6 +108,16 @@
}
AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "SOAP header found");
+ /*since rampart in handler is a global handler we should
+ first check whether the rampart module is engaged.If not engaged we
+ should not process the message but return success.*/
+
+ /*This method is implemented in rampart_handler utils.*/
+ if(!rampart_is_rampart_engaged(env,msg_ctx))
+ {
+ AXIS2_LOG_INFO(env->log, "[rampart][rampart_in_handler] Not intended for processing in Rampart");
+ return AXIS2_SUCCESS;
+ }
rampart_context = rampart_engine_init(env,msg_ctx,AXIS2_TRUE);
if(!rampart_context)
return AXIS2_FAILURE;
Modified: webservices/axis2/trunk/c/rampart/src/handlers/rampart_out_handler.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/handlers/rampart_out_handler.c?view=diff&rev=512233&r1=512232&r2=512233
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/handlers/rampart_out_handler.c (original)
+++ webservices/axis2/trunk/c/rampart/src/handlers/rampart_out_handler.c Tue Feb 27 04:34:47 2007
@@ -110,6 +110,17 @@
}
soap_header_ele = (axiom_element_t *)AXIOM_NODE_GET_DATA_ELEMENT(soap_header_node,env);
+ /*since rampart in handler is a global handler we should
+ first check whether the rampart module is engaged.If not engaged we
+ should not process the message but return success.*/
+
+ /*This method is implemented in rampart_handler utils.*/
+ if(!rampart_is_rampart_engaged(env,msg_ctx))
+ {
+ AXIS2_LOG_INFO(env->log, "[rampart][rampart_out_handler] Not intended for processing in Rampart");
+ return AXIS2_SUCCESS;
+ }
+
rampart_context = rampart_engine_init(env,msg_ctx,AXIS2_FALSE);
if(!rampart_context)
return AXIS2_FAILURE;
Modified: webservices/axis2/trunk/c/rampart/src/util/rampart_engine.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/util/rampart_engine.c?view=diff&rev=512233&r1=512232&r2=512233
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/util/rampart_engine.c (original)
+++ webservices/axis2/trunk/c/rampart/src/util/rampart_engine.c Tue Feb 27 04:34:47 2007
@@ -34,7 +34,6 @@
const axis2_env_t *env,
axis2_char_t *file_name);
-
AXIS2_EXTERN rampart_context_t* AXIS2_CALL
rampart_engine_init(const axis2_env_t *env,
axis2_msg_ctx_t *msg_ctx,
@@ -194,7 +193,6 @@
return rampart_context;
}
-
AXIS2_EXTERN axis2_status_t AXIS2_CALL
rampart_engine_shutdown(const axis2_env_t *env,
Modified: webservices/axis2/trunk/c/rampart/src/util/rampart_handler_util.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/util/rampart_handler_util.c?view=diff&rev=512233&r1=512232&r2=512233
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/util/rampart_handler_util.c (original)
+++ webservices/axis2/trunk/c/rampart/src/util/rampart_handler_util.c Tue Feb 27 04:34:47 2007
@@ -344,3 +344,88 @@
return value;
}
+/*This method will check whether rampart should process the message*/
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rampart_is_rampart_engaged(const axis2_env_t *env,
+ axis2_msg_ctx_t *msg_ctx)
+{
+ axis2_svc_t *svc = NULL;
+ axis2_array_list_t *engaged_modules = NULL;
+ int size = 0;
+ int i = 0;
+ const axis2_qname_t *qname = NULL;
+ axis2_char_t *local_name = NULL;
+ axis2_conf_t *conf = NULL;
+ struct axis2_conf_ctx *conf_ctx = NULL;
+
+ conf_ctx = AXIS2_MSG_CTX_GET_CONF_CTX(msg_ctx,env);
+ if(!conf_ctx)
+ {
+ AXIS2_LOG_INFO(env->log, "[rampart][rhu] Conf context is NULL ");
+ return AXIS2_FALSE;
+ }
+ conf = AXIS2_CONF_CTX_GET_CONF(conf_ctx, env);
+ if(!conf)
+ {
+ AXIS2_LOG_INFO(env->log, "[rampart][rhu] Cannot get the axis2 conf from conf context. ");
+ return AXIS2_FALSE;
+ }
+
+/*If it is server side first check ramaprt is engaged globally.*/
+
+ if(axis2_msg_ctx_get_server_side(msg_ctx,env))
+ {
+ engaged_modules = AXIS2_CONF_GET_ALL_ENGAGED_MODULES(conf, env);
+ if(engaged_modules)
+ {
+ size = AXIS2_ARRAY_LIST_SIZE(engaged_modules,env);
+ for(i=0; i<size; i++)
+ {
+ qname = (axis2_qname_t *) AXIS2_ARRAY_LIST_GET(engaged_modules,env,i);
+ local_name = AXIS2_QNAME_GET_LOCALPART(qname,env);
+ if(AXIS2_STRCMP(local_name,RAMPART_RAMPART)==0)
+ return AXIS2_TRUE;
+ }
+ }
+/*If not engaed gloabally check whether it is engaged at service level.*/
+ svc = AXIS2_MSG_CTX_GET_SVC(msg_ctx,env);
+ if(!svc)
+ {
+ AXIS2_LOG_INFO(env->log, "[rampart][rhu] Service is NULL.");
+ return AXIS2_FALSE;
+ }
+ engaged_modules = AXIS2_SVC_GET_ALL_MODULE_QNAMES(svc,env);
+ if(engaged_modules)
+ {
+ size = AXIS2_ARRAY_LIST_SIZE(engaged_modules,env);
+ for(i=0; i<size; i++)
+ {
+ qname = (axis2_qname_t *) AXIS2_ARRAY_LIST_GET(engaged_modules,env,i);
+ local_name = AXIS2_QNAME_GET_LOCALPART(qname,env);
+ if(AXIS2_STRCMP(local_name,RAMPART_RAMPART)==0)
+ return AXIS2_TRUE;
+ }
+ }
+ return AXIS2_FALSE;
+ }
+/*In client side no options we should check gloabally.*/
+
+ else
+ {
+ engaged_modules = AXIS2_CONF_GET_ALL_ENGAGED_MODULES(conf, env);
+ if(engaged_modules)
+ {
+ size = AXIS2_ARRAY_LIST_SIZE(engaged_modules,env);
+ for(i=0; i<size; i++)
+ {
+ qname = (axis2_qname_t *) AXIS2_ARRAY_LIST_GET(engaged_modules,env,i);
+ local_name = AXIS2_QNAME_GET_LOCALPART(qname,env);
+ if(AXIS2_STRCMP(local_name,RAMPART_RAMPART)==0)
+ return AXIS2_TRUE;
+ }
+ }
+ return AXIS2_FALSE;
+ }
+}
+
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org