Author: kaushalye
Date: Wed Mar 28 01:21:03 2007
New Revision: 523225
URL: http://svn.apache.org/viewvc?view=rev&rev=523225
Log:
Code improvement in Rampart/C
Modified:
webservices/rampart/trunk/c/include/rampart_handler_util.h
webservices/rampart/trunk/c/include/rampart_util.h
webservices/rampart/trunk/c/src/util/rampart_sec_header_builder.c
Modified: webservices/rampart/trunk/c/include/rampart_handler_util.h
URL:
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/rampart_handler_util.h?view=diff&rev=523225&r1=523224&r2=523225
==============================================================================
--- webservices/rampart/trunk/c/include/rampart_handler_util.h (original)
+++ webservices/rampart/trunk/c/include/rampart_handler_util.h Wed Mar 28
01:21:03 2007
@@ -14,8 +14,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-
+
+
#include <axis2_handler_desc.h>
#include <axis2_array_list.h>
#include <axiom_soap_const.h>
@@ -45,86 +45,97 @@
#endif
-/**
- * Get properties from the axis2 context
- * @param env pointer to environment struct
- * @param ctx axis2 context
- * @param key the property name
- * @return parameter
- */
-
-AXIS2_EXTERN axis2_char_t* AXIS2_CALL
-rampart_get_property_from_ctx( const axis2_env_t *env,
- axis2_ctx_t *ctx,
- const axis2_char_t *key);
-
- /**
- * Get parameter for the given parameter name
- * @param env pointer to environment struct
- * @param msg_ctx message context
- * @param parameter the parameter name
- * @return parameter
- */
-
-AXIS2_EXTERN axis2_param_t* AXIS2_CALL
-rampart_get_security_param( const axis2_env_t *env,
- axis2_msg_ctx_t *msg_ctx,
- axis2_char_t *parameter);
-
-
-
-
- /**
- * Get the security token from the header block
- * @param env pointer to environment struct
- * @param msg_ctx message context
- * @param soap heamsg_ctxder
- * @return soap_header security element node
- */
-AXIS2_EXTERN axiom_node_t *AXIS2_CALL
-rampart_get_security_token(const axis2_env_t *env,
- axis2_msg_ctx_t *msg_ctx,
- axiom_soap_header_t *soap_header);
-
- /**
- * Creates a SOAP envelope based on params described below
- * @param env pointer to environment struct
- * @param sub_code the text of the Subcode element of a SOAP fault message
- * @param reason_text the text in soapenv:Reason element
- * @param detail_node_text the text in the soapenv:Detail element
- * @param msg_ctx the msg_ctx
- * @return soap_header security element node
- */
-AXIS2_EXTERN void AXIS2_CALL
-rampart_create_fault_envelope(const axis2_env_t *env,
- const axis2_char_t *sub_code,
- const axis2_char_t *reason_text,
- const axis2_char_t *detail_node_text,
- axis2_msg_ctx_t *msg_ctx);
-
- /**
- *Validates a security header elements
- * @param env pointer to environment struct
- * @param msg_ctx the msg_ctx
- [EMAIL PROTECTED] sec_node the reference to the security node
- */
-AXIS2_EXTERN axis2_status_t AXIS2_CALL
-rampart_validate_security_token(const axis2_env_t *env,
+ /**
+ * Get properties from the axis2 context
+ * @param env pointer to environment struct
+ * @param ctx axis2 context
+ * @param key the property name
+ * @return parameter
+ */
+
+ AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+ rampart_get_property_from_ctx( const axis2_env_t *env,
+ axis2_ctx_t *ctx,
+ const axis2_char_t *key);
+
+ /**
+ * Get parameter for the given parameter name
+ * @param env pointer to environment struct
+ * @param msg_ctx message context
+ * @param parameter the parameter name
+ * @return parameter
+ */
+
+ AXIS2_EXTERN axis2_param_t* AXIS2_CALL
+ rampart_get_security_param( const axis2_env_t *env,
axis2_msg_ctx_t *msg_ctx,
- axiom_node_t *sec_node);
+ axis2_char_t *parameter);
+
+
-AXIS2_EXTERN void *AXIS2_CALL
-rampart_get_rampart_configuration(const axis2_env_t *env,
- 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);
+ /**
+ * Get the security token from the header block
+ * @param env pointer to environment struct
+ * @param msg_ctx message context
+ * @param soap heamsg_ctxder
+ * @return soap_header security element node
+ */
+ AXIS2_EXTERN axiom_node_t *AXIS2_CALL
+ rampart_get_security_token(const axis2_env_t *env,
+ axis2_msg_ctx_t *msg_ctx,
+ axiom_soap_header_t *soap_header);
+
+ /**
+ * Creates a SOAP envelope based on params described below
+ * @param env pointer to environment struct
+ * @param sub_code the text of the Subcode element of a SOAP fault message
+ * @param reason_text the text in soapenv:Reason element
+ * @param detail_node_text the text in the soapenv:Detail element
+ * @param msg_ctx the msg_ctx
+ * @return soap_header security element node
+ */
+ AXIS2_EXTERN void AXIS2_CALL
+ rampart_create_fault_envelope(const axis2_env_t *env,
+ const axis2_char_t *sub_code,
+ const axis2_char_t *reason_text,
+ const axis2_char_t *detail_node_text,
+ axis2_msg_ctx_t *msg_ctx);
+
+ /**
+ * Validates a security header elements
+ * @param env pointer to environment struct
+ * @param msg_ctx the msg_ctx
+ * @param sec_node the reference to the security node
+ */
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rampart_validate_security_token(const axis2_env_t *env,
+ axis2_msg_ctx_t *msg_ctx,
+ axiom_node_t *sec_node);
+ /**
+ * Get rampart configurations from the message context
+ * @param env pointer to environment struct
+ * @param msg_ctx message context
+ * @param param_name name of the parameter of the configuration
+ * @return the loaded configuration params
+ */
+ AXIS2_EXTERN void *AXIS2_CALL
+ rampart_get_rampart_configuration(const axis2_env_t *env,
+ axis2_msg_ctx_t *msg_ctx,
+ axis2_char_t *param_name);
+ /**
+ * Check wether rampart is engaged or not
+ * @param env pointer to environment struct
+ * @param msg_ctx message context
+ * @return if engaged returns AXIS2_TRUE, else returns AXIS2_FALSE
+ */
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rampart_is_rampart_engaged(const axis2_env_t *env,
+ axis2_msg_ctx_t *msg_ctx);
-/** @} */
+ /** @} */
#ifdef __cplusplus
}
#endif
Modified: webservices/rampart/trunk/c/include/rampart_util.h
URL:
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/rampart_util.h?view=diff&rev=523225&r1=523224&r2=523225
==============================================================================
--- webservices/rampart/trunk/c/include/rampart_util.h (original)
+++ webservices/rampart/trunk/c/include/rampart_util.h Wed Mar 28 01:21:03 2007
@@ -36,108 +36,139 @@
extern "C" {
#endif
-/**
- * @defgroup Rampart_Util
- * @ingroup Rampart_Util
- */
-
-
-/**
- * Load a DLL or .SO
- */
-AXIS2_EXTERN void* AXIS2_CALL
-rampart_load_module(const axis2_env_t *env,
- axis2_char_t *module_name);
-
-/**
- *Load the credentials module
- */
-AXIS2_EXTERN rampart_credentials_t* AXIS2_CALL
-rampart_load_credentials_module(const axis2_env_t *env,
- axis2_char_t *cred_module_name);
-
-/**
- *Call credentials module
- */
-AXIS2_EXTERN rampart_credentials_status_t AXIS2_CALL
-rampart_call_credentials(const axis2_env_t *env,
- rampart_credentials_t *cred_module,
- axis2_msg_ctx_t *ctx,
- axis2_char_t **username,
- axis2_char_t **password);
-
-/**
- * Load authentication module
- */
-AXIS2_EXTERN rampart_authn_provider_t* AXIS2_CALL
-rampart_load_auth_module(const axis2_env_t *env,
- axis2_char_t *auth_module_name);
-
-/**
- * Call auth module
- */
-AXIS2_EXTERN rampart_authn_provider_status_t AXIS2_CALL
-rampart_authenticate_un_pw(const axis2_env_t *env,
- rampart_authn_provider_t *authp,
- const axis2_char_t *username,
- const axis2_char_t *password,
- const axis2_char_t *nonce,/*Can be NULL if plain text*/
- const axis2_char_t *created,/*Can be NULL if plain text*/
- const axis2_char_t *password_type,
- axis2_msg_ctx_t *msg_ctx);
-
-/**
- * Load the password callback module
- *
- */
-AXIS2_EXTERN rampart_callback_t* AXIS2_CALL
-rampart_load_pwcb_module(const axis2_env_t *env,
- axis2_char_t *callback_module_name);
-
- /**
- [EMAIL PROTECTED] the environment
- [EMAIL PROTECTED] the file name of the callback module (.so or .DLL)
- [EMAIL PROTECTED] the name of the user to get the password
- [EMAIL PROTECTED] The axis2 context
- [EMAIL PROTECTED] the password for the user or NULL if failed
- */
-
-
-
-AXIS2_EXTERN axis2_char_t* AXIS2_CALL
-rampart_callback_password(const axis2_env_t *env,
- rampart_callback_t *callback_module,
- const axis2_char_t *username);
-
-/**
- * Generates the nonce. Nonce is a base64 encoded random string.
- * @env the environment
- * @return generated nonce
- */
-
-AXIS2_EXTERN axis2_char_t *AXIS2_CALL
- rampart_generate_nonce(const axis2_env_t *env);
-
- /**
- * Generates the nonce. Nonce is a base64 encoded random string.
- * @param ttl Time to live. The time difference between created and expired
in mili seconds.
- * @return generated nonce
- **/
-AXIS2_EXTERN axis2_char_t* AXIS2_CALL
-rampart_generate_time(const axis2_env_t *env, int ttl);
+ /**
+ * @defgroup Rampart_Util
+ * @ingroup Rampart_Util
+ */
+
+
+ /**
+ * Load a DLL or .SO module
+ * @param env pointer to environment struct
+ * @param module_name name of the module to be loaded
+ * @return the loaded module
+ */
+ AXIS2_EXTERN void* AXIS2_CALL
+ rampart_load_module(const axis2_env_t *env,
+ axis2_char_t *module_name);
+
+ /**
+ * Load the credentials module
+ * @param env pointer to environment struct
+ * @param cred_module_name name of the credentails module to be loaded
+ * @return the loaded credentails module
+ */
+ AXIS2_EXTERN rampart_credentials_t* AXIS2_CALL
+ rampart_load_credentials_module(const axis2_env_t *env,
+ axis2_char_t *cred_module_name);
+
+ /**
+ * Call credentials module
+ * @param env pointer to environment struct
+ * @param cred_module the credentails module
+ * @param ctx the message context
+ * @param username reference to the returned username
+ * @param password reference to the returned password
+ * @return the status of the operation
+ */
+ AXIS2_EXTERN rampart_credentials_status_t AXIS2_CALL
+ rampart_call_credentials(const axis2_env_t *env,
+ rampart_credentials_t *cred_module,
+ axis2_msg_ctx_t *ctx,
+ axis2_char_t **username,
+ axis2_char_t **password);
+
+ /**
+ * Load authentication module
+ * @param env pointer to environment struct
+ * @param auth_module_name name of the authentication module
+ * @return creatd athenticaiton module
+ */
+ AXIS2_EXTERN rampart_authn_provider_t* AXIS2_CALL
+ rampart_load_auth_module(const axis2_env_t *env,
+ axis2_char_t *auth_module_name);
+
+ /**
+ * Call auth module
+ * @param env pointer to environment struct
+ * @param authp the authentication module
+ * @param username the username in the UsernameToken
+ * @param password the password in the UsernameToken
+ * @param nonce the nonce in the UsernameToken
+ * @param created the created time in the UsernameToken
+ * @param password_type the type of the password. either plain text of
digest
+ * @param msg_ctx the message context
+ */
+ AXIS2_EXTERN rampart_authn_provider_status_t AXIS2_CALL
+ rampart_authenticate_un_pw(const axis2_env_t *env,
+ rampart_authn_provider_t *authp,
+ const axis2_char_t *username,
+ const axis2_char_t *password,
+ const axis2_char_t *nonce,/*Can be NULL if
plain text*/
+ const axis2_char_t *created,/*Can be NULL if
plain text*/
+ const axis2_char_t *password_type,
+ axis2_msg_ctx_t *msg_ctx);
+
+ /**
+ * Load the password callback module
+ * @param env pointer to environment struct
+ * @callback_module_name the name of the callback module
+ * @return the loaded callback module
+ */
+ AXIS2_EXTERN rampart_callback_t* AXIS2_CALL
+ rampart_load_pwcb_module(const axis2_env_t *env,
+ axis2_char_t *callback_module_name);
+
+ /**
+ [EMAIL PROTECTED] the environment
+ [EMAIL PROTECTED] the file name of the callback module (.so or .DLL)
+ [EMAIL PROTECTED] the name of the user to get the password
+ [EMAIL PROTECTED] The axis2 context
+ [EMAIL PROTECTED] the password for the user or NULL if failed
+ */
+ AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+ rampart_callback_password(const axis2_env_t *env,
+ rampart_callback_t *callback_module,
+ const axis2_char_t *username);
+
+ /**
+ * Generates the nonce. Nonce is a base64 encoded random string.
+ * @param env pointer to environment struct
+ * @return generated nonce
+ */
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rampart_generate_nonce(const axis2_env_t *env);
+
+ /**
+ * Generates the nonce. Nonce is a base64 encoded random string.
+ * @param ttl Time to live. The time difference between created and
expired in mili seconds.
+ * @return generated nonce
+ **/
+ AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+ rampart_generate_time(const axis2_env_t *env, int ttl);
+
+ /**
+ * Check if @dt1 < @dt2. if not returns a false
+ * @param env pointer to environment struct
+ * @param dt1 date time 1
+ * @param dt2 date time 2
+ */
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rampart_compare_date_time(const axis2_env_t *env, axis2_char_t *dt1,
axis2_char_t *dt2);
+
+ /**
+ * Print or log information (Only use for debugging)
+ * @param env pointer to environment struct
+ * @param info the information to be printed
+ */
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rampart_print_info(const axis2_env_t *env, axis2_char_t* info);
-
-AXIS2_EXTERN axis2_status_t AXIS2_CALL
-rampart_compare_date_time(const axis2_env_t *env, axis2_char_t *dt1,
axis2_char_t *dt2);
-
-AXIS2_EXTERN axis2_status_t AXIS2_CALL
-rampart_print_info(const axis2_env_t *env, axis2_char_t* info);
-
-/* @} */
+ /* @} */
#ifdef __cplusplus
}
#endif
#endif /* !RAMPART_UTIL_H */
-
+
Modified: webservices/rampart/trunk/c/src/util/rampart_sec_header_builder.c
URL:
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_sec_header_builder.c?view=diff&rev=523225&r1=523224&r2=523225
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_sec_header_builder.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_sec_header_builder.c Wed Mar
28 01:21:03 2007
@@ -24,7 +24,6 @@
#include <rampart_util.h>
#include <rampart_sec_processed_result.h>
#include <rampart_handler_util.h>
-#include <oxs_ctx.h>
#include <oxs_error.h>
#include <oxs_utility.h>
#include <oxs_key.h>