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/01/29 12:43:05 UTC
svn commit: r501015 - in
/webservices/axis2/scratch/c/security-policy/c/rampart: include/ src/core/
src/handlers/ src/secpolicy/builder/ src/secpolicy/model/
src/secpolicy/test-resources/ src/util/
Author: kaushalye
Date: Mon Jan 29 03:42:58 2007
New Revision: 501015
URL: http://svn.apache.org/viewvc?view=rev&rev=501015
Log:
Adding rampart context and applying the integration patch [JIRA AXIS2C-488]
Added:
webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_context.h (with props)
webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_context.c
Modified:
webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_sec_header_builder.h
webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_timestamp_token.h
webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_username_token.h
webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_util.h
webservices/axis2/scratch/c/security-policy/c/rampart/include/rp_defines.h
webservices/axis2/scratch/c/security-policy/c/rampart/include/rp_includes.h
webservices/axis2/scratch/c/security-policy/c/rampart/include/rp_rampart_config.h
webservices/axis2/scratch/c/security-policy/c/rampart/include/rp_secpolicy.h
webservices/axis2/scratch/c/security-policy/c/rampart/src/core/Makefile.am
webservices/axis2/scratch/c/security-policy/c/rampart/src/handlers/rampart_out_handler.c
webservices/axis2/scratch/c/security-policy/c/rampart/src/secpolicy/builder/rampart_config_builder.c
webservices/axis2/scratch/c/security-policy/c/rampart/src/secpolicy/model/rampart_config.c
webservices/axis2/scratch/c/security-policy/c/rampart/src/secpolicy/model/ut.c
webservices/axis2/scratch/c/security-policy/c/rampart/src/secpolicy/test-resources/2.xml
webservices/axis2/scratch/c/security-policy/c/rampart/src/util/Makefile.am
webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_handler_util.c
webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_sec_header_builder.c
webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_sec_header_processor.c
webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_util.c
webservices/axis2/scratch/c/security-policy/c/rampart/src/util/timestamp_token.c
webservices/axis2/scratch/c/security-policy/c/rampart/src/util/username_token.c
Added: webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_context.h
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_context.h?view=auto&rev=501015
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_context.h (added)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_context.h Mon Jan 29 03:42:58 2007
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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 RAMPART_CONTEXT_H
+#define RAMPART_CONTEXT_H
+
+/** @defgroup rampart_context
+ * @ingroup rampart_context
+ * @{
+ */
+
+#include <rp_includes.h>
+#include <rp_secpolicy.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ typedef struct rampart_context_t rampart_context_t;
+
+ AXIS2_EXTERN rampart_context_t *AXIS2_CALL
+ rampart_context_create(const axis2_env_t *env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rampart_context_free(rampart_context_t *rampart_context,
+ const axis2_env_t *env);
+
+ AXIS2_EXTERN rp_secpolicy_t *AXIS2_CALL
+ rampart_context_get_secpolicy(
+ rampart_context_t *rampart_context,
+ const axis2_env_t *env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rampart_context_set_secpolicy(rampart_context_t *rampart_context,
+ const axis2_env_t *env,
+ rp_secpolicy_t *secpolicy);
+
+ AXIS2_EXTERN int AXIS2_CALL
+ rampart_context_get_binding_type(
+ rampart_context_t *rampart_context,
+ const axis2_env_t *env);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rampart_context_is_include_timestamp(
+ rampart_context_t *rampart_context,
+ const axis2_env_t *env);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rampart_context_is_include_username_token(
+ rampart_context_t *rampart_context,
+ const axis2_env_t *env);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rampart_context_get_user(
+ rampart_context_t *rampart_context,
+ const axis2_env_t *env);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rampart_context_get_password_callback_class(
+ rampart_context_t *rampart_context,
+ const axis2_env_t *env);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rampart_context_get_authn_module_name(
+ rampart_context_t *rampart_context,
+ const axis2_env_t *env);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rampart_context_get_password_type(
+ rampart_context_t *rampart_context,
+ const axis2_env_t *env);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
Propchange: webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_context.h
------------------------------------------------------------------------------
svn:executable = *
Modified: webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_sec_header_builder.h
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_sec_header_builder.h?view=diff&rev=501015&r1=501014&r2=501015
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_sec_header_builder.h (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_sec_header_builder.h Mon Jan 29 03:42:58 2007
@@ -19,7 +19,7 @@
#include <axis2_env.h>
#include <axiom_soap.h>
#include <axis2_msg_ctx.h>
-#include <rampart_action.h>
+#include <rampart_context.h>
#include <oxs_asym_ctx.h>
#include <oxs_xml_encryption.h>
/**
@@ -44,7 +44,7 @@
AXIS2_EXTERN axis2_status_t AXIS2_CALL
rampart_shb_build_message(const axis2_env_t *env,
axis2_msg_ctx_t *msg_ctx,
- rampart_actions_t *actions,
+ rampart_context_t *context,
axiom_soap_envelope_t *soap_envelope);
Modified: webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_timestamp_token.h
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_timestamp_token.h?view=diff&rev=501015&r1=501014&r2=501015
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_timestamp_token.h (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_timestamp_token.h Mon Jan 29 03:42:58 2007
@@ -58,7 +58,6 @@
axis2_status_t (AXIS2_CALL *
build)(rampart_timestamp_token_t *timestamp_token,
const axis2_env_t *env,
- const axis2_ctx_t *ctx,
axiom_node_t *sec_node,
const axiom_namespace_t *sec_ns_obj,
int ttl
@@ -99,8 +98,8 @@
#define RAMPART_TIMESTAMP_TOKEN_FREE(timestamp_token, env) \
((timestamp_token)->ops->free(timestamp_token, env))
-#define RAMPART_TIMESTAMP_TOKEN_BUILD(timestamp_token, env, ctx, sec_node, sec_ns_obj, ttl) \
- ((timestamp_token)->ops->build(timestamp_token, env, ctx, sec_node, sec_ns_obj, ttl))
+#define RAMPART_TIMESTAMP_TOKEN_BUILD(timestamp_token, env, sec_node, sec_ns_obj, ttl) \
+ ((timestamp_token)->ops->build(timestamp_token, env, sec_node, sec_ns_obj, ttl))
#define RAMPART_TIMESTAMP_TOKEN_VALIDATE(timestamp_token, env, msg_ctx, ts_node) \
((timestamp_token)->ops->validate(timestamp_token, env, msg_ctx, ts_node))
Modified: webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_username_token.h
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_username_token.h?view=diff&rev=501015&r1=501014&r2=501015
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_username_token.h (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_username_token.h Mon Jan 29 03:42:58 2007
@@ -57,7 +57,7 @@
* @param sec_ns_obj security namespace object
* @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
*/
- axis2_status_t (AXIS2_CALL *
+/* axis2_status_t (AXIS2_CALL *
build)(rampart_username_token_t *username_token,
const axis2_env_t *env,
axis2_ctx_t *ctx,
@@ -65,7 +65,19 @@
axiom_node_t *sec_node,
axiom_namespace_t *sec_ns_obj
);
- /**
+*/
+
+ axis2_status_t (AXIS2_CALL *
+ build)(rampart_username_token_t *username_token,
+ const axis2_env_t *env,
+ axis2_char_t *username,
+ axis2_char_t *password_callback_class,
+ axis2_char_t *authn_module_name,
+ axis2_bool_t isdigest,
+ axiom_node_t *sec_node,
+ axiom_namespace_t *sec_ns_obj
+ );
+ /*
* Validates the given username token
* @param env pointer to environment struct
* @param msg_ctx axis2 message context
@@ -103,9 +115,14 @@
/*************************** Function macros **********************************/
#define RAMPART_USERNAME_TOKEN_FREE(username_token, env) \
((username_token)->ops->free(username_token, env))
-
+/*
#define RAMPART_USERNAME_TOKEN_BUILD(username_token, env, ctx, actions, sec_node, sec_ns_obj) \
((username_token)->ops->build(username_token, env, ctx, actions, sec_node, sec_ns_obj))
+*/
+
+#define RAMPART_USERNAME_TOKEN_BUILD(username_token, env,username,password_callback_class,authn_module_name,isdigest,sec_node, sec_ns_obj) \
+ ((username_token)->ops->build(username_token, env,username,password_callback_class,authn_module_name,isdigest,sec_node, sec_ns_obj))
+
#define RAMPART_USERNAME_TOKEN_VALIDATE(username_token, env, msg_ctx, soap_header, actions) \
((username_token)->ops->validate(username_token, env, msg_ctx, soap_header, actions))
Modified: webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_util.h
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_util.h?view=diff&rev=501015&r1=501014&r2=501015
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_util.h (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_util.h Mon Jan 29 03:42:58 2007
@@ -60,8 +60,7 @@
AXIS2_EXTERN axis2_char_t* AXIS2_CALL
rampart_callback_password(const axis2_env_t *env,
axis2_char_t *callback_module_name,
- const axis2_char_t *username,
- axis2_ctx_t *ctx);
+ const axis2_char_t *username);
/**
* Generates the nonce. Nonce is a base64 encoded random string.
Modified: webservices/axis2/scratch/c/security-policy/c/rampart/include/rp_defines.h
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/include/rp_defines.h?view=diff&rev=501015&r1=501014&r2=501015
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/include/rp_defines.h (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/include/rp_defines.h Mon Jan 29 03:42:58 2007
@@ -185,6 +185,9 @@
#define RP_ENCRYPTION_USER "encryptionUser"
#define RP_PASSWORD_CALLBACK_CLASS "passwordCallbackClass"
#define RP_AUTHN_MODULE_NAME "authnModuleName"
+ #define RP_PASSWORD_TYPE "passwordType"
+ #define RP_PLAINTEXT "plainText"
+ #define RP_DIGEST "Digest"
#define RP_SIGNATURE_CRYPTO "signatureCrypto"
#define RP_SIGNATURE_PROP_FILE "signaturePropFile"
#define RP_ENCRYPTION_CRYPTO "encryptionCypto"
Modified: webservices/axis2/scratch/c/security-policy/c/rampart/include/rp_includes.h
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/include/rp_includes.h?view=diff&rev=501015&r1=501014&r2=501015
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/include/rp_includes.h (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/include/rp_includes.h Mon Jan 29 03:42:58 2007
@@ -33,6 +33,7 @@
#include <axis2_qname.h>
#include <rp_defines.h>
+
/**
* @file rp_includes.h
* @brief includes most useful headers for RP
Modified: webservices/axis2/scratch/c/security-policy/c/rampart/include/rp_rampart_config.h
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/include/rp_rampart_config.h?view=diff&rev=501015&r1=501014&r2=501015
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/include/rp_rampart_config.h (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/include/rp_rampart_config.h Mon Jan 29 03:42:58 2007
@@ -80,6 +80,17 @@
const axis2_env_t *env,
axis2_char_t *authenticate_module);
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_rampart_config_get_password_type(
+ rp_rampart_config_t *rampart_config,
+ const axis2_env_t *env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_rampart_config_set_password_type(rp_rampart_config_t *rampart_config,
+ const axis2_env_t *env,
+ axis2_char_t *password_type);
+
+
AXIS2_EXTERN rp_signature_crypto_t *AXIS2_CALL
rp_rampart_config_get_signature_crypto(
rp_rampart_config_t *rampart_config,
Modified: webservices/axis2/scratch/c/security-policy/c/rampart/include/rp_secpolicy.h
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/include/rp_secpolicy.h?view=diff&rev=501015&r1=501014&r2=501015
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/include/rp_secpolicy.h (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/include/rp_secpolicy.h Mon Jan 29 03:42:58 2007
@@ -25,6 +25,8 @@
#include <rp_includes.h>
#include <rp_property.h>
#include <rp_asymmetric_binding.h>
+#include <rp_symmetric_binding.h>
+#include <rp_transport_binding.h>
#include <rp_signed_encrypted_parts.h>
#include <rp_signed_encrypted_elements.h>
#include <rp_supporting_tokens.h>
Modified: webservices/axis2/scratch/c/security-policy/c/rampart/src/core/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/src/core/Makefile.am?view=diff&rev=501015&r1=501014&r2=501015
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/src/core/Makefile.am (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/src/core/Makefile.am Mon Jan 29 03:42:58 2007
@@ -9,7 +9,9 @@
../util/librampart_util.la \
../omxmlsec/libomxmlsec.la \
../omxmlsec/tokens/liboxstokens.la \
- ../omxmlsec/openssl/libomopenssl.la
+ ../omxmlsec/openssl/libomopenssl.la \
+ ../secpolicy/model/librp_model.la \
+ ../secpolicy/builder/librp_builder.la
INCLUDES = -I$(top_builddir)/include \
-I ../../../include \
Modified: webservices/axis2/scratch/c/security-policy/c/rampart/src/handlers/rampart_out_handler.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/src/handlers/rampart_out_handler.c?view=diff&rev=501015&r1=501014&r2=501015
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/src/handlers/rampart_out_handler.c (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/src/handlers/rampart_out_handler.c Mon Jan 29 03:42:58 2007
@@ -27,9 +27,11 @@
#include <rampart_username_token.h>
#include <rampart_handler_util.h>
#include <rampart_timestamp_token.h>
-#include <rampart_action.h>
#include <rampart_encryption.h>
#include <rampart_sec_header_builder.h>
+#include <rp_policy_creator.h>
+#include <rp_secpolicy_builder.h>
+#include <rampart_context.h>
/*********************** Function headers *********************************/
@@ -66,20 +68,18 @@
rampart_out_handler_invoke(struct axis2_handler * handler,
const axis2_env_t * env, axis2_msg_ctx_t * msg_ctx)
{
- axis2_ctx_t *ctx = NULL;
axiom_soap_envelope_t *soap_envelope = NULL;
axiom_soap_header_t *soap_header = NULL;
axiom_node_t *soap_header_node = NULL;
axiom_element_t *soap_header_ele = NULL;
- axis2_param_t *param_out_flow_security = NULL;
- axis2_array_list_t *action_list = NULL;
- axis2_param_t *param_action = NULL;
- rampart_actions_t *actions = NULL;
axis2_status_t status = AXIS2_FAILURE;
+ rampart_context_t *rampart_context = NULL;
+ rp_secpolicy_t *secpolicy = NULL;
+ axis2_char_t *file_name = "/home/manjula/axis2/scratch/security-policy/c/rampart/src/secpolicy/test-resources/2.xml";
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
AXIS2_PARAM_CHECK(env->error, msg_ctx, AXIS2_FAILURE);
-
+
soap_envelope = AXIS2_MSG_CTX_GET_SOAP_ENVELOPE(msg_ctx, env);
if (!soap_envelope)
{
@@ -101,71 +101,43 @@
if (soap_header)
{
soap_header_node = AXIOM_SOAP_HEADER_GET_BASE_NODE(soap_header, env);
- soap_header_ele = (axiom_element_t *)AXIOM_NODE_GET_DATA_ELEMENT(
- soap_header_node, env);
+ if(!soap_header_node)
+ {
+ AXIS2_LOG_INFO(env->log, "[rampart][rampart_out_handler] Cannot Create the header node");
+ /*No SOAP header, so no point of proceeding*/
+ return AXIS2_SUCCESS;
+ }
+ soap_header_ele = (axiom_element_t *)AXIOM_NODE_GET_DATA_ELEMENT(soap_header_node,env);
- /*Create and populate rampart actions*/
- actions = rampart_actions_create(env);
+ /*Create security-policy object.Currently from file directly. this
+ can be changed to get it from a axiom_node. */
- ctx = AXIS2_MSG_CTX_GET_BASE(msg_ctx, env);
- param_out_flow_security = rampart_get_security_param(env, msg_ctx,
- RAMPART_OUTFLOW_SECURITY);
+ secpolicy = rp_policy_create_from_file(env,file_name);
- if (!param_out_flow_security)
+ if(!secpolicy)
{
- AXIS2_LOG_INFO(env->log,
- "[rampart][rampart_out_handler] No Outflow Security. So nothing to do");
- return AXIS2_SUCCESS;
- }else{
-
- /*Get actions*/
- action_list = rampart_get_actions(env, ctx, param_out_flow_security);
-
-
- if (!action_list)
- {
- AXIS2_LOG_INFO(env->log,
- "[rampart][rampart_out_handler] No actions defined in outflow security");
- return AXIS2_SUCCESS;
- }
-
- if (AXIS2_ARRAY_LIST_IS_EMPTY(action_list, env))
- {
- AXIS2_LOG_INFO(env->log,
- "[rampart][rampart_out_handler] No actions defined in outflow security");
- return AXIS2_SUCCESS;
- }
-
- /*Now we support only one action.*/
- param_action = (axis2_param_t*) AXIS2_ARRAY_LIST_GET(action_list,
- env, 0);
-
- if (!param_action)
- {
- AXIS2_LOG_INFO(env->log,
- "[rampart][rampart_out_handler] Cannot find first action element ERROR");
- return AXIS2_FAILURE;
- }
-
- status = RAMPART_ACTIONS_POPULATE_FROM_PARAMS(actions, env,
- param_action);
-
+ AXIS2_LOG_INFO(env->log, "[rampart][rampart_out_handler] Cannot get policy" );
+ /*No policy so we cant proceed.*/
+ return AXIS2_FAILURE;
}
+ rampart_context = rampart_context_create(env);
-
- /*Then re-populate using the axis2_ctx.
- *This is a hack to facilitate PHP extension to pass security parameters using options
- *In future we should change this to get the param_out_flow_security from a PROPERTY if it is not available
- *in the msg_ctx as as a parameter.*/
- status = RAMPART_ACTIONS_POPULATE_FROM_CTX(actions, env, ctx);
+ if(!rampart_context)
+ {
+ AXIS2_LOG_INFO(env->log, "[rampart][rampart_out_handler] Cannot get Rampart Data " );
+ /*No policy so we cant proceed.*/
+ return AXIS2_FAILURE;
+ }
+ rampart_context_set_secpolicy(rampart_context,env,secpolicy);
/*We call the security header builder*/
- status = rampart_shb_build_message(env, msg_ctx, actions, soap_envelope);
+ status = rampart_shb_build_message(env, msg_ctx, rampart_context, soap_envelope);
if(AXIS2_FAILURE == status){
- AXIS2_LOG_INFO(env->log,
- "[rampart][rampart_out_handler] Security header building failed ERROR");
+ AXIS2_LOG_INFO(env->log,
+ "[rampart][rampart_out_handler] Security header building failed ERROR");
return AXIS2_FAILURE;
}
}
return AXIS2_SUCCESS;
+
}
Modified: webservices/axis2/scratch/c/security-policy/c/rampart/src/secpolicy/builder/rampart_config_builder.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/src/secpolicy/builder/rampart_config_builder.c?view=diff&rev=501015&r1=501014&r2=501015
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/src/secpolicy/builder/rampart_config_builder.c (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/src/secpolicy/builder/rampart_config_builder.c Mon Jan 29 03:42:58 2007
@@ -142,6 +142,20 @@
else
return AXIS2_FAILURE;
}
+ else if(AXIS2_STRCMP(local_name,RP_PASSWORD_TYPE)==0)
+ {
+ if(rp_match_rampart_config_qname(env,RP_PASSWORD_TYPE,node,element))
+ {
+ axis2_char_t *password_type = NULL;
+ password_type = AXIOM_ELEMENT_GET_TEXT(element,env,node);
+ printf("%s\n",local_name);
+ printf("%s\n",password_type);
+ return rp_rampart_config_set_password_type(rampart_config,env,password_type);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+
else if(AXIS2_STRCMP(local_name,RP_SIGNATURE_CRYPTO)==0)
{
if(rp_match_rampart_config_qname(env,RP_SIGNATURE_CRYPTO,node,element))
Modified: webservices/axis2/scratch/c/security-policy/c/rampart/src/secpolicy/model/rampart_config.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/src/secpolicy/model/rampart_config.c?view=diff&rev=501015&r1=501014&r2=501015
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/src/secpolicy/model/rampart_config.c (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/src/secpolicy/model/rampart_config.c Mon Jan 29 03:42:58 2007
@@ -24,6 +24,7 @@
axis2_char_t *encryption_user;
axis2_char_t *password_callback_class;
axis2_char_t *authenticate_module;
+ axis2_char_t *password_type;
rp_signature_crypto_t *signature_crypto;
rp_encryption_crypto_t *encryption_crypto;
};
@@ -49,7 +50,7 @@
rampart_config->signature_crypto = NULL;
rampart_config->encryption_crypto = NULL;
rampart_config->authenticate_module = NULL;
-
+ rampart_config->password_type = NULL;
return rampart_config;
}
@@ -168,6 +169,29 @@
rampart_config->authenticate_module = authenticate_module;
return AXIS2_SUCCESS;
}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_rampart_config_get_password_type(
+ rp_rampart_config_t *rampart_config,
+ const axis2_env_t *env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return rampart_config->password_type;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_rampart_config_set_password_type(rp_rampart_config_t *rampart_config,
+ const axis2_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 rp_signature_crypto_t *AXIS2_CALL
rp_rampart_config_get_signature_crypto(
Modified: webservices/axis2/scratch/c/security-policy/c/rampart/src/secpolicy/model/ut.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/src/secpolicy/model/ut.c?view=diff&rev=501015&r1=501014&r2=501015
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/src/secpolicy/model/ut.c (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/src/secpolicy/model/ut.c Mon Jan 29 03:42:58 2007
@@ -70,7 +70,7 @@
/* Implementations */
AXIS2_EXTERN axis2_char_t *AXIS2_CALL
-rp_username_token_get_inclsion(
+rp_username_token_get_inclusion(
rp_username_token_t *username_token,
const axis2_env_t *env)
{
Modified: webservices/axis2/scratch/c/security-policy/c/rampart/src/secpolicy/test-resources/2.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/src/secpolicy/test-resources/2.xml?view=diff&rev=501015&r1=501014&r2=501015
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/src/secpolicy/test-resources/2.xml (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/src/secpolicy/test-resources/2.xml Mon Jan 29 03:42:58 2007
@@ -34,7 +34,12 @@
<sp:IncludeTimestamp/>
<sp:OnlySignEntireHeadersAndBody/>
</wsp:Policy>
- </sp:AsymmetricBinding>
+ </sp:AsymmetricBinding>
+ <sp:SignedSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Always"/>
+ </wsp:Policy>
+ </sp:SignedSupportingTokens>
<sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy>
<sp:MustSupportRefKeyIdentifier/>
@@ -45,9 +50,10 @@
<sp:Body/>
</sp:SignedParts>
<rampc:RampartConfig xmlns:rampc="http://ws.apache.org/rampart/c/policy">
- <rampc:user>alice</rampc:user>
+ <rampc:user>Gampola</rampc:user>
<rampc:encryptionUser>bob</rampc:encryptionUser>
- <rampc:passwordCallbackClass>/home/manjula/axis2/c/deploy/bin/samples/rampart/callback/libpwcb.so</rampc:passwordCallbackClass>
+ <rampc:passwordType>Digest</rampc:passwordType>
+ <rampc:passwordCallbackClass>/home/manjula/axis2/scratch/security-policy/c/deploy/bin/samples/rampart/callback/libpwcb.so</rampc:passwordCallbackClass>
<rampc:signatureCrypto>
<rampc:signaturePropFile>/home/manjula/axis2/c/rampart/samples/keys/ahome/b_cert.cert</rampc:signaturePropFile>
</rampc:signatureCrypto>
Modified: webservices/axis2/scratch/c/security-policy/c/rampart/src/util/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/src/util/Makefile.am?view=diff&rev=501015&r1=501014&r2=501015
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/src/util/Makefile.am (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/src/util/Makefile.am Mon Jan 29 03:42:58 2007
@@ -5,7 +5,7 @@
librampart_util_la_SOURCES = rampart_action.c rampart_crypto_util.c \
rampart_util.c rampart_handler_util.c username_token.c timestamp_token.c \
rampart_encryption.c rampart_sec_header_processor.c rampart_sec_processed_result.c \
- rampart_sec_header_builder.c
+ rampart_sec_header_builder.c rampart_context.c
librampart_util_la_LIBADD = -lssl \
Added: webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_context.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_context.c?view=auto&rev=501015
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_context.c (added)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_context.c Mon Jan 29 03:42:58 2007
@@ -0,0 +1,390 @@
+/*
+ * 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_context.h>
+
+struct rampart_context_t
+{
+ rp_secpolicy_t *secpolicy;
+};
+
+
+/*private functions*/
+
+rp_symmetric_asymmetric_binding_commons_t
+*rampart_context_get_symmetric_asymmetric_binding_commons(
+ rampart_context_t *rampart_context,
+ const axis2_env_t *env);
+
+rp_binding_commons_t *rampart_context_get_binding_commons(
+ rampart_context_t *rampart_context,
+ const axis2_env_t *env);
+
+axis2_bool_t rampart_context_use_username_token(
+ rp_supporting_tokens_t *signed_supporting,
+ const axis2_env_t *env);
+
+axis2_bool_t rampart_context_validate_ut(
+ rp_username_token_t *username_token,
+ const axis2_env_t *env);
+
+rp_supporting_tokens_t
+*rampart_context_get_signed_supporting_from_binding(
+ rampart_context_t *rampart_context,
+ const axis2_env_t *env);
+
+
+
+AXIS2_EXTERN rampart_context_t *AXIS2_CALL
+rampart_context_create(const axis2_env_t *env)
+{
+ rampart_context_t *rampart_context = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ rampart_context = (rampart_context_t *) AXIS2_MALLOC (env->allocator,
+ sizeof (rampart_context_t));
+
+ if(rampart_context == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ rampart_context->secpolicy= NULL;
+
+ return rampart_context;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rampart_context_free(rampart_context_t *rampart_context,
+ const axis2_env_t *env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ if(rampart_context)
+ {
+ if(rampart_context->secpolicy)
+ {
+ rp_secpolicy_free(rampart_context->secpolicy,env);
+ rampart_context->secpolicy = NULL;
+ }
+ AXIS2_FREE(env->allocator,rampart_context);
+ rampart_context = NULL;
+ }
+ return AXIS2_SUCCESS;
+}
+
+
+/* Implementations */
+
+AXIS2_EXTERN rp_secpolicy_t *AXIS2_CALL
+rampart_context_get_secpolicy(
+ rampart_context_t *rampart_context,
+ const axis2_env_t *env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return rampart_context->secpolicy;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rampart_context_set_secpolicy(rampart_context_t *rampart_context,
+ const axis2_env_t *env,
+ rp_secpolicy_t *secpolicy)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error,secpolicy,AXIS2_FAILURE);
+
+ rampart_context->secpolicy = secpolicy;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN int AXIS2_CALL
+rampart_context_get_binding_type(
+ rampart_context_t *rampart_context,
+ const axis2_env_t *env)
+{
+ rp_property_t *property = NULL;
+
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ property = rp_secpolicy_get_binding(rampart_context->secpolicy,env);
+ if(!property)
+ return -1;
+
+ return rp_property_get_type(property,env);
+}
+
+rp_symmetric_asymmetric_binding_commons_t
+*rampart_context_get_symmetric_asymmetric_binding_commons(
+ rampart_context_t *rampart_context,
+ const axis2_env_t *env)
+{
+ rp_property_t *property = NULL;
+ property = rp_secpolicy_get_binding(rampart_context->secpolicy,env);
+ if(!property)
+ return NULL;
+
+ if(rp_property_get_type(property,env)==RP_BINDING_ASYMMETRIC)
+ {
+ rp_asymmetric_binding_t *asymmetric_binding = NULL;
+ asymmetric_binding = (rp_asymmetric_binding_t*)rp_property_get_value(property,env);
+ if(!asymmetric_binding)
+ return NULL;
+
+ return rp_asymmetric_binding_get_symmetric_asymmetric_binding_commons(asymmetric_binding,env);
+ }
+ else if(rp_property_get_type(property,env)==RP_BINDING_SYMMETRIC)
+ {
+ rp_symmetric_binding_t *symmetric_binding = NULL;
+ symmetric_binding = (rp_symmetric_binding_t*)rp_property_get_value(property,env);
+ if(!symmetric_binding)
+ return NULL;
+
+ return rp_symmetric_binding_get_symmetric_asymmetric_binding_commons(symmetric_binding,env);
+ }
+ else
+ return NULL;
+}
+
+rp_binding_commons_t
+*rampart_context_get_binding_commons(
+ rampart_context_t *rampart_context,
+ const axis2_env_t *env)
+{
+ rp_property_t *property = NULL;
+ property = rp_secpolicy_get_binding(rampart_context->secpolicy,env);
+ if(!property)
+ return NULL;
+
+ if(rp_property_get_type(property,env)==RP_BINDING_ASYMMETRIC)
+ {
+ rp_asymmetric_binding_t *asymmetric_binding = NULL;
+ rp_symmetric_asymmetric_binding_commons_t *sym_asym_commons = NULL;
+ asymmetric_binding = (rp_asymmetric_binding_t*)rp_property_get_value(property,env);
+ if(!asymmetric_binding)
+ return NULL;
+
+ sym_asym_commons = rp_asymmetric_binding_get_symmetric_asymmetric_binding_commons(asymmetric_binding,env);
+ if(!sym_asym_commons)
+ return NULL;
+
+ return rp_symmetric_asymmetric_binding_commons_get_binding_commons(sym_asym_commons,env);
+ }
+ else if(rp_property_get_type(property,env)==RP_BINDING_SYMMETRIC)
+ {
+ rp_symmetric_binding_t *symmetric_binding = NULL;
+ rp_symmetric_asymmetric_binding_commons_t *sym_asym_commons = NULL;
+ symmetric_binding = (rp_symmetric_binding_t*)rp_property_get_value(property,env);
+ if(!symmetric_binding)
+ return NULL;
+
+ sym_asym_commons = rp_symmetric_binding_get_symmetric_asymmetric_binding_commons(symmetric_binding,env);
+ if(!sym_asym_commons)
+ return NULL;
+
+ return rp_symmetric_asymmetric_binding_commons_get_binding_commons(sym_asym_commons,env);
+
+ }
+ else if(rp_property_get_type(property,env)==RP_BINDING_TRANSPORT)
+ {
+ rp_transport_binding_t *transport_binding = NULL;
+ transport_binding = (rp_transport_binding_t*)rp_property_get_value(property,env);
+ if(!transport_binding)
+ return NULL;
+
+ return rp_transport_binding_get_binding_commons(transport_binding,env);
+ }
+ else
+ return NULL;
+}
+/*supporting tokens may contain under binding*/
+
+rp_supporting_tokens_t
+*rampart_context_get_signed_supporting_from_binding(
+ rampart_context_t *rampart_context,
+ const axis2_env_t *env)
+{
+ rp_binding_commons_t *commons = NULL;
+ commons = rampart_context_get_binding_commons(rampart_context,env);
+ if(!commons)
+ return NULL;
+ return rp_binding_commons_get_signed_supporting_tokens(commons,env);
+}
+
+axis2_bool_t
+rampart_context_validate_ut(
+ rp_username_token_t *username_token,
+ const axis2_env_t *env)
+{
+ axis2_char_t *inclusion = NULL;
+ axis2_bool_t bval = AXIS2_FALSE;
+
+ bval = rp_username_token_get_useUTprofile10(username_token,env);
+ if(bval)
+ {
+ inclusion = rp_username_token_get_inclusion(username_token,env);
+ if((AXIS2_STRCMP(inclusion,RP_INCLUDE_ALWAYS)==0)||
+ (AXIS2_STRCMP(inclusion,RP_INCLUDE_ONCE)==0))
+ return bval;
+ else
+ bval = AXIS2_FALSE;
+ }
+ return bval;
+}
+
+
+
+axis2_bool_t
+rampart_context_use_username_token(
+ rp_supporting_tokens_t *signed_supporting,
+ const axis2_env_t *env)
+{
+ axis2_array_list_t *array_list = NULL;
+ axis2_bool_t bvalidate = AXIS2_FALSE;
+ array_list = rp_supporting_tokens_get_tokens(signed_supporting,env);
+ if(!array_list)
+ return AXIS2_FALSE;
+
+ else
+ {
+ int i = 0;
+ for (i = 0; i < AXIS2_ARRAY_LIST_SIZE(array_list,env); i++)
+ {
+ rp_property_t *token = NULL;
+ token = (rp_property_t *)
+ AXIS2_ARRAY_LIST_GET(array_list,env, i);
+ if (token)
+ {
+ if(rp_property_get_type(token,env)==RP_TOKEN_USERNAME)
+ {
+ rp_username_token_t *username_token =
+ (rp_username_token_t *)rp_property_get_value(token,env);
+ bvalidate = rampart_context_validate_ut(username_token,env);
+ break;
+ }
+ }
+ }
+ }
+ return bvalidate;
+}
+
+
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rampart_context_is_include_timestamp(
+ rampart_context_t *rampart_context,
+ const axis2_env_t *env)
+{
+ rp_binding_commons_t *binding_commons = NULL;
+
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ binding_commons = rampart_context_get_binding_commons(rampart_context,env);
+
+ if(!binding_commons)
+ return AXIS2_FALSE;
+
+ return rp_binding_commons_get_include_timestamp(binding_commons,env);
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rampart_context_is_include_username_token(
+ rampart_context_t *rampart_context,
+ const axis2_env_t *env)
+{
+ /*Username tokens should be in signed supporting tikens.
+ Otherwise no meaning */
+
+ rp_supporting_tokens_t *signed_supporting = NULL;
+
+ /*First we should check in the direct policy members*/
+ signed_supporting = rp_secpolicy_get_signed_supporting_tokens(rampart_context->secpolicy,env);
+ /*If not there then we should ckeck in the binding*/
+ if(!signed_supporting)
+ {
+ signed_supporting = rampart_context_get_signed_supporting_from_binding(rampart_context,env);
+ if(!signed_supporting)
+ return AXIS2_FALSE;
+ }
+ /*Now we have signed supporting tokens*/
+ /*Get the user name token if available and check the validity*/
+ return rampart_context_use_username_token(signed_supporting,env);
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rampart_context_get_user(
+ rampart_context_t *rampart_context,
+ const axis2_env_t *env)
+{
+
+ rp_rampart_config_t *config = NULL;
+ config = rp_secpolicy_get_rampart_config(rampart_context->secpolicy,env);
+ if(!config)
+ return NULL;
+
+ return rp_rampart_config_get_user(config,env);
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rampart_context_get_password_callback_class(
+ rampart_context_t *rampart_context,
+ const axis2_env_t *env)
+{
+ rp_rampart_config_t *config = NULL;
+ config = rp_secpolicy_get_rampart_config(rampart_context->secpolicy,env);
+ if(!config)
+ return NULL;
+
+ return rp_rampart_config_get_password_callback_class(config,env);
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rampart_context_get_authn_module_name(
+ rampart_context_t *rampart_context,
+ const axis2_env_t *env)
+{
+ rp_rampart_config_t *config = NULL;
+ config = rp_secpolicy_get_rampart_config(rampart_context->secpolicy,env);
+ if(!config)
+ return NULL;
+
+ return rp_rampart_config_get_authenticate_module(config,env);
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rampart_context_get_password_type(
+ rampart_context_t *rampart_context,
+ const axis2_env_t *env)
+{
+ axis2_bool_t digest = AXIS2_FALSE;
+ axis2_char_t *type = NULL;
+ rp_rampart_config_t *config = NULL;
+
+ config = rp_secpolicy_get_rampart_config(rampart_context->secpolicy,env);
+ if(!config)
+ return AXIS2_FALSE;
+
+ type = rp_rampart_config_get_password_type(config,env);
+ if(AXIS2_STRCMP(type,RP_DIGEST)==0)
+ {
+ digest = AXIS2_TRUE;
+ return digest;
+ }
+ else
+ return digest;
+}
Modified: webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_handler_util.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_handler_util.c?view=diff&rev=501015&r1=501014&r2=501015
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_handler_util.c (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_handler_util.c Mon Jan 29 03:42:58 2007
@@ -109,7 +109,8 @@
}
/*Get axis2_ctx_t. This is designed specially for PHP*/
- password = rampart_callback_password(env, pw_callback_module, enc_user, ctx);
+/* password = rampart_callback_password(env, pw_callback_module, enc_user, ctx);*/
+ password = rampart_callback_password(env, pw_callback_module, enc_user);
return password;
}
Modified: webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_sec_header_builder.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_sec_header_builder.c?view=diff&rev=501015&r1=501014&r2=501015
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_sec_header_builder.c (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_sec_header_builder.c Mon Jan 29 03:42:58 2007
@@ -17,7 +17,7 @@
#include <stdio.h>
#include <rampart_encryption.h>
-#include <rampart_action.h>
+#include <rampart_context.h>
#include <rampart_constants.h>
#include <rampart_sec_header_builder.h>
#include <rampart_username_token.h>
@@ -48,17 +48,144 @@
/*Public functions*/
+
AXIS2_EXTERN axis2_status_t AXIS2_CALL
rampart_shb_build_message(const axis2_env_t *env,
axis2_msg_ctx_t *msg_ctx,
- rampart_actions_t *actions,
+ rampart_context_t *rampart_context,
+ axiom_soap_envelope_t *soap_envelope)
+{
+
+ axis2_status_t status = AXIS2_FAILURE;
+ axiom_soap_header_t *soap_header = NULL;
+ axiom_node_t *soap_header_node = NULL;
+ axiom_element_t *soap_header_ele = NULL;
+ axiom_soap_header_block_t *sec_header_block = NULL;
+ axiom_namespace_t *sec_ns_obj = NULL;
+ axiom_node_t *sec_node = NULL;
+ axiom_element_t *sec_ele = NULL;
+
+ AXIS2_ENV_CHECK(env,AXIS2_FAILURE);
+ soap_header = AXIOM_SOAP_ENVELOPE_GET_HEADER(soap_envelope, env);
+ soap_header_node = AXIOM_SOAP_HEADER_GET_BASE_NODE(soap_header, env);
+ soap_header_ele = (axiom_element_t *)AXIOM_NODE_GET_DATA_ELEMENT(
+ soap_header_node, env);
+
+
+ sec_ns_obj = axiom_namespace_create(env, RAMPART_WSSE_XMLNS,
+ RAMPART_WSSE);
+
+ sec_header_block = AXIOM_SOAP_HEADER_ADD_HEADER_BLOCK(soap_header,
+ env, RAMPART_SECURITY, sec_ns_obj);
+
+ if(!sec_header_block)
+ {
+ AXIS2_LOG_INFO(env->log, "[rampart][shb] Security header block is NULL");
+ return AXIS2_SUCCESS;
+ }
+
+ AXIOM_SOAP_HEADER_BLOCK_SET_MUST_UNDERSTAND_WITH_BOOL(sec_header_block,
+ env, AXIS2_TRUE);
+
+ sec_node = AXIOM_SOAP_HEADER_BLOCK_GET_BASE_NODE(sec_header_block, env);
+ sec_ele = (axiom_element_t *)
+ AXIOM_NODE_GET_DATA_ELEMENT(sec_node, env);
+
+ /*check the binding*/
+ if((rampart_context_get_binding_type(rampart_context,env)) == RP_BINDING_ASYMMETRIC)
+ {
+ /*Do Asymmetric Binding specific things*/
+
+ /*Timestamp Inclusion*/
+ if(rampart_context_is_include_timestamp(rampart_context,env))
+ {
+ rampart_timestamp_token_t *timestamp_token = NULL;
+ int ttl = -1;
+ AXIS2_LOG_INFO(env->log, "[rampart][shb] building Timestamp Token");
+ AXIS2_LOG_INFO(env->log, "[rampart][shb] Using default timeToLive value %d",
+ RAMPART_TIMESTAMP_TOKEN_DEFAULT_TIME_TO_LIVE);
+ ttl = RAMPART_TIMESTAMP_TOKEN_DEFAULT_TIME_TO_LIVE;
+
+ timestamp_token = rampart_timestamp_token_create(env);
+ status = RAMPART_TIMESTAMP_TOKEN_BUILD(timestamp_token, env,
+ sec_node, sec_ns_obj, ttl);
+ if (status == AXIS2_FAILURE)
+ {
+ AXIS2_LOG_INFO(env->log, "[rampart][shb] Timestamp Token build failed. ERROR");
+ return AXIS2_FAILURE;
+ }
+ }
+ /*Check whether we need username token*/
+ if(rampart_context_is_include_username_token(rampart_context,env))
+ {
+ axis2_char_t *user = NULL;
+ axis2_char_t *password_callback = NULL;
+ axis2_bool_t is_digest = AXIS2_FALSE;
+ rampart_username_token_t *username_token = NULL;
+
+ user = rampart_context_get_user(rampart_context,env);
+ password_callback = rampart_context_get_password_callback_class(rampart_context,env);
+ is_digest = rampart_context_get_password_type(rampart_context,env);
+
+ username_token = rampart_username_token_create(env);
+
+ AXIS2_LOG_INFO(env->log, "[rampart][shb] building UsernmaeToken");
+ status = RAMPART_USERNAME_TOKEN_BUILD(username_token,
+ env,
+ user,
+ password_callback,
+ NULL,
+ is_digest,
+ sec_node,
+ sec_ns_obj);
+ if (status == AXIS2_FAILURE)
+ {
+ AXIS2_LOG_INFO(env->log, "[rampart][shb] UsernmaeToken build failed. ERROR");
+ return AXIS2_FAILURE;
+ }
+ }
+
+
+ /*username Token inclusion*/
+
+ /*check the protection order*/
+
+
+ return AXIS2_SUCCESS;
+ }
+ else if((rampart_context_get_binding_type(rampart_context,env)) == RP_BINDING_SYMMETRIC)
+ {
+ /*Do Symmetric_binding specific things*/
+ AXIS2_LOG_INFO(env->log, "[rampart][shb] Symmetric Binding. We do not support yet");
+ return AXIS2_FAILURE;
+ }
+ else if((rampart_context_get_binding_type(rampart_context,env)) == RP_BINDING_TRANSPORT)
+ {
+ /*Do Transport Binding specific things */
+ AXIS2_LOG_INFO(env->log, "[rampart][shb] Transport Binding. We do not support yet");
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ /*Timestamp Inclusion*/
+
+ /*username Token inclusion*/
+
+ /*check the protection order*/
+
+
+}
+/*
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rampart_shb_build_message(const axis2_env_t *env,
+ axis2_msg_ctx_t *msg_ctx,
+ rampart_context_t *rampart_context,
axiom_soap_envelope_t *soap_envelope)
{
axis2_status_t status = AXIS2_FAILURE;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
AXIS2_PARAM_CHECK(env->error, msg_ctx, AXIS2_FAILURE);
- /*We need a SOAP envelope.*/
if(soap_envelope){
axis2_ctx_t *ctx = NULL;
axiom_soap_header_t *soap_header = NULL;
@@ -68,7 +195,6 @@
axiom_soap_header_block_t *sec_header_block = NULL;
axiom_namespace_t *sec_ns_obj = NULL;
- /*We are checking for the soap header element*/
soap_header = AXIOM_SOAP_ENVELOPE_GET_HEADER(soap_envelope, env);
soap_header_node = AXIOM_SOAP_HEADER_GET_BASE_NODE(soap_header, env);
soap_header_ele = (axiom_element_t *)AXIOM_NODE_GET_DATA_ELEMENT(
@@ -89,7 +215,6 @@
sec_header_block = AXIOM_SOAP_HEADER_ADD_HEADER_BLOCK(soap_header,
env, RAMPART_SECURITY, sec_ns_obj);
- /*Set mustUnderstand=1*/
AXIOM_SOAP_HEADER_BLOCK_SET_MUST_UNDERSTAND_WITH_BOOL(sec_header_block,
env, AXIS2_TRUE);
@@ -105,7 +230,6 @@
sec_ele = (axiom_element_t *)
AXIOM_NODE_GET_DATA_ELEMENT(sec_node, env);
- /*Get action items seperated by spaces*/
string_list = axis2_tokenize(env, items, ' ');
if (string_list)
{
@@ -113,11 +237,9 @@
}
ctx = AXIS2_MSG_CTX_GET_BASE(msg_ctx, env);
- /*Iterate thru items. Eg. Usernmaetoken, Timestamp, Encrypt, Signature*/
for (i = 0; i < size; i++)
{
item = AXIS2_ARRAY_LIST_GET(string_list, env, i);
- /*Username token*/
if (0 == AXIS2_STRCMP(RAMPART_ACTION_ITEMS_USERNAMETOKEN ,
AXIS2_STRTRIM(env, item, NULL)))
{
@@ -136,8 +258,6 @@
AXIS2_LOG_INFO(env->log, "[rampart][shb] UsernmaeToken build failed. ERROR");
return AXIS2_FAILURE;
}
- /*TODO free*/
- /*Timestamp token*/
}
else if (0 == AXIS2_STRCMP(RAMPART_ACTION_ITEMS_TIMESTAMP,
AXIS2_STRTRIM(env, item, NULL)))
@@ -148,7 +268,6 @@
AXIS2_LOG_INFO(env->log, "[rampart][shb] building Timestamp Token");
ttl_str = RAMPART_ACTIONS_GET_TIME_TO_LIVE(actions, env);
- /*Check for the ttl. If not specified use the default*/
if(!ttl_str){
AXIS2_LOG_INFO(env->log, "[rampart][shb] Using default timeToLive value %d",
RAMPART_TIMESTAMP_TOKEN_DEFAULT_TIME_TO_LIVE);
@@ -164,7 +283,6 @@
AXIS2_LOG_INFO(env->log, "[rampart][shb] Timestamp Token build failed. ERROR");
return AXIS2_FAILURE;
}
- /*Encrypt*/
}
else if (0 == AXIS2_STRCMP(RAMPART_ACTION_ITEMS_ENCRYPT,
AXIS2_STRTRIM(env, item, NULL)))
@@ -178,31 +296,29 @@
return AXIS2_FAILURE;
}
- /*Signature*/
}
else if (0 == AXIS2_STRCMP(RAMPART_ACTION_ITEMS_SIGNATURE,
AXIS2_STRTRIM(env, item, NULL)))
{
AXIS2_LOG_INFO(env->log, "[rampart][shb] Signing message. We do not support yet");
- /*Any other type of action*/
}
else
{
AXIS2_LOG_INFO(env->log, "[rampart][shb] We do not support %s item yet" , item);
}
- }/*End of for*/
+ }
}
else
{
AXIS2_LOG_INFO(env->log, "[rampart][shb] Security header block is NULL");
}
- }else{/*No SOAP message*/
+ }else{
return AXIS2_FAILURE;
}
return AXIS2_SUCCESS;
}
-
+*/
Modified: webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_sec_header_processor.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_sec_header_processor.c?view=diff&rev=501015&r1=501014&r2=501015
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_sec_header_processor.c (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_sec_header_processor.c Mon Jan 29 03:42:58 2007
@@ -397,7 +397,7 @@
}else if(0 == AXIS2_STRCMP(cur_node_name , OXS_NODE_BINARY_SECURITY_TOKEN)){
/*Process BinarySecurityToken*/
AXIS2_LOG_INFO(env->log, "[rampart][shp] Process BinarySecurityToken");
-
+ status = AXIS2_SUCCESS;
}else if(0 == AXIS2_STRCMP(cur_node_name ,OXS_NODE_REFERENCE_LIST)){
/*List is placed Out side of the EncryptedKey*/
AXIS2_LOG_INFO(env->log, "[rampart][shp] Process ReferenceList");
Modified: webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_util.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_util.c?view=diff&rev=501015&r1=501014&r2=501015
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_util.c (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_util.c Mon Jan 29 03:42:58 2007
@@ -90,26 +90,26 @@
AXIS2_EXTERN axis2_char_t* AXIS2_CALL
rampart_callback_password(const axis2_env_t *env,
axis2_char_t *callback_module_name,
- const axis2_char_t *username,
- axis2_ctx_t *ctx)
+ const axis2_char_t *username)
{
rampart_callback_t* rcb = NULL;
axis2_char_t *password = NULL;
axis2_dll_desc_t *dll_desc = NULL;
void *ptr = NULL;
axis2_param_t *impl_info_param = NULL;
- axis2_property_t* property = NULL;
+/* axis2_property_t* property = NULL; */
void *cb_prop_val= NULL;
/*Get callback specific property if any from the ctx. This is specially done for PHP folks to send the htpassword file location.
*/
- property = AXIS2_CTX_GET_PROPERTY(ctx, env, RAMPART_CALLBACK_SPECIFIC_PROPERTY, AXIS2_FALSE);
+ /*since we use policy we need not these*/
+/* property = AXIS2_CTX_GET_PROPERTY(ctx, env, RAMPART_CALLBACK_SPECIFIC_PROPERTY, AXIS2_FALSE);
if (property)
{
cb_prop_val = AXIS2_PROPERTY_GET_VALUE(property, env);
property = NULL;
}
-
+*/
dll_desc = axis2_dll_desc_create(env);
AXIS2_DLL_DESC_SET_NAME(dll_desc, env, callback_module_name);
impl_info_param = axis2_param_create(env, NULL, NULL);
Modified: webservices/axis2/scratch/c/security-policy/c/rampart/src/util/timestamp_token.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/src/util/timestamp_token.c?view=diff&rev=501015&r1=501014&r2=501015
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/src/util/timestamp_token.c (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/src/util/timestamp_token.c Mon Jan 29 03:42:58 2007
@@ -53,7 +53,6 @@
axis2_status_t AXIS2_CALL
rampart_timestamp_token_build(rampart_timestamp_token_t *timestamp_token,
const axis2_env_t *env,
- const axis2_ctx_t *ctx,
axiom_node_t *sec_node,
const axiom_namespace_t *sec_ns_obj,
int ttl);
@@ -131,7 +130,6 @@
axis2_status_t AXIS2_CALL
rampart_timestamp_token_build(rampart_timestamp_token_t *timestamp_token,
const axis2_env_t *env,
- const axis2_ctx_t *ctx,
axiom_node_t *sec_node,
const axiom_namespace_t *sec_ns_obj,
int ttl)
Modified: webservices/axis2/scratch/c/security-policy/c/rampart/src/util/username_token.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/src/util/username_token.c?view=diff&rev=501015&r1=501014&r2=501015
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/src/util/username_token.c (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/src/util/username_token.c Mon Jan 29 03:42:58 2007
@@ -52,16 +52,12 @@
* @param Outflow security parameter
* @return password
*/
-static axis2_char_t*
-rampart_get_password(const axis2_env_t *env,
- axis2_ctx_t *ctx,
- rampart_actions_t *actions);
/** public functions*/
axis2_status_t AXIS2_CALL
rampart_username_token_free(rampart_username_token_t *username_token,
const axis2_env_t *env);
-
+/*
axis2_status_t AXIS2_CALL
rampart_username_token_build(rampart_username_token_t *username_token,
const axis2_env_t *env,
@@ -69,6 +65,18 @@
rampart_actions_t *actions,
axiom_node_t *sec_node,
axiom_namespace_t *sec_ns_obj);
+*/
+
+axis2_status_t AXIS2_CALL
+rampart_username_token_build(rampart_username_token_t *username_token,
+ const axis2_env_t *env,
+ axis2_char_t *username,
+ axis2_char_t *password_callback_class,
+ axis2_char_t *authn_module_name,
+ axis2_bool_t isdigest,
+ axiom_node_t *sec_node,
+ axiom_namespace_t *sec_ns_obj);
+
axis2_status_t AXIS2_CALL
@@ -89,33 +97,6 @@
}
-static axis2_char_t *
-rampart_get_password(const axis2_env_t *env,
- axis2_ctx_t *ctx,
- rampart_actions_t *actions)
-{
- axis2_char_t *password = NULL;
- axis2_char_t *username = NULL;
- axis2_char_t *pw_callback_module = NULL;
-
- /*Check if password is in the context.
- i.e.In any context in the cotext hierarchy starting from msg, op, svc, etc.*/
- password = rampart_get_property_from_ctx(env, ctx, RAMPART_ACTION_PASSWORD);
- if (password)
- {
- return password;
- }
-
- /*If not check whether there is a callback class specified*/
- pw_callback_module = RAMPART_ACTIONS_GET_PW_CB_CLASS(actions, env);
- if (pw_callback_module)
- {
- username = RAMPART_ACTIONS_GET_USER(actions, env);
- password = rampart_callback_password(env, pw_callback_module, username, ctx);
- }
- return password;
-}
-
rampart_username_token_t *AXIS2_CALL
rampart_username_token_create(
const axis2_env_t *env)
@@ -174,8 +155,10 @@
axis2_status_t AXIS2_CALL
rampart_username_token_build(rampart_username_token_t *username_token,
const axis2_env_t *env,
- axis2_ctx_t *ctx,
- rampart_actions_t *actions,
+ axis2_char_t *username,
+ axis2_char_t *password_callback_class,
+ axis2_char_t *authn_module_name,
+ axis2_bool_t isdigest,
axiom_node_t *sec_node,
axiom_namespace_t *sec_ns_obj
)
@@ -191,22 +174,17 @@
axiom_element_t *pw_ele = NULL;
axiom_element_t *nonce_ele = NULL;
axiom_element_t *created_ele = NULL;
- axis2_char_t *username = NULL;
- axis2_char_t *password = NULL;
- axis2_char_t *password_type = NULL;
axiom_namespace_t *wsu_ns_obj = NULL;
axiom_attribute_t *om_attr = NULL;
+ axis2_char_t *password = NULL;
rampart_username_token_impl_t *username_token_impl = NULL;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
username_token_impl = AXIS2_INTF_TO_IMPL(username_token);
- /*Get values from outflow security*/
+ /*Directly call the password from callback module*/
- username = RAMPART_ACTIONS_GET_USER(actions, env);
- password_type = RAMPART_ACTIONS_GET_PASSWORD_TYPE(actions, env);
-
- password = rampart_get_password(env, ctx, actions);
+ password = rampart_callback_password(env, password_callback_class,username);
if (!password)
{
@@ -241,8 +219,9 @@
AXIOM_ELEMENT_SET_NAMESPACE(un_ele, env, sec_ns_obj, un_node);
}
-
- if (0 == AXIS2_STRCMP(password_type, RAMPART_PASSWORD_DIGEST))
+ /*From policy we can get this as a bool */
+/* if (0 == AXIS2_STRCMP(password_type, RAMPART_PASSWORD_DIGEST))*/
+ if(isdigest)
{
axis2_char_t *nonce_val = NULL;
axis2_char_t *created_val = NULL;
@@ -520,7 +499,8 @@
AXIS2_LOG_INFO(env->log, "[rampart][rampart_usernametoken] Password authentication using CALLBACK MODULE %s", pw_callback_module);
- password_from_svr = rampart_callback_password(env, pw_callback_module, username, ctx);
+/* password_from_svr = rampart_callback_password(env, pw_callback_module, username, ctx);*/
+ password_from_svr = rampart_callback_password(env, pw_callback_module, username);
if (!password_from_svr)
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart][rampart_usernametoken] Cannot get the password for user %s", username);
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org