summaryrefslogtreecommitdiffstats
path: root/neethi/src/secpolicy
diff options
context:
space:
mode:
authorGravatar gmcdonald2010-02-13 01:32:03 +0000
committerGravatar gmcdonald2010-02-13 01:32:03 +0000
commit0425aadc78680e53000fd0108b540d6eca048516 (patch)
tree8ec7ab8e015d454c5ec586dfc91e05a2dce1cfc0 /neethi/src/secpolicy
downloadaxis2c-0425aadc78680e53000fd0108b540d6eca048516.tar.gz
axis2c-0425aadc78680e53000fd0108b540d6eca048516.tar.bz2
Moving axis svn, part of TLP move INFRA-2441
git-svn-id: http://svn.apache.org/repos/asf/axis/axis2/c/core/trunk@909681 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'neethi/src/secpolicy')
-rw-r--r--neethi/src/secpolicy/Makefile.am1
-rw-r--r--neethi/src/secpolicy/builder/Makefile.am25
-rw-r--r--neethi/src/secpolicy/builder/algorithmsuite_builder.c82
-rw-r--r--neethi/src/secpolicy/builder/asymmetric_binding_builder.c234
-rw-r--r--neethi/src/secpolicy/builder/bootstrap_policy_builder.c61
-rw-r--r--neethi/src/secpolicy/builder/encryption_token_builder.c175
-rw-r--r--neethi/src/secpolicy/builder/https_token_builder.c56
-rw-r--r--neethi/src/secpolicy/builder/initiator_token_builder.c138
-rw-r--r--neethi/src/secpolicy/builder/issued_token_builder.c164
-rw-r--r--neethi/src/secpolicy/builder/layout_builder.c74
-rw-r--r--neethi/src/secpolicy/builder/protection_token_builder.c175
-rw-r--r--neethi/src/secpolicy/builder/rampart_config_builder.c213
-rw-r--r--neethi/src/secpolicy/builder/recipient_token_builder.c139
-rw-r--r--neethi/src/secpolicy/builder/saml_token_builder.c155
-rw-r--r--neethi/src/secpolicy/builder/secpolicy_builder.c241
-rw-r--r--neethi/src/secpolicy/builder/security_context_token_builder.c231
-rw-r--r--neethi/src/secpolicy/builder/signature_token_builder.c175
-rw-r--r--neethi/src/secpolicy/builder/signed_encrypted_parts_builder.c209
-rw-r--r--neethi/src/secpolicy/builder/supporting_tokens_builder.c203
-rw-r--r--neethi/src/secpolicy/builder/symmetric_binding_builder.c245
-rw-r--r--neethi/src/secpolicy/builder/token_identifier.c78
-rw-r--r--neethi/src/secpolicy/builder/transport_binding_builder.c196
-rw-r--r--neethi/src/secpolicy/builder/transport_token_builder.c138
-rw-r--r--neethi/src/secpolicy/builder/trust10_builder.c139
-rw-r--r--neethi/src/secpolicy/builder/username_token_builder.c150
-rw-r--r--neethi/src/secpolicy/builder/wss10_builder.c135
-rw-r--r--neethi/src/secpolicy/builder/wss11_builder.c147
-rw-r--r--neethi/src/secpolicy/builder/x509_token_builder.c168
-rw-r--r--neethi/src/secpolicy/model/Makefile.am21
-rw-r--r--neethi/src/secpolicy/model/algorithmsuite.c627
-rw-r--r--neethi/src/secpolicy/model/asymmetric_binding.c160
-rw-r--r--neethi/src/secpolicy/model/binding_commons.c245
-rw-r--r--neethi/src/secpolicy/model/element.c112
-rw-r--r--neethi/src/secpolicy/model/header.c123
-rw-r--r--neethi/src/secpolicy/model/https_token.c153
-rw-r--r--neethi/src/secpolicy/model/issued_token.c211
-rw-r--r--neethi/src/secpolicy/model/layout.c99
-rw-r--r--neethi/src/secpolicy/model/property.c265
-rw-r--r--neethi/src/secpolicy/model/rampart_config.c446
-rw-r--r--neethi/src/secpolicy/model/saml_token.c160
-rw-r--r--neethi/src/secpolicy/model/secpolicy.c493
-rw-r--r--neethi/src/secpolicy/model/security_context_token.c239
-rw-r--r--neethi/src/secpolicy/model/signed_encrypted_elements.c180
-rw-r--r--neethi/src/secpolicy/model/signed_encrypted_items.c136
-rw-r--r--neethi/src/secpolicy/model/signed_encrypted_parts.c176
-rw-r--r--neethi/src/secpolicy/model/supporting_tokens.c300
-rw-r--r--neethi/src/secpolicy/model/symmetric_asymmetric_binding_commons.c192
-rw-r--r--neethi/src/secpolicy/model/symmetric_binding.c216
-rw-r--r--neethi/src/secpolicy/model/token.c190
-rw-r--r--neethi/src/secpolicy/model/transport_binding.c137
-rw-r--r--neethi/src/secpolicy/model/trust10.c201
-rw-r--r--neethi/src/secpolicy/model/ut.c214
-rw-r--r--neethi/src/secpolicy/model/wss10.c178
-rw-r--r--neethi/src/secpolicy/model/wss11.c256
-rw-r--r--neethi/src/secpolicy/model/x509_token.c231
55 files changed, 10108 insertions, 0 deletions
diff --git a/neethi/src/secpolicy/Makefile.am b/neethi/src/secpolicy/Makefile.am
new file mode 100644
index 0000000..28fd650
--- /dev/null
+++ b/neethi/src/secpolicy/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = model builder
diff --git a/neethi/src/secpolicy/builder/Makefile.am b/neethi/src/secpolicy/builder/Makefile.am
new file mode 100644
index 0000000..d189e16
--- /dev/null
+++ b/neethi/src/secpolicy/builder/Makefile.am
@@ -0,0 +1,25 @@
+TESTS =
+
+noinst_LTLIBRARIES = librp_builder.la
+
+librp_builder_la_SOURCES = algorithmsuite_builder.c \
+ layout_builder.c \
+ supporting_tokens_builder.c \
+ transport_binding_builder.c username_token_builder.c \
+ wss10_builder.c transport_token_builder.c \
+ token_identifier.c https_token_builder.c rampart_config_builder.c \
+ asymmetric_binding_builder.c x509_token_builder.c initiator_token_builder.c \
+ recipient_token_builder.c signed_encrypted_parts_builder.c secpolicy_builder.c \
+ symmetric_binding_builder.c protection_token_builder.c signature_token_builder.c \
+ encryption_token_builder.c wss11_builder.c trust10_builder.c \
+ bootstrap_policy_builder.c security_context_token_builder.c \
+ issued_token_builder.c saml_token_builder.c
+
+librp_builder_la_LIBADD = ../../../../axiom/src/om/libaxis2_axiom.la \
+ ../../../../util/src/libaxutil.la
+
+INCLUDES = -I$(top_builddir)/include \
+ -I ../../../include \
+ -I ../../../../util/include \
+ -I ../../../../axiom/include \
+ -I ../../../../include
diff --git a/neethi/src/secpolicy/builder/algorithmsuite_builder.c b/neethi/src/secpolicy/builder/algorithmsuite_builder.c
new file mode 100644
index 0000000..3f42baf
--- /dev/null
+++ b/neethi/src/secpolicy/builder/algorithmsuite_builder.c
@@ -0,0 +1,82 @@
+/*
+ * 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 <rp_algorithmsuite_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_algorithmsuite_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ rp_algorithmsuite_t *algorithmsuite = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_node_t *algo_node = NULL;
+ axiom_element_t *algo_element = NULL;
+ neethi_assertion_t *assertion = NULL;
+
+ algorithmsuite = rp_algorithmsuite_create(env);
+
+ child_node = axiom_node_get_first_element(node, env);
+
+ if(child_node)
+ {
+ algo_node = axiom_node_get_first_element(child_node, env);
+ if(!algo_node)
+ {
+ return NULL;
+ }
+ }
+ else
+ {
+ return NULL;
+ }
+
+ if(axiom_node_get_node_type(algo_node, env) == AXIOM_ELEMENT)
+ {
+ algo_element = (axiom_element_t *)axiom_node_get_data_element(algo_node, env);
+ if(algo_element)
+ {
+ axis2_status_t status = AXIS2_FAILURE;
+ axis2_char_t *algosuite_string = NULL;
+
+ algosuite_string = axiom_element_get_localname(algo_element, env);
+ if(!algosuite_string)
+ {
+ return NULL;
+ }
+ status = rp_algorithmsuite_set_algosuite(algorithmsuite, env, algosuite_string);
+ if(AXIS2_FAILURE == status)
+ {
+ return NULL;
+ }
+ assertion = neethi_assertion_create_with_args(env,
+ (AXIS2_FREE_VOID_ARG)rp_algorithmsuite_free, algorithmsuite,
+ ASSERTION_TYPE_ALGORITHM_SUITE);
+ return assertion;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
diff --git a/neethi/src/secpolicy/builder/asymmetric_binding_builder.c b/neethi/src/secpolicy/builder/asymmetric_binding_builder.c
new file mode 100644
index 0000000..3a2f889
--- /dev/null
+++ b/neethi/src/secpolicy/builder/asymmetric_binding_builder.c
@@ -0,0 +1,234 @@
+/*
+ * 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 <rp_asymmetric_binding_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+/*private functions*/
+
+axis2_status_t AXIS2_CALL
+asymmetric_binding_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_asymmetric_binding_t *asymmetric_binding);
+
+/***********************************/
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_asymmetric_binding_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ rp_asymmetric_binding_t *asymmetric_binding = NULL;
+ neethi_policy_t *policy = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_element_t *child_element = NULL;
+ axutil_array_list_t *alternatives = NULL;
+ neethi_operator_t *component = NULL;
+ neethi_all_t *all = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_policy_t *normalized_policy = NULL;
+
+ asymmetric_binding = rp_asymmetric_binding_create(env);
+
+ child_node = axiom_node_get_first_element(node, env);
+ if(!child_node)
+ {
+ return NULL;
+ }
+
+ if(axiom_node_get_node_type(child_node, env) == AXIOM_ELEMENT)
+ {
+ child_element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+ if(child_element)
+ {
+ policy = neethi_engine_get_policy(env, child_node, child_element);
+ if(!policy)
+ {
+ return NULL;
+ }
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
+ all = (neethi_all_t *)neethi_operator_get_value(component, env);
+ asymmetric_binding_process_alternatives(env, all, asymmetric_binding);
+
+ assertion = neethi_assertion_create_with_args(env,
+ (AXIS2_FREE_VOID_ARG)rp_asymmetric_binding_free, asymmetric_binding,
+ ASSERTION_TYPE_ASSYMMETRIC_BINDING);
+ neethi_policy_free(normalized_policy, env);
+ normalized_policy = NULL;
+
+ return assertion;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
+
+axis2_status_t AXIS2_CALL
+asymmetric_binding_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_asymmetric_binding_t * asymmetric_binding)
+{
+
+ neethi_operator_t *operator = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_assertion_type_t type;
+ void *value = NULL;
+ rp_binding_commons_t *commons = NULL;
+ rp_symmetric_asymmetric_binding_commons_t *as_commons = NULL;
+
+ int i = 0;
+
+ arraylist = neethi_all_get_policy_components(all, env);
+ commons = rp_binding_commons_create(env);
+ as_commons = rp_symmetric_asymmetric_binding_commons_create(env);
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ operator = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(operator, env);
+ value = neethi_assertion_get_value(assertion, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(type == ASSERTION_TYPE_INITIATOR_TOKEN)
+ {
+ rp_property_t *initiator_token = NULL;
+ initiator_token = (rp_property_t *)neethi_assertion_get_value(assertion, env);
+ if(initiator_token)
+ {
+ rp_asymmetric_binding_set_initiator_token(asymmetric_binding, env, initiator_token);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_RECIPIENT_TOKEN)
+ {
+ rp_property_t *recipient_token = NULL;
+ recipient_token = (rp_property_t *)neethi_assertion_get_value(assertion, env);
+ if(recipient_token)
+ {
+ rp_asymmetric_binding_set_recipient_token(asymmetric_binding, env, recipient_token);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_ALGORITHM_SUITE)
+ {
+ rp_algorithmsuite_t *algorithmsuite = NULL;
+ algorithmsuite = (rp_algorithmsuite_t *)neethi_assertion_get_value(assertion, env);
+ if(algorithmsuite)
+ {
+ rp_binding_commons_set_algorithmsuite(commons, env, algorithmsuite);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_INCLUDE_TIMESTAMP)
+ {
+ rp_binding_commons_set_include_timestamp(commons, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_LAYOUT)
+ {
+ rp_layout_t *layout = NULL;
+ layout = (rp_layout_t *)neethi_assertion_get_value(assertion, env);
+ if(layout)
+ {
+ rp_binding_commons_set_layout(commons, env, layout);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_ENCRYPT_BEFORE_SIGNING)
+ {
+ rp_symmetric_asymmetric_binding_commons_set_protection_order(as_commons, env,
+ RP_ENCRYPT_BEFORE_SIGNING);
+ }
+ else if(type == ASSERTION_TYPE_SIGN_BEFORE_ENCRYPTING)
+ {
+ rp_symmetric_asymmetric_binding_commons_set_protection_order(as_commons, env,
+ RP_SIGN_BEFORE_ENCRYPTING);
+ }
+ else if(type == ASSERTION_TYPE_ENCRYPT_SIGNATURE)
+ {
+ rp_symmetric_asymmetric_binding_commons_set_signature_protection(as_commons, env,
+ AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_PROTECT_TOKENS)
+ {
+ rp_symmetric_asymmetric_binding_commons_set_token_protection(as_commons, env,
+ AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_ONLY_SIGN_ENTIRE_HEADERS_AND_BODY)
+ {
+ rp_symmetric_asymmetric_binding_commons_set_entire_headers_and_body_signatures(
+ as_commons, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_SUPPORTING_TOKENS)
+ {
+ rp_supporting_tokens_t *supporting_tokens = NULL;
+ supporting_tokens
+ = (rp_supporting_tokens_t *)neethi_assertion_get_value(assertion, env);
+ if(supporting_tokens)
+ {
+ rp_property_type_t type;
+ type = rp_supporting_tokens_get_type(supporting_tokens, env);
+ if(type == RP_PROPERTY_SIGNED_SUPPORTING_TOKEN)
+ {
+ rp_binding_commons_set_signed_supporting_tokens(commons, env, supporting_tokens);
+ }
+ else if(type == RP_PROPERTY_SIGNED_ENDORSING_SUPPORTING_TOKEN)
+ {
+ rp_binding_commons_set_signed_endorsing_supporting_tokens(commons, env,
+ supporting_tokens);
+ }
+ else if(type == RP_PROPERTY_SUPPORTING_SUPPORTING_TOKEN)
+ {
+ rp_binding_commons_set_supporting_tokens(commons, env, supporting_tokens);
+ }
+ else if(type == RP_PROPERTY_ENDORSING_SUPPORTING_TOKEN)
+ {
+ rp_binding_commons_set_endorsing_supporting_tokens(commons, env,
+ supporting_tokens);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ rp_symmetric_asymmetric_binding_commons_set_binding_commons(as_commons, env, commons);
+ rp_asymmetric_binding_set_symmetric_asymmetric_binding_commons(asymmetric_binding, env,
+ as_commons);
+
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/builder/bootstrap_policy_builder.c b/neethi/src/secpolicy/builder/bootstrap_policy_builder.c
new file mode 100644
index 0000000..df8c23e
--- /dev/null
+++ b/neethi/src/secpolicy/builder/bootstrap_policy_builder.c
@@ -0,0 +1,61 @@
+/*
+ * 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 <rp_bootstrap_policy_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_bootstrap_policy_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ neethi_policy_t *policy = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_element_t *child_element = NULL;
+ neethi_assertion_t *assertion = NULL;
+
+ child_node = axiom_node_get_first_element(node, env);
+ if(!child_node)
+ {
+ return NULL;
+ }
+
+ if(axiom_node_get_node_type(child_node, env) == AXIOM_ELEMENT)
+ {
+ child_element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+ if(child_element)
+ {
+ policy = neethi_engine_get_policy(env, child_node, child_element);
+ if(!policy)
+ {
+ return NULL;
+ }
+ assertion = neethi_assertion_create_with_args(env, NULL, /*this policy should not be deleted*/
+ policy, ASSERTION_TYPE_BOOTSTRAP_POLICY);
+ return assertion;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
diff --git a/neethi/src/secpolicy/builder/encryption_token_builder.c b/neethi/src/secpolicy/builder/encryption_token_builder.c
new file mode 100644
index 0000000..5896ac3
--- /dev/null
+++ b/neethi/src/secpolicy/builder/encryption_token_builder.c
@@ -0,0 +1,175 @@
+/*
+ * 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 <rp_encryption_token_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_assertion.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+/*private functions*/
+
+axis2_status_t AXIS2_CALL
+encryption_token_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_property_t *encryption_token);
+
+/***********************************/
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_encryption_token_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ rp_property_t *encryption_token = NULL;
+ neethi_policy_t *policy = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_element_t *child_element = NULL;
+ axutil_array_list_t *alternatives = NULL;
+ neethi_operator_t *component = NULL;
+ neethi_all_t *all = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_policy_t *normalized_policy = NULL;
+
+ encryption_token = rp_property_create(env);
+
+ child_node = axiom_node_get_first_element(node, env);
+ if(!child_node)
+ {
+ return NULL;
+ }
+
+ if(axiom_node_get_node_type(child_node, env) == AXIOM_ELEMENT)
+ {
+ child_element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+ if(child_element)
+ {
+ policy = neethi_engine_get_policy(env, child_node, child_element);
+ if(!policy)
+ {
+ return NULL;
+ }
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
+ component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
+ all = (neethi_all_t *)neethi_operator_get_value(component, env);
+ encryption_token_process_alternatives(env, all, encryption_token);
+
+ assertion = neethi_assertion_create_with_args(env,
+ (AXIS2_FREE_VOID_ARG)rp_property_free, encryption_token,
+ ASSERTION_TYPE_ENCRYPTION_TOKEN);
+
+ neethi_policy_free(normalized_policy, env);
+ normalized_policy = NULL;
+
+ return assertion;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
+
+axis2_status_t AXIS2_CALL
+encryption_token_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_property_t *encryption_token)
+{
+
+ neethi_operator_t *operator = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_assertion_type_t type;
+ void *value = NULL;
+
+ int i = 0;
+
+ arraylist = neethi_all_get_policy_components(all, env);
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ operator = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(operator, env);
+ value = neethi_assertion_get_value(assertion, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(value)
+ {
+ if(type == ASSERTION_TYPE_X509_TOKEN)
+ {
+ rp_x509_token_t *x509_token = NULL;
+ x509_token = (rp_x509_token_t *)neethi_assertion_get_value(assertion, env);
+ if(x509_token)
+ {
+ rp_property_set_value(encryption_token, env, x509_token, RP_PROPERTY_X509_TOKEN);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_ISSUED_TOKEN)
+ {
+ rp_issued_token_t *issued_token = NULL;
+ issued_token = (rp_issued_token_t *)neethi_assertion_get_value(assertion, env);
+ if(issued_token)
+ {
+ rp_property_set_value(encryption_token, env, issued_token,
+ RP_PROPERTY_ISSUED_TOKEN);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_SAML_TOKEN)
+ {
+ rp_saml_token_t *saml_token = NULL;
+ saml_token = (rp_saml_token_t *)neethi_assertion_get_value(assertion, env);
+ if(saml_token)
+ {
+ rp_property_set_value(encryption_token, env, saml_token, RP_PROPERTY_SAML_TOKEN);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_SECURITY_CONTEXT_TOKEN)
+ {
+ rp_security_context_token_t *security_context_token = NULL;
+ security_context_token = (rp_security_context_token_t *)neethi_assertion_get_value(
+ assertion, env);
+
+ if(security_context_token)
+ {
+ rp_property_set_value(encryption_token, env, security_context_token,
+ RP_PROPERTY_SECURITY_CONTEXT_TOKEN);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/builder/https_token_builder.c b/neethi/src/secpolicy/builder/https_token_builder.c
new file mode 100644
index 0000000..9406d19
--- /dev/null
+++ b/neethi/src/secpolicy/builder/https_token_builder.c
@@ -0,0 +1,56 @@
+/*
+ * 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 <rp_https_token_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_https_token_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ rp_https_token_t *https_token = NULL;
+ neethi_assertion_t *assertion = NULL;
+ axis2_char_t *value = NULL;
+
+ https_token = rp_https_token_create(env);
+
+ value = axiom_element_get_attribute_value_by_name(element, env, RP_REQUIRE_CLIENT_CERTIFICATE);
+
+ if(value)
+ {
+ if(axutil_strcmp(value, "true") == 0)
+ {
+ rp_https_token_set_require_client_certificate(https_token, env, AXIS2_TRUE);
+ }
+ else if(axutil_strcmp(value, "false") == 0)
+ {
+ rp_https_token_set_require_client_certificate(https_token, env, AXIS2_FALSE);
+ }
+ else
+ return NULL;
+ }
+
+ assertion = neethi_assertion_create_with_args(env, (AXIS2_FREE_VOID_ARG)rp_https_token_free,
+ https_token, ASSERTION_TYPE_HTTPS_TOKEN);
+ return assertion;
+}
diff --git a/neethi/src/secpolicy/builder/initiator_token_builder.c b/neethi/src/secpolicy/builder/initiator_token_builder.c
new file mode 100644
index 0000000..28b6497
--- /dev/null
+++ b/neethi/src/secpolicy/builder/initiator_token_builder.c
@@ -0,0 +1,138 @@
+/*
+ * 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 <rp_initiator_token_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_assertion.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+/*private functions*/
+
+axis2_status_t AXIS2_CALL
+initiator_token_process_alternatives(
+ const axutil_env_t * env,
+ neethi_all_t * all,
+ rp_property_t * initiator_token);
+
+/***********************************/
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_initiator_token_builder_build(
+ const axutil_env_t * env,
+ axiom_node_t * node,
+ axiom_element_t * element)
+{
+ rp_property_t *initiator_token = NULL;
+ neethi_policy_t *policy = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_element_t *child_element = NULL;
+ axutil_array_list_t *alternatives = NULL;
+ neethi_operator_t *component = NULL;
+ neethi_all_t *all = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_policy_t *normalized_policy = NULL;
+
+ initiator_token = rp_property_create(env);
+
+ child_node = axiom_node_get_first_element(node, env);
+ if(!child_node)
+ {
+ return NULL;
+ }
+
+ if(axiom_node_get_node_type(child_node, env) == AXIOM_ELEMENT)
+ {
+ child_element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+ if(child_element)
+ {
+ policy = neethi_engine_get_policy(env, child_node, child_element);
+ if(!policy)
+ {
+ return NULL;
+ }
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
+ component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
+ all = (neethi_all_t *)neethi_operator_get_value(component, env);
+ initiator_token_process_alternatives(env, all, initiator_token);
+
+ assertion = neethi_assertion_create_with_args(env,
+ (AXIS2_FREE_VOID_ARG)rp_property_free, initiator_token,
+ ASSERTION_TYPE_INITIATOR_TOKEN);
+
+ neethi_policy_free(normalized_policy, env);
+ normalized_policy = NULL;
+
+ return assertion;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
+
+axis2_status_t AXIS2_CALL
+initiator_token_process_alternatives(
+ const axutil_env_t * env,
+ neethi_all_t * all,
+ rp_property_t * initiator_token)
+{
+
+ neethi_operator_t *operator = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_assertion_type_t type;
+ void *value = NULL;
+
+ int i = 0;
+
+ arraylist = neethi_all_get_policy_components(all, env);
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ operator = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(operator, env);
+ value = neethi_assertion_get_value(assertion, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(value)
+ {
+ if(type == ASSERTION_TYPE_X509_TOKEN)
+ {
+ rp_x509_token_t *x509_token = NULL;
+ x509_token = (rp_x509_token_t *)neethi_assertion_get_value(assertion, env);
+ if(x509_token)
+ {
+ rp_property_set_value(initiator_token, env, x509_token, RP_PROPERTY_X509_TOKEN);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/builder/issued_token_builder.c b/neethi/src/secpolicy/builder/issued_token_builder.c
new file mode 100644
index 0000000..2cfc09f
--- /dev/null
+++ b/neethi/src/secpolicy/builder/issued_token_builder.c
@@ -0,0 +1,164 @@
+/*
+ * 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 <rp_issued_token_builder.h>
+
+AXIS2_EXTERN neethi_assertion_t * AXIS2_CALL
+rp_issued_token_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ rp_issued_token_t *issued_token = NULL;
+ neethi_policy_t *policy = NULL;
+ neethi_policy_t *normalized_policy = NULL;
+ neethi_all_t *all = NULL;
+ axutil_array_list_t *alternatives = NULL;
+ neethi_operator_t *component = NULL;
+ axis2_char_t *inclusion_value = NULL;
+ axutil_qname_t *qname = NULL;
+ axiom_node_t *issuer_node = NULL;
+ axiom_element_t *issuer_ele = NULL;
+ axiom_element_t *issuer_first_child_ele = NULL;
+ axiom_node_t *issuer_first_child_node = NULL;
+ axiom_node_t *req_sec_tok_template_node = NULL;
+ axiom_element_t *req_sec_tok_template_ele = NULL;
+ axiom_node_t *policy_node = NULL;
+ axiom_element_t *policy_ele = NULL;
+ neethi_assertion_t *assertion = NULL;
+
+ issued_token = rp_issued_token_create(env);
+ qname = axutil_qname_create(env, RP_INCLUDE_TOKEN, RP_SP_NS_11, RP_SP_PREFIX);
+ inclusion_value = axiom_element_get_attribute_value(element, env, qname);
+ axutil_qname_free(qname, env);
+ qname = NULL;
+
+ if(!inclusion_value)
+ {
+ /* we can try whether WS-SP1.2 specific inclusion value */
+ qname = axutil_qname_create(env, RP_INCLUDE_TOKEN, RP_SP_NS_12, RP_SP_PREFIX);
+ inclusion_value = axiom_element_get_attribute_value(element, env, qname);
+ axutil_qname_free(qname, env);
+ qname = NULL;
+ }
+
+ if(inclusion_value)
+ {
+ rp_issued_token_set_inclusion(issued_token, env, inclusion_value);
+ }
+
+ qname = axutil_qname_create(env, RP_ISSUER, RP_SP_NS_11, RP_SP_PREFIX);
+ issuer_ele = axiom_element_get_first_child_with_qname(element, env, qname, node, &issuer_node);
+ if(issuer_ele)
+ {
+ issuer_first_child_ele = axiom_element_get_first_element(issuer_ele, env, issuer_node,
+ &issuer_first_child_node);
+ if(issuer_first_child_ele)
+ {
+ rp_issued_token_set_issuer_epr(issued_token, env, issuer_first_child_node);
+ }
+ }
+ axutil_qname_free(qname, env);
+ qname = NULL;
+
+ qname = axutil_qname_create(env, RP_REQUEST_SEC_TOKEN_TEMPLATE, RP_SP_NS_11, RP_SP_PREFIX);
+ req_sec_tok_template_ele = axiom_element_get_first_child_with_qname(element, env, qname, node,
+ &req_sec_tok_template_node);
+ if(req_sec_tok_template_ele)
+ {
+ rp_issued_token_set_requested_sec_token_template(issued_token, env,
+ req_sec_tok_template_node);
+ }
+ else
+ {
+ return NULL;
+ }
+
+ axutil_qname_free(qname, env);
+ qname = NULL;
+
+ qname = axutil_qname_create(env, RP_POLICY, RP_POLICY_NS, RP_POLICY_PREFIX);
+ policy_ele = axiom_element_get_first_child_with_qname(element, env, qname, node, &policy_node);
+ if(policy_ele)
+ {
+ policy = neethi_engine_get_policy(env, policy_node, policy_ele);
+ if(!policy)
+ {
+ return NULL;
+ }
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
+ component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
+ all = (neethi_all_t *)neethi_operator_get_value(component, env);
+ if(AXIS2_FAILURE == rp_issued_token_builder_process_alternatives(env, all, issued_token))
+ return NULL;
+ assertion = neethi_assertion_create_with_args(env,
+ (AXIS2_FREE_VOID_ARG)rp_issued_token_free, issued_token, ASSERTION_TYPE_ISSUED_TOKEN);
+
+ neethi_policy_free(normalized_policy, env);
+ normalized_policy = NULL;
+
+ return assertion;
+ }
+
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, issued_token, ASSERTION_TYPE_ISSUED_TOKEN);
+
+ return assertion;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_issued_token_builder_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_issued_token_t *issued_token)
+{
+ neethi_operator_t *operator = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_assertion_type_t type;
+
+ int i = 0;
+
+ arraylist = neethi_all_get_policy_components(all, env);
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ operator = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(operator, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(type == ASSERTION_TYPE_REQUIRE_DERIVED_KEYS_SC10)
+ {
+ rp_issued_token_set_derivedkeys(issued_token, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_REQUIRE_EXTERNAL_REFERENCE)
+ {
+ rp_issued_token_set_require_exernal_reference(issued_token, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_REQUIRE_INTERNAL_REFERENCE)
+ {
+ rp_issued_token_set_require_internal_reference(issued_token, env, AXIS2_TRUE);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ return AXIS2_SUCCESS;
+}
+
diff --git a/neethi/src/secpolicy/builder/layout_builder.c b/neethi/src/secpolicy/builder/layout_builder.c
new file mode 100644
index 0000000..9be9ad9
--- /dev/null
+++ b/neethi/src/secpolicy/builder/layout_builder.c
@@ -0,0 +1,74 @@
+/*
+ * 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 <rp_layout_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_layout_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ rp_layout_t *layout = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_node_t *layout_node = NULL;
+ axiom_element_t *layout_element = NULL;
+ neethi_assertion_t *assertion = NULL;
+
+ layout = rp_layout_create(env);
+
+ child_node = axiom_node_get_first_element(node, env);
+
+ if(child_node)
+ {
+ layout_node = axiom_node_get_first_element(child_node, env);
+ if(!layout_node)
+ {
+ return NULL;
+ }
+ }
+ else
+ {
+ return NULL;
+ }
+
+ if(axiom_node_get_node_type(layout_node, env) == AXIOM_ELEMENT)
+ {
+ layout_element = (axiom_element_t *)axiom_node_get_data_element(layout_node, env);
+ if(layout_element)
+ {
+ axis2_char_t *local_name = NULL;
+
+ local_name = axiom_element_get_localname(layout_element, env);
+ if(!local_name)
+ return NULL;
+ rp_layout_set_value(layout, env, local_name);
+ assertion = neethi_assertion_create_with_args(env, (AXIS2_FREE_VOID_ARG)rp_layout_free,
+ layout, ASSERTION_TYPE_LAYOUT);
+ return assertion;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
diff --git a/neethi/src/secpolicy/builder/protection_token_builder.c b/neethi/src/secpolicy/builder/protection_token_builder.c
new file mode 100644
index 0000000..8ea02f2
--- /dev/null
+++ b/neethi/src/secpolicy/builder/protection_token_builder.c
@@ -0,0 +1,175 @@
+/*
+ * 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 <rp_protection_token_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_assertion.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+/*private functions*/
+
+axis2_status_t AXIS2_CALL
+protection_token_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_property_t *protection_token);
+
+/***********************************/
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_protection_token_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ rp_property_t *protection_token = NULL;
+ neethi_policy_t *policy = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_element_t *child_element = NULL;
+ axutil_array_list_t *alternatives = NULL;
+ neethi_operator_t *component = NULL;
+ neethi_all_t *all = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_policy_t *normalized_policy = NULL;
+
+ protection_token = rp_property_create(env);
+
+ child_node = axiom_node_get_first_element(node, env);
+ if(!child_node)
+ {
+ return NULL;
+ }
+
+ if(axiom_node_get_node_type(child_node, env) == AXIOM_ELEMENT)
+ {
+ child_element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+ if(child_element)
+ {
+ policy = neethi_engine_get_policy(env, child_node, child_element);
+ if(!policy)
+ {
+ return NULL;
+ }
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
+ component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
+ all = (neethi_all_t *)neethi_operator_get_value(component, env);
+ protection_token_process_alternatives(env, all, protection_token);
+
+ assertion = neethi_assertion_create_with_args(env,
+ (AXIS2_FREE_VOID_ARG)rp_property_free, protection_token,
+ ASSERTION_TYPE_PROTECTION_TOKEN);
+
+ neethi_policy_free(normalized_policy, env);
+ normalized_policy = NULL;
+
+ return assertion;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
+
+axis2_status_t AXIS2_CALL
+protection_token_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_property_t *protection_token)
+{
+
+ neethi_operator_t *operator = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_assertion_type_t type;
+ void *value = NULL;
+
+ int i = 0;
+
+ arraylist = neethi_all_get_policy_components(all, env);
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ operator = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(operator, env);
+ value = neethi_assertion_get_value(assertion, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(value)
+ {
+ if(type == ASSERTION_TYPE_X509_TOKEN)
+ {
+ rp_x509_token_t *x509_token = NULL;
+ x509_token = (rp_x509_token_t *)neethi_assertion_get_value(assertion, env);
+ if(x509_token)
+ {
+ rp_property_set_value(protection_token, env, x509_token, RP_PROPERTY_X509_TOKEN);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_ISSUED_TOKEN)
+ {
+ rp_issued_token_t *issued_token = NULL;
+ issued_token = (rp_issued_token_t *)neethi_assertion_get_value(assertion, env);
+ if(issued_token)
+ {
+ rp_property_set_value(protection_token, env, issued_token,
+ RP_PROPERTY_ISSUED_TOKEN);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_SAML_TOKEN)
+ {
+ rp_saml_token_t *saml_token = NULL;
+ saml_token = (rp_saml_token_t *)neethi_assertion_get_value(assertion, env);
+ if(saml_token)
+ {
+ rp_property_set_value(protection_token, env, saml_token, RP_PROPERTY_SAML_TOKEN);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_SECURITY_CONTEXT_TOKEN)
+ {
+ rp_security_context_token_t *security_context_token = NULL;
+ security_context_token = (rp_security_context_token_t *)neethi_assertion_get_value(
+ assertion, env);
+
+ if(security_context_token)
+ {
+ rp_property_set_value(protection_token, env, security_context_token,
+ RP_PROPERTY_SECURITY_CONTEXT_TOKEN);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/builder/rampart_config_builder.c b/neethi/src/secpolicy/builder/rampart_config_builder.c
new file mode 100644
index 0000000..1c569b3
--- /dev/null
+++ b/neethi/src/secpolicy/builder/rampart_config_builder.c
@@ -0,0 +1,213 @@
+/*
+ * 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 <rp_rampart_config_builder.h>
+
+/*private functions*/
+
+axis2_status_t AXIS2_CALL
+rp_rampart_config_builder_populate(
+ const axutil_env_t *env,
+ rp_rampart_config_t *rampart_config,
+ axiom_node_t *node,
+ axiom_element_t *element,
+ axis2_char_t *local_name);
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_rampart_config_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *config,
+ axiom_element_t *config_ele)
+{
+ rp_rampart_config_t *rampart_config = NULL;
+ axis2_status_t status = AXIS2_SUCCESS;
+ axiom_children_iterator_t *children_iter = NULL;
+ neethi_assertion_t *assertion = NULL;
+
+ rampart_config = rp_rampart_config_create(env);
+ if(!rampart_config)
+ {
+ return NULL;
+ }
+
+ children_iter = axiom_element_get_children(config_ele, env, config);
+ if(children_iter)
+ {
+ while(axiom_children_iterator_has_next(children_iter, env))
+ {
+ axiom_node_t *node = NULL;
+ axiom_element_t *ele = NULL;
+ axis2_char_t *local_name = NULL;
+ node = axiom_children_iterator_next(children_iter, env);
+ if(node)
+ {
+ if(axiom_node_get_node_type(node, env) == AXIOM_ELEMENT)
+ {
+ ele = (axiom_element_t *)axiom_node_get_data_element(node, env);
+ if(ele)
+ {
+ local_name = axiom_element_get_localname(ele, env);
+ if(local_name)
+ {
+ status = rp_rampart_config_builder_populate(env, rampart_config, node,
+ ele, local_name);
+ if(status != AXIS2_SUCCESS)
+ {
+ return NULL;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ assertion = neethi_assertion_create_with_args(env, (AXIS2_FREE_VOID_ARG)rp_rampart_config_free,
+ rampart_config, ASSERTION_TYPE_RAMPART_CONFIG);
+ return assertion;
+}
+
+axis2_status_t AXIS2_CALL
+rp_rampart_config_builder_populate(
+ const axutil_env_t *env,
+ rp_rampart_config_t *rampart_config,
+ axiom_node_t *node,
+ axiom_element_t *element,
+ axis2_char_t *local_name)
+{
+ axis2_char_t *ns = NULL;
+ axutil_qname_t *node_qname = NULL;
+
+ node_qname = axiom_element_get_qname(element, env, node);
+ if(!node_qname)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] Cannot get qname from element %s.",
+ local_name);
+ return AXIS2_FAILURE;
+ }
+
+ ns = axutil_qname_get_uri(node_qname, env);
+ if(!ns)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] Cannot get namespace from element %s.",
+ local_name);
+ return AXIS2_FAILURE;
+ }
+
+ if(!axutil_strcmp(ns, RP_RAMPART_NS))
+ {
+ if(!axutil_strcmp(local_name, RP_USER))
+ {
+ axis2_char_t *user = NULL;
+ user = axiom_element_get_text(element, env, node);
+ return rp_rampart_config_set_user(rampart_config, env, user);
+ }
+ else if(!axutil_strcmp(local_name, RP_ENCRYPTION_USER))
+ {
+ axis2_char_t *encryption_user = NULL;
+ encryption_user = axiom_element_get_text(element, env, node);
+ return rp_rampart_config_set_encryption_user(rampart_config, env, encryption_user);
+ }
+ else if(!axutil_strcmp(local_name, RP_PASSWORD_CALLBACK_CLASS))
+ {
+ axis2_char_t *password_callback_class = NULL;
+ password_callback_class = axiom_element_get_text(element, env, node);
+ return rp_rampart_config_set_password_callback_class(rampart_config, env,
+ password_callback_class);
+ }
+ else if(!axutil_strcmp(local_name, RP_AUTHN_MODULE_NAME))
+ {
+ axis2_char_t *authenticate_module = NULL;
+ authenticate_module = axiom_element_get_text(element, env, node);
+ return rp_rampart_config_set_authenticate_module(rampart_config, env,
+ authenticate_module);
+ }
+ else if(!axutil_strcmp(local_name, RP_RD_MODULE))
+ {
+ axis2_char_t *replay_detector = NULL;
+ replay_detector = axiom_element_get_text(element, env, node);
+ return rp_rampart_config_set_replay_detector(rampart_config, env, replay_detector);
+ }
+ else if(!axutil_strcmp(local_name, RP_SCT_MODULE))
+ {
+ axis2_char_t *sct_module = NULL;
+ sct_module = axiom_element_get_text(element, env, node);
+ return rp_rampart_config_set_sct_provider(rampart_config, env, sct_module);
+ }
+ else if(!axutil_strcmp(local_name, RP_PASSWORD_TYPE))
+ {
+ axis2_char_t *password_type = NULL;
+ password_type = axiom_element_get_text(element, env, node);
+ return rp_rampart_config_set_password_type(rampart_config, env, password_type);
+ }
+ else if(!axutil_strcmp(local_name, RP_CERTIFICATE))
+ {
+ axis2_char_t *certificate_file = NULL;
+ certificate_file = axiom_element_get_text(element, env, node);
+ return rp_rampart_config_set_certificate_file(rampart_config, env, certificate_file);
+ }
+ else if(!axutil_strcmp(local_name, RP_RECEIVER_CERTIFICATE))
+ {
+ axis2_char_t *receiver_certificate_file = NULL;
+ receiver_certificate_file = axiom_element_get_text(element, env, node);
+ return rp_rampart_config_set_receiver_certificate_file(rampart_config, env,
+ receiver_certificate_file);
+ }
+ else if(!axutil_strcmp(local_name, RP_PRIVATE_KEY))
+ {
+ axis2_char_t *private_key_file = NULL;
+ private_key_file = axiom_element_get_text(element, env, node);
+ return rp_rampart_config_set_private_key_file(rampart_config, env, private_key_file);
+ }
+ else if(!axutil_strcmp(local_name, RP_PKCS12_KEY_STORE))
+ {
+ axis2_char_t *pkcs12_key_store = NULL;
+ pkcs12_key_store = axiom_element_get_text(element, env, node);
+ return rp_rampart_config_set_pkcs12_file(rampart_config, env, pkcs12_key_store);
+ }
+ else if(!axutil_strcmp(local_name, RP_TIME_TO_LIVE))
+ {
+ axis2_char_t *time_to_live = NULL;
+ time_to_live = axiom_element_get_text(element, env, node);
+ return rp_rampart_config_set_time_to_live(rampart_config, env, time_to_live);
+ }
+ else if(!axutil_strcmp(local_name, RP_CLOCK_SKEW_BUFFER))
+ {
+ axis2_char_t *clock_skew_buffer = NULL;
+ clock_skew_buffer = axiom_element_get_text(element, env, node);
+ return rp_rampart_config_set_clock_skew_buffer(rampart_config, env, clock_skew_buffer);
+ }
+ else if(!axutil_strcmp(local_name, RP_NEED_MILLISECOND_PRECISION))
+ {
+ axis2_char_t *need_ms_precision = NULL;
+ need_ms_precision = axiom_element_get_text(element, env, node);
+ return rp_rampart_config_set_need_millisecond_precision(rampart_config, env,
+ need_ms_precision);
+ }
+ else if(!axutil_strcmp(local_name, RP_RD))
+ {
+ axis2_char_t *rd_val = NULL;
+ rd_val = axiom_element_get_text(element, env, node);
+ return rp_rampart_config_set_rd_val(rampart_config, env, rd_val);
+ }
+ }
+
+ /* either the assertion or the namespace is not identified */
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] Unknown Assertion %s with namespace %s",
+ local_name, ns);
+ return AXIS2_FAILURE;
+
+}
diff --git a/neethi/src/secpolicy/builder/recipient_token_builder.c b/neethi/src/secpolicy/builder/recipient_token_builder.c
new file mode 100644
index 0000000..d29537d
--- /dev/null
+++ b/neethi/src/secpolicy/builder/recipient_token_builder.c
@@ -0,0 +1,139 @@
+/*
+ * 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 <rp_recipient_token_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_assertion.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+/*private functions*/
+
+axis2_status_t AXIS2_CALL
+recipient_token_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_property_t *recipient_token);
+
+/***********************************/
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_recipient_token_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ rp_property_t *recipient_token = NULL;
+ neethi_policy_t *policy = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_element_t *child_element = NULL;
+ axutil_array_list_t *alternatives = NULL;
+ neethi_operator_t *component = NULL;
+ neethi_all_t *all = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_policy_t *normalized_policy = NULL;
+
+ recipient_token = rp_property_create(env);
+
+ child_node = axiom_node_get_first_element(node, env);
+
+ if(!child_node)
+ {
+ return NULL;
+ }
+
+ if(axiom_node_get_node_type(child_node, env) == AXIOM_ELEMENT)
+ {
+ child_element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+ if(child_element)
+ {
+ policy = neethi_engine_get_policy(env, child_node, child_element);
+ if(!policy)
+ {
+ return NULL;
+ }
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
+ component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
+ all = (neethi_all_t *)neethi_operator_get_value(component, env);
+ recipient_token_process_alternatives(env, all, recipient_token);
+
+ assertion = neethi_assertion_create_with_args(env,
+ (AXIS2_FREE_VOID_ARG)rp_property_free, recipient_token,
+ ASSERTION_TYPE_RECIPIENT_TOKEN);
+
+ neethi_policy_free(normalized_policy, env);
+ normalized_policy = NULL;
+
+ return assertion;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
+
+axis2_status_t AXIS2_CALL
+recipient_token_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_property_t *recipient_token)
+{
+
+ neethi_operator_t *operator = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_assertion_type_t type;
+ void *value = NULL;
+
+ int i = 0;
+
+ arraylist = neethi_all_get_policy_components(all, env);
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ operator = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(operator, env);
+ value = neethi_assertion_get_value(assertion, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(value)
+ {
+ if(type == ASSERTION_TYPE_X509_TOKEN)
+ {
+ rp_x509_token_t *x509_token = NULL;
+ x509_token = (rp_x509_token_t *)neethi_assertion_get_value(assertion, env);
+ if(x509_token)
+ {
+ rp_property_set_value(recipient_token, env, x509_token, RP_PROPERTY_X509_TOKEN);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/builder/saml_token_builder.c b/neethi/src/secpolicy/builder/saml_token_builder.c
new file mode 100644
index 0000000..6550d80
--- /dev/null
+++ b/neethi/src/secpolicy/builder/saml_token_builder.c
@@ -0,0 +1,155 @@
+/*
+ * 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 <rp_saml_token_builder.h>
+
+axis2_status_t AXIS2_CALL
+saml_token_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_saml_token_t *saml_token);
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_saml_token_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ rp_saml_token_t *saml_token = NULL;
+ axis2_char_t *inclusion_value = NULL;
+ neethi_policy_t *policy = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_element_t *child_element = NULL;
+ axutil_array_list_t *alternatives = NULL;
+ neethi_operator_t *component = NULL;
+ neethi_all_t *all = NULL;
+ axutil_qname_t *qname = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_policy_t *normalized_policy = NULL;
+
+ saml_token = rp_saml_token_create(env);
+ qname = axutil_qname_create(env, RP_INCLUDE_TOKEN, RP_SP_NS_11, RP_SP_PREFIX);
+ inclusion_value = axiom_element_get_attribute_value(element, env, qname);
+ axutil_qname_free(qname, env);
+ qname = NULL;
+
+ if(!inclusion_value)
+ {
+ /* we can try whether WS-SP1.2 specific inclusion value */
+ qname = axutil_qname_create(env, RP_INCLUDE_TOKEN, RP_SP_NS_12, RP_SP_PREFIX);
+ inclusion_value = axiom_element_get_attribute_value(element, env, qname);
+ axutil_qname_free(qname, env);
+ qname = NULL;
+ }
+
+ rp_saml_token_set_inclusion(saml_token, env, inclusion_value);
+
+ child_node = axiom_node_get_first_element(node, env);
+ if(!child_node)
+ {
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, saml_token, ASSERTION_TYPE_SAML_TOKEN);
+ return assertion;
+ }
+ if(axiom_node_get_node_type(child_node, env) == AXIOM_ELEMENT)
+ {
+ child_element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+ if(child_element)
+ {
+ policy = neethi_engine_get_policy(env, child_node, child_element);
+ if(!policy)
+ {
+ return NULL;
+ }
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
+ component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
+ all = (neethi_all_t *)neethi_operator_get_value(component, env);
+ saml_token_process_alternatives(env, all, saml_token);
+
+ assertion = neethi_assertion_create_with_args(env,
+ (AXIS2_FREE_VOID_ARG)rp_saml_token_free, saml_token, ASSERTION_TYPE_SAML_TOKEN);
+
+ neethi_policy_free(normalized_policy, env);
+ normalized_policy = NULL;
+
+ return assertion;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
+
+axis2_status_t AXIS2_CALL
+saml_token_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_saml_token_t *saml_token)
+{
+ neethi_operator_t *operator = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_assertion_type_t type;
+
+ int i = 0;
+
+ arraylist = neethi_all_get_policy_components(all, env);
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ operator = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(operator, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(type == ASSERTION_TYPE_REQUIRE_DERIVED_KEYS_SC10)
+ {
+ rp_saml_token_set_derivedkeys(saml_token, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_REQUIRE_KEY_IDENTIFIRE_REFERENCE)
+ {
+ rp_saml_token_set_require_key_identifier_reference(saml_token, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_WSS_SAML_V10_TOKEN_V10)
+ {
+ rp_saml_token_set_token_version_and_type(saml_token, env, RP_WSS_SAML_V10_TOKEN_V10);
+ }
+ else if(type == ASSERTION_TYPE_WSS_SAML_V10_TOKEN_V11)
+ {
+ rp_saml_token_set_token_version_and_type(saml_token, env, RP_WSS_SAML_V10_TOKEN_V11);
+ }
+ else if(type == ASSERTION_TYPE_WSS_SAML_V11_TOKEN_V10)
+ {
+ rp_saml_token_set_token_version_and_type(saml_token, env, RP_WSS_SAML_V11_TOKEN_V10);
+ }
+ else if(type == ASSERTION_TYPE_WSS_SAML_V11_TOKEN_V11)
+ {
+ rp_saml_token_set_token_version_and_type(saml_token, env, RP_WSS_SAML_V11_TOKEN_V11);
+ }
+ else if(type == ASSERTION_TYPE_WSS_SAML_V20_TOKEN_V11)
+ {
+ rp_saml_token_set_token_version_and_type(saml_token, env, RP_WSS_SAML_V20_TOKEN_V11);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ return AXIS2_SUCCESS;
+}
+
diff --git a/neethi/src/secpolicy/builder/secpolicy_builder.c b/neethi/src/secpolicy/builder/secpolicy_builder.c
new file mode 100644
index 0000000..8548403
--- /dev/null
+++ b/neethi/src/secpolicy/builder/secpolicy_builder.c
@@ -0,0 +1,241 @@
+/*
+ * 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 <rp_secpolicy_builder.h>
+#include <neethi_operator.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+#include <neethi_assertion.h>
+
+/*private functions*/
+
+axis2_status_t AXIS2_CALL
+secpolicy_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_secpolicy_t *secpolicy);
+
+/***********************************/
+
+AXIS2_EXTERN rp_secpolicy_t *AXIS2_CALL
+rp_secpolicy_builder_build(
+ const axutil_env_t *env,
+ neethi_policy_t *policy)
+{
+ axutil_array_list_t *alternatives = NULL;
+ neethi_operator_t *component = NULL;
+ neethi_all_t *all = NULL;
+ rp_secpolicy_t *secpolicy = NULL;
+
+ secpolicy = rp_secpolicy_create(env);
+
+ alternatives = neethi_policy_get_alternatives(policy, env);
+
+ component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
+ all = (neethi_all_t *)neethi_operator_get_value(component, env);
+
+ if(secpolicy_process_alternatives(env, all, secpolicy) == AXIS2_FAILURE)
+ {
+ return NULL;
+ }
+ return secpolicy;
+}
+
+axis2_status_t AXIS2_CALL
+secpolicy_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_secpolicy_t *secpolicy)
+{
+
+ neethi_operator_t *operator = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_assertion_type_t type;
+ void *value = NULL;
+
+ int i = 0;
+
+ arraylist = neethi_all_get_policy_components(all, env);
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ operator = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(operator, env);
+ value = neethi_assertion_get_value(assertion, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(value)
+ {
+ if(type == ASSERTION_TYPE_TRANSPORT_BINDING)
+ {
+ rp_property_t *binding = NULL;
+ rp_transport_binding_t *transport_binding = NULL;
+
+ transport_binding = (rp_transport_binding_t *)neethi_assertion_get_value(assertion,
+ env);
+ if(!transport_binding)
+ {
+ return AXIS2_FAILURE;
+ }
+ binding = rp_property_create(env);
+ rp_property_set_value(binding, env, transport_binding,
+ RP_PROPERTY_TRANSPORT_BINDING);
+ rp_secpolicy_set_binding(secpolicy, env, binding);
+ }
+ else if(type == ASSERTION_TYPE_ASSYMMETRIC_BINDING)
+ {
+ rp_property_t *binding = NULL;
+ rp_asymmetric_binding_t *asymmetric_binding = NULL;
+
+ asymmetric_binding = (rp_asymmetric_binding_t *)neethi_assertion_get_value(
+ assertion, env);
+ if(!asymmetric_binding)
+ {
+ return AXIS2_FAILURE;
+ }
+ binding = rp_property_create(env);
+ rp_property_set_value(binding, env, asymmetric_binding,
+ RP_PROPERTY_ASYMMETRIC_BINDING);
+ rp_secpolicy_set_binding(secpolicy, env, binding);
+ }
+ else if(type == ASSERTION_TYPE_SYMMETRIC_BINDING)
+ {
+ rp_property_t *binding = NULL;
+ rp_symmetric_binding_t *symmetric_binding = NULL;
+
+ symmetric_binding = (rp_symmetric_binding_t *)neethi_assertion_get_value(assertion,
+ env);
+ if(!symmetric_binding)
+ {
+ return AXIS2_FAILURE;
+ }
+ binding = rp_property_create(env);
+ rp_property_set_value(binding, env, symmetric_binding,
+ RP_PROPERTY_SYMMETRIC_BINDING);
+ rp_secpolicy_set_binding(secpolicy, env, binding);
+ }
+ else if(type == ASSERTION_TYPE_SUPPORTING_TOKENS)
+ {
+ rp_supporting_tokens_t *supporting_tokens = NULL;
+ supporting_tokens = (rp_supporting_tokens_t *)neethi_assertion_get_value(assertion,
+ env);
+ if(supporting_tokens)
+ {
+ rp_property_type_t type;
+ type = rp_supporting_tokens_get_type(supporting_tokens, env);
+ if(type == RP_PROPERTY_SIGNED_SUPPORTING_TOKEN)
+ {
+ rp_secpolicy_set_signed_supporting_tokens(secpolicy, env, supporting_tokens);
+ }
+ else if(type == RP_PROPERTY_SIGNED_ENDORSING_SUPPORTING_TOKEN)
+ {
+ rp_secpolicy_set_signed_endorsing_supporting_tokens(secpolicy, env,
+ supporting_tokens);
+ }
+ else if(type == RP_PROPERTY_SUPPORTING_SUPPORTING_TOKEN)
+ {
+ rp_secpolicy_set_supporting_tokens(secpolicy, env, supporting_tokens);
+ }
+ else if(type == RP_PROPERTY_ENDORSING_SUPPORTING_TOKEN)
+ {
+ rp_secpolicy_set_endorsing_supporting_tokens(secpolicy, env,
+ supporting_tokens);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_WSS10)
+ {
+ rp_wss10_t *wss10 = NULL;
+ rp_property_t *wss = NULL;
+ wss10 = (rp_wss10_t *)neethi_assertion_get_value(assertion, env);
+ if(!wss10)
+ {
+ return AXIS2_FAILURE;
+ }
+ wss = rp_property_create(env);
+ rp_property_set_value(wss, env, wss10, RP_PROPERTY_WSS10);
+ rp_secpolicy_set_wss(secpolicy, env, wss);
+ }
+ else if(type == ASSERTION_TYPE_WSS11)
+ {
+ rp_wss11_t *wss11 = NULL;
+ rp_property_t *wss = NULL;
+ wss11 = (rp_wss11_t *)neethi_assertion_get_value(assertion, env);
+ if(!wss11)
+ {
+ return AXIS2_FAILURE;
+ }
+ wss = rp_property_create(env);
+ rp_property_set_value(wss, env, wss11, RP_PROPERTY_WSS11);
+ rp_secpolicy_set_wss(secpolicy, env, wss);
+ }
+ else if(type == ASSERTION_TYPE_TRUST10)
+ {
+ rp_trust10_t *trust10 = NULL;
+ trust10 = (rp_trust10_t *)neethi_assertion_get_value(assertion, env);
+ if(!trust10)
+ {
+ return AXIS2_FAILURE;
+ }
+ rp_secpolicy_set_trust10(secpolicy, env, trust10);
+ }
+ else if(type == ASSERTION_TYPE_SIGNED_ENCRYPTED_PARTS)
+ {
+ rp_signed_encrypted_parts_t *signed_encrypted_parts = NULL;
+ signed_encrypted_parts = (rp_signed_encrypted_parts_t *)neethi_assertion_get_value(
+ assertion, env);
+ if(signed_encrypted_parts)
+ {
+ if(rp_signed_encrypted_parts_get_signedparts(signed_encrypted_parts, env))
+ {
+ rp_secpolicy_set_signed_parts(secpolicy, env, signed_encrypted_parts);
+ }
+ else
+ {
+ rp_secpolicy_set_encrypted_parts(secpolicy, env, signed_encrypted_parts);
+ }
+ }
+ else
+ return AXIS2_FAILURE;
+
+ }
+ else if(type == ASSERTION_TYPE_RAMPART_CONFIG)
+ {
+ rp_rampart_config_t *rampart_config = NULL;
+ rampart_config = (rp_rampart_config_t *)neethi_assertion_get_value(assertion, env);
+ if(!rampart_config)
+ {
+ return AXIS2_FAILURE;
+ }
+ rp_secpolicy_set_rampart_config(secpolicy, env, rampart_config);
+ }
+ else
+ {
+ continue;
+ }
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/builder/security_context_token_builder.c b/neethi/src/secpolicy/builder/security_context_token_builder.c
new file mode 100644
index 0000000..b4ad8e8
--- /dev/null
+++ b/neethi/src/secpolicy/builder/security_context_token_builder.c
@@ -0,0 +1,231 @@
+/*
+ * 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 <rp_security_context_token_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+/*private functions*/
+
+axis2_status_t AXIS2_CALL
+security_context_token_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_security_context_token_t * security_context_token);
+
+/***********************************/
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_security_context_token_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element,
+ axis2_char_t *sp_ns_uri,
+ axis2_bool_t is_secure_conversation_token)
+{
+ rp_security_context_token_t *security_context_token = NULL;
+ neethi_policy_t *policy = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_element_t *child_element = NULL;
+ axiom_children_iterator_t *children_iter = NULL;
+ axutil_array_list_t *alternatives = NULL;
+ neethi_operator_t *component = NULL;
+ neethi_all_t *all = NULL;
+ axis2_char_t *inclusion_value = NULL;
+ axutil_qname_t *qname = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_policy_t *normalized_policy = NULL;
+
+ security_context_token = rp_security_context_token_create(env);
+ qname = axutil_qname_create(env, RP_INCLUDE_TOKEN, sp_ns_uri, RP_SP_PREFIX);
+ inclusion_value = axiom_element_get_attribute_value(element, env, qname);
+ axutil_qname_free(qname, env);
+ qname = NULL;
+
+ rp_security_context_token_set_inclusion(security_context_token, env, inclusion_value);
+ rp_security_context_token_set_is_secure_conversation_token(security_context_token, env,
+ is_secure_conversation_token);
+
+ if(!axutil_strcmp(sp_ns_uri, RP_SP_NS_11))
+ {
+ rp_security_context_token_set_sc10_security_context_token(security_context_token, env,
+ AXIS2_TRUE);
+ }
+ else
+ {
+ rp_security_context_token_set_sc10_security_context_token(security_context_token, env,
+ AXIS2_FALSE);
+ }
+
+ child_node = axiom_node_get_first_element(node, env);
+ if(!child_node)
+ {
+ return NULL;
+ }
+
+ children_iter = axiom_element_get_children(element, env, node);
+ if(children_iter)
+ {
+ while(axiom_children_iterator_has_next(children_iter, env))
+ {
+ child_node = axiom_children_iterator_next(children_iter, env);
+ if(child_node)
+ {
+ if(axiom_node_get_node_type(child_node, env) == AXIOM_ELEMENT)
+ {
+ child_element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+ if(child_element)
+ {
+ axis2_char_t *localname = NULL;
+ localname = axiom_element_get_localname(child_element, env);
+ if(axutil_strcmp(localname, RP_ISSUER) == 0)
+ {
+ axis2_char_t *ns = NULL;
+ axutil_qname_t *node_qname = NULL;
+
+ node_qname = axiom_element_get_qname(child_element, env, child_node);
+ if(!node_qname)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Cannot get qname from element %s.", localname);
+ return NULL;
+ }
+
+ ns = axutil_qname_get_uri(node_qname, env);
+ if(!ns)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Cannot get namespace from element %s.", localname);
+ return NULL;
+ }
+ if(!(axutil_strcmp(ns, RP_SP_NS_11) && axutil_strcmp(ns, RP_SP_NS_12)))
+ {
+ axis2_char_t *issuer = NULL;
+ issuer = axiom_element_get_text(child_element, env, child_node);
+ rp_security_context_token_set_issuer(security_context_token, env,
+ issuer);
+ }
+ else
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Unknown Assertion %s with namespace %s", localname,
+ ns);
+ return NULL;
+ }
+ }
+ else
+ {
+ policy = neethi_engine_get_policy(env, child_node, child_element);
+ if(!policy)
+ {
+ return NULL;
+ }
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE,
+ policy);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
+ component = (neethi_operator_t *)axutil_array_list_get(alternatives,
+ env, 0);
+ all = (neethi_all_t *)neethi_operator_get_value(component, env);
+ security_context_token_process_alternatives(env, all,
+ security_context_token);
+
+ assertion = neethi_assertion_create_with_args(env,
+ (AXIS2_FREE_VOID_ARG)rp_security_context_token_free,
+ security_context_token, ASSERTION_TYPE_SECURITY_CONTEXT_TOKEN);
+
+ neethi_policy_free(normalized_policy, env);
+ normalized_policy = NULL;
+ }
+ }
+ }
+ }
+ }
+ }
+ return assertion;
+}
+
+axis2_status_t AXIS2_CALL
+security_context_token_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_security_context_token_t * security_context_token)
+{
+ neethi_operator_t *operator = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_assertion_type_t type;
+
+ int i = 0;
+
+ arraylist = neethi_all_get_policy_components(all, env);
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ operator = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(operator, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(type == ASSERTION_TYPE_REQUIRE_DERIVED_KEYS_SC10)
+ {
+ rp_security_context_token_set_derivedkey(security_context_token, env, DERIVEKEY_NEEDED);
+ rp_security_context_token_set_derivedkey_version(security_context_token, env,
+ DERIVEKEY_VERSION_SC10);
+ }
+ else if(type == ASSERTION_TYPE_REQUIRE_DERIVED_KEYS_SC13)
+ {
+ rp_security_context_token_set_derivedkey(security_context_token, env, DERIVEKEY_NEEDED);
+ rp_security_context_token_set_derivedkey_version(security_context_token, env,
+ DERIVEKEY_VERSION_SC13);
+ }
+ else if(type == ASSERTION_TYPE_REQUIRE_EXTERNAL_URI)
+ {
+ rp_security_context_token_set_require_external_uri_ref(security_context_token, env,
+ AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_SC10_SECURITY_CONTEXT_TOKEN)
+ {
+ rp_security_context_token_set_sc10_security_context_token(security_context_token, env,
+ AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_SC13_SECURITY_CONTEXT_TOKEN)
+ {
+ rp_security_context_token_set_sc10_security_context_token(security_context_token, env,
+ AXIS2_FALSE);
+ }
+ else if(type == ASSERTION_TYPE_ISSUER)
+ {
+ axis2_char_t *issuer = NULL;
+ issuer = (axis2_char_t *)neethi_assertion_get_value(assertion, env);
+ rp_security_context_token_set_issuer(security_context_token, env, issuer);
+ }
+ else if(type == ASSERTION_TYPE_BOOTSTRAP_POLICY)
+ {
+ neethi_policy_t *bootstrap_policy = NULL;
+ bootstrap_policy = (neethi_policy_t *)neethi_assertion_get_value(assertion, env);
+ rp_security_context_token_set_bootstrap_policy(security_context_token, env,
+ bootstrap_policy);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/builder/signature_token_builder.c b/neethi/src/secpolicy/builder/signature_token_builder.c
new file mode 100644
index 0000000..0c1c0c7
--- /dev/null
+++ b/neethi/src/secpolicy/builder/signature_token_builder.c
@@ -0,0 +1,175 @@
+/*
+ * 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 <rp_signature_token_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_assertion.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+/*private functions*/
+
+axis2_status_t AXIS2_CALL
+signature_token_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_property_t *signature_token);
+
+/***********************************/
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_signature_token_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ rp_property_t *signature_token = NULL;
+ neethi_policy_t *policy = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_element_t *child_element = NULL;
+ axutil_array_list_t *alternatives = NULL;
+ neethi_operator_t *component = NULL;
+ neethi_all_t *all = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_policy_t *normalized_policy = NULL;
+
+ signature_token = rp_property_create(env);
+
+ child_node = axiom_node_get_first_element(node, env);
+ if(!child_node)
+ {
+ return NULL;
+ }
+
+ if(axiom_node_get_node_type(child_node, env) == AXIOM_ELEMENT)
+ {
+ child_element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+ if(child_element)
+ {
+ policy = neethi_engine_get_policy(env, child_node, child_element);
+ if(!policy)
+ {
+ return NULL;
+ }
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
+ component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
+ all = (neethi_all_t *)neethi_operator_get_value(component, env);
+ signature_token_process_alternatives(env, all, signature_token);
+
+ assertion = neethi_assertion_create_with_args(env,
+ (AXIS2_FREE_VOID_ARG)rp_property_free, signature_token,
+ ASSERTION_TYPE_SIGNATURE_TOKEN);
+
+ neethi_policy_free(normalized_policy, env);
+ normalized_policy = NULL;
+
+ return assertion;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
+
+axis2_status_t AXIS2_CALL
+signature_token_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_property_t *signature_token)
+{
+
+ neethi_operator_t *operator = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_assertion_type_t type;
+ void *value = NULL;
+
+ int i = 0;
+
+ arraylist = neethi_all_get_policy_components(all, env);
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ operator = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(operator, env);
+ value = neethi_assertion_get_value(assertion, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(value)
+ {
+ if(type == ASSERTION_TYPE_X509_TOKEN)
+ {
+ rp_x509_token_t *x509_token = NULL;
+ x509_token = (rp_x509_token_t *)neethi_assertion_get_value(assertion, env);
+ if(x509_token)
+ {
+ rp_property_set_value(signature_token, env, x509_token, RP_PROPERTY_X509_TOKEN);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_ISSUED_TOKEN)
+ {
+ rp_issued_token_t *issued_token = NULL;
+ issued_token = (rp_issued_token_t *)neethi_assertion_get_value(assertion, env);
+ if(issued_token)
+ {
+ rp_property_set_value(signature_token, env, issued_token,
+ RP_PROPERTY_ISSUED_TOKEN);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_SAML_TOKEN)
+ {
+ rp_saml_token_t *saml_token = NULL;
+ saml_token = (rp_saml_token_t *)neethi_assertion_get_value(assertion, env);
+ if(saml_token)
+ {
+ rp_property_set_value(signature_token, env, saml_token, RP_PROPERTY_SAML_TOKEN);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_SECURITY_CONTEXT_TOKEN)
+ {
+ rp_security_context_token_t *security_context_token = NULL;
+ security_context_token = (rp_security_context_token_t *)neethi_assertion_get_value(
+ assertion, env);
+
+ if(security_context_token)
+ {
+ rp_property_set_value(signature_token, env, security_context_token,
+ RP_PROPERTY_SECURITY_CONTEXT_TOKEN);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/builder/signed_encrypted_parts_builder.c b/neethi/src/secpolicy/builder/signed_encrypted_parts_builder.c
new file mode 100644
index 0000000..be5008e
--- /dev/null
+++ b/neethi/src/secpolicy/builder/signed_encrypted_parts_builder.c
@@ -0,0 +1,209 @@
+/*
+ * 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 <rp_signed_encrypted_parts_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+static rp_header_t *AXIS2_CALL
+rp_signed_encrypted_parts_builder_build_header(
+ axiom_element_t *element,
+ const axutil_env_t *env);
+
+static axis2_status_t AXIS2_CALL
+rp_signed_encrypted_parts_builder_set_properties(
+ axiom_node_t *node,
+ axiom_element_t *element,
+ axis2_char_t *local_name,
+ rp_signed_encrypted_parts_t *signed_encrypted_parts,
+ const axutil_env_t *env);
+
+/**
+ * Builts EncryptedParts or SignedParts assertion
+ * @param env Pointer to environment struct
+ * @param node Assertion node
+ * @param element Assertion element
+ * @param is_signed boolean showing whether signing or encryption
+ * @returns neethi assertion created. NULL if failure.
+ */
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_signed_encrypted_parts_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *parts,
+ axiom_element_t *parts_ele,
+ axis2_bool_t is_signed)
+{
+ rp_signed_encrypted_parts_t *signed_encrypted_parts = NULL;
+ axiom_children_iterator_t *children_iter = NULL;
+ neethi_assertion_t *assertion = NULL;
+ axis2_status_t status = AXIS2_SUCCESS;
+
+ signed_encrypted_parts = rp_signed_encrypted_parts_create(env);
+ if(!signed_encrypted_parts)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] Cannot create signed_encrypted_parts.");
+ return NULL;
+ }
+
+ rp_signed_encrypted_parts_set_signedparts(signed_encrypted_parts, env, is_signed);
+
+ children_iter = axiom_element_get_children(parts_ele, env, parts);
+ if(children_iter)
+ {
+ while(axiom_children_iterator_has_next(children_iter, env))
+ {
+ axiom_node_t *node = NULL;
+ axiom_element_t *ele = NULL;
+ axis2_char_t *local_name = NULL;
+ node = axiom_children_iterator_next(children_iter, env);
+ if(node)
+ {
+ if(axiom_node_get_node_type(node, env) == AXIOM_ELEMENT)
+ {
+ ele = (axiom_element_t *)axiom_node_get_data_element(node, env);
+ if(ele)
+ {
+ local_name = axiom_element_get_localname(ele, env);
+ if(local_name)
+ {
+ status = rp_signed_encrypted_parts_builder_set_properties(node, ele,
+ local_name, signed_encrypted_parts, env);
+ if(status != AXIS2_SUCCESS)
+ {
+ rp_signed_encrypted_parts_free(signed_encrypted_parts, env);
+ signed_encrypted_parts = NULL;
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Cannot create signed_encrypted_parts. "
+ "Error in processing child element %s", local_name);
+ return NULL;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ assertion = neethi_assertion_create_with_args(env,
+ (AXIS2_FREE_VOID_ARG)rp_signed_encrypted_parts_free, signed_encrypted_parts,
+ ASSERTION_TYPE_SIGNED_ENCRYPTED_PARTS);
+ return assertion;
+}
+
+static axis2_status_t AXIS2_CALL
+rp_signed_encrypted_parts_builder_set_properties(
+ axiom_node_t *node,
+ axiom_element_t *element,
+ axis2_char_t *local_name,
+ rp_signed_encrypted_parts_t * signed_encrypted_parts,
+ const axutil_env_t *env)
+{
+ axis2_char_t *ns = NULL;
+ axutil_qname_t *node_qname = NULL;
+
+ node_qname = axiom_element_get_qname(element, env, node);
+ if(!node_qname)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] Cannot get qname from element %s.",
+ local_name);
+ return AXIS2_FAILURE;
+ }
+
+ ns = axutil_qname_get_uri(node_qname, env);
+ if(!ns)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] Cannot get namespace from element %s.",
+ local_name);
+ return AXIS2_FAILURE;
+ }
+
+ /* process assertions common for WS-SecPolicy 1.1 and 1.2 */
+ if(!(axutil_strcmp(ns, RP_SP_NS_11) && axutil_strcmp(ns, RP_SP_NS_12)))
+ {
+ /* this assertion is in WS-SecurityPolicy namespace */
+ if(!strcmp(local_name, RP_BODY))
+ {
+ rp_signed_encrypted_parts_set_body(signed_encrypted_parts, env, AXIS2_TRUE);
+ return AXIS2_SUCCESS;
+ }
+ else if(!strcmp(local_name, RP_HEADER))
+ {
+ rp_header_t *header = NULL;
+ header = rp_signed_encrypted_parts_builder_build_header(element, env);
+ if(!header)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Failed to process Header Assertion.");
+ return AXIS2_FAILURE;
+ }
+
+ return rp_signed_encrypted_parts_add_header(signed_encrypted_parts, env, header);
+ }
+ }
+
+ /* process assertions specific to WS-SecPolicy 1.2 */
+ if(!axutil_strcmp(ns, RP_SP_NS_12))
+ {
+ if(!strcmp(local_name, RP_ATTACHMENTS))
+ {
+ rp_signed_encrypted_parts_set_attachments(signed_encrypted_parts, env, AXIS2_TRUE);
+ return AXIS2_SUCCESS;
+ }
+ }
+
+ /* either namespace or assertion is not understood */
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] Unknown Assertion %s with namespace %s",
+ local_name, ns);
+ return AXIS2_FAILURE;
+}
+
+static rp_header_t *AXIS2_CALL
+rp_signed_encrypted_parts_builder_build_header(
+ axiom_element_t *element,
+ const axutil_env_t *env)
+{
+ rp_header_t *header = NULL;
+ axis2_char_t *name = NULL;
+ axis2_char_t *nspace = NULL;
+
+ name = axiom_element_get_attribute_value_by_name(element, env, RP_NAME);
+ nspace = axiom_element_get_attribute_value_by_name(element, env, RP_NAMESPACE);
+ if(!nspace)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Header assertion should have namespace associated with it.");
+ return NULL;
+ }
+
+ header = rp_header_create(env);
+ if(!header)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Cannot create rp_header structure. Insufficient memory.");
+ return NULL;
+ }
+
+ if(name)
+ {
+ rp_header_set_name(header, env, name);
+ }
+
+ rp_header_set_namespace(header, env, nspace);
+ return header;
+}
diff --git a/neethi/src/secpolicy/builder/supporting_tokens_builder.c b/neethi/src/secpolicy/builder/supporting_tokens_builder.c
new file mode 100644
index 0000000..7482144
--- /dev/null
+++ b/neethi/src/secpolicy/builder/supporting_tokens_builder.c
@@ -0,0 +1,203 @@
+/*
+ * 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 <rp_supporting_tokens_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+/*private functions*/
+
+axis2_status_t AXIS2_CALL
+supporting_tokens_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_supporting_tokens_t *supporting_tokens);
+
+axis2_bool_t AXIS2_CALL
+is_token_assertion(
+ const axutil_env_t *env,
+ neethi_assertion_type_t type);
+
+/***********************************/
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_supporting_tokens_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ rp_supporting_tokens_t *supporting_tokens = NULL;
+ neethi_policy_t *policy = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_element_t *child_element = NULL;
+ axutil_array_list_t *alternatives = NULL;
+ neethi_operator_t *component = NULL;
+ neethi_all_t *all = NULL;
+ neethi_assertion_t *assertion = NULL;
+ axis2_char_t *local_name = NULL;
+ neethi_policy_t *normalized_policy = NULL;
+
+ supporting_tokens = rp_supporting_tokens_create(env);
+ local_name = axiom_element_get_localname(element, env);
+
+ if(local_name)
+ {
+ if(axutil_strcmp(local_name, RP_SIGNED_SUPPORTING_TOKENS) == 0)
+ {
+ rp_supporting_tokens_set_type(supporting_tokens, env,
+ RP_PROPERTY_SIGNED_SUPPORTING_TOKEN);
+ }
+ else if(axutil_strcmp(local_name, RP_SIGNED_ENDORSING_SUPPORTING_TOKENS) == 0)
+ {
+ rp_supporting_tokens_set_type(supporting_tokens, env,
+ RP_PROPERTY_SIGNED_ENDORSING_SUPPORTING_TOKEN);
+ }
+ else if(axutil_strcmp(local_name, RP_SUPPORTING_TOKENS) == 0)
+ {
+ rp_supporting_tokens_set_type(supporting_tokens, env,
+ RP_PROPERTY_SUPPORTING_SUPPORTING_TOKEN);
+ }
+ else if(axutil_strcmp(local_name, RP_ENDORSING_SUPPORTING_TOKENS) == 0)
+ {
+ rp_supporting_tokens_set_type(supporting_tokens, env,
+ RP_PROPERTY_ENDORSING_SUPPORTING_TOKEN);
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+
+ child_node = axiom_node_get_first_element(node, env);
+ if(!child_node)
+ {
+ return NULL;
+ }
+
+ if(axiom_node_get_node_type(child_node, env) == AXIOM_ELEMENT)
+ {
+ child_element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+ if(child_element)
+ {
+ policy = neethi_engine_get_policy(env, child_node, child_element);
+ if(!policy)
+ {
+ return NULL;
+ }
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
+ all = (neethi_all_t *)neethi_operator_get_value(component, env);
+ supporting_tokens_process_alternatives(env, all, supporting_tokens);
+
+ assertion = neethi_assertion_create_with_args(env,
+ (AXIS2_FREE_VOID_ARG)rp_supporting_tokens_free, supporting_tokens,
+ ASSERTION_TYPE_SUPPORTING_TOKENS);
+
+ neethi_policy_free(normalized_policy, env);
+ normalized_policy = NULL;
+
+ return assertion;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
+
+axis2_status_t AXIS2_CALL
+supporting_tokens_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_supporting_tokens_t *supporting_tokens)
+{
+ neethi_operator_t *operator = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_assertion_type_t type;
+ void *value = NULL;
+
+ int i = 0;
+
+ arraylist = neethi_all_get_policy_components(all, env);
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ operator = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(operator, env);
+ value = neethi_assertion_get_value(assertion, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(value)
+ {
+ if(type == ASSERTION_TYPE_ALGORITHM_SUITE)
+ {
+ rp_algorithmsuite_t *algorithmsuite = NULL;
+ algorithmsuite = (rp_algorithmsuite_t *)neethi_assertion_get_value(assertion, env);
+ if(algorithmsuite)
+ {
+ rp_supporting_tokens_set_algorithmsuite(supporting_tokens, env, algorithmsuite);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(is_token_assertion(env, type))
+ {
+ rp_property_t *token = NULL;
+ token = rp_property_create(env);
+ rp_token_identifier_set_token(token, assertion, env);
+ rp_supporting_tokens_add_token(supporting_tokens, env, token);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ return AXIS2_SUCCESS;
+}
+
+axis2_bool_t AXIS2_CALL
+is_token_assertion(
+ const axutil_env_t *env,
+ neethi_assertion_type_t type)
+{
+ if(type == ASSERTION_TYPE_USERNAME_TOKEN)
+ {
+ return AXIS2_TRUE;
+ }
+ else if(type == ASSERTION_TYPE_X509_TOKEN)
+ {
+ return AXIS2_TRUE;
+ }
+ else if(type == ASSERTION_TYPE_ISSUED_TOKEN)
+ {
+ return AXIS2_TRUE;
+ }
+ else if(type == ASSERTION_TYPE_SAML_TOKEN)
+ {
+ return AXIS2_TRUE;
+ }
+ else
+ return AXIS2_FALSE;
+}
diff --git a/neethi/src/secpolicy/builder/symmetric_binding_builder.c b/neethi/src/secpolicy/builder/symmetric_binding_builder.c
new file mode 100644
index 0000000..1338963
--- /dev/null
+++ b/neethi/src/secpolicy/builder/symmetric_binding_builder.c
@@ -0,0 +1,245 @@
+/*
+ * 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 <rp_symmetric_binding_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+/*private functions*/
+
+axis2_status_t AXIS2_CALL
+symmetric_binding_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_symmetric_binding_t *symmetric_binding);
+
+/***********************************/
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_symmetric_binding_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ rp_symmetric_binding_t *symmetric_binding = NULL;
+ neethi_policy_t *policy = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_element_t *child_element = NULL;
+ axutil_array_list_t *alternatives = NULL;
+ neethi_operator_t *component = NULL;
+ neethi_all_t *all = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_policy_t *normalized_policy = NULL;
+
+ symmetric_binding = rp_symmetric_binding_create(env);
+
+ child_node = axiom_node_get_first_element(node, env);
+ if(!child_node)
+ {
+ return NULL;
+ }
+
+ if(axiom_node_get_node_type(child_node, env) == AXIOM_ELEMENT)
+ {
+ child_element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+ if(child_element)
+ {
+ policy = neethi_engine_get_policy(env, child_node, child_element);
+ if(!policy)
+ {
+ return NULL;
+ }
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
+ all = (neethi_all_t *)neethi_operator_get_value(component, env);
+ symmetric_binding_process_alternatives(env, all, symmetric_binding);
+
+ assertion = neethi_assertion_create_with_args(env,
+ (AXIS2_FREE_VOID_ARG)rp_symmetric_binding_free, symmetric_binding,
+ ASSERTION_TYPE_SYMMETRIC_BINDING);
+ neethi_policy_free(normalized_policy, env);
+ normalized_policy = NULL;
+
+ return assertion;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
+
+axis2_status_t AXIS2_CALL
+symmetric_binding_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_symmetric_binding_t * symmetric_binding)
+{
+
+ neethi_operator_t *operator = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_assertion_type_t type;
+ void *value = NULL;
+ rp_binding_commons_t *commons = NULL;
+ rp_symmetric_asymmetric_binding_commons_t *as_commons = NULL;
+
+ int i = 0;
+
+ arraylist = neethi_all_get_policy_components(all, env);
+ commons = rp_binding_commons_create(env);
+ as_commons = rp_symmetric_asymmetric_binding_commons_create(env);
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ operator = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(operator, env);
+ value = neethi_assertion_get_value(assertion, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(type == ASSERTION_TYPE_PROTECTION_TOKEN)
+ {
+ rp_property_t *protection_token = NULL;
+ protection_token = (rp_property_t *)neethi_assertion_get_value(assertion, env);
+ if(protection_token)
+ {
+ rp_symmetric_binding_set_protection_token(symmetric_binding, env, protection_token);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_ENCRYPTION_TOKEN)
+ {
+ rp_property_t *encryption_token = NULL;
+ encryption_token = (rp_property_t *)neethi_assertion_get_value(assertion, env);
+ if(encryption_token)
+ {
+ rp_symmetric_binding_set_encryption_token(symmetric_binding, env, encryption_token);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_SIGNATURE_TOKEN)
+ {
+ rp_property_t *signature_token = NULL;
+ signature_token = (rp_property_t *)neethi_assertion_get_value(assertion, env);
+ if(signature_token)
+ {
+ rp_symmetric_binding_set_signature_token(symmetric_binding, env, signature_token);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_ALGORITHM_SUITE)
+ {
+ rp_algorithmsuite_t *algorithmsuite = NULL;
+ algorithmsuite = (rp_algorithmsuite_t *)neethi_assertion_get_value(assertion, env);
+ if(algorithmsuite)
+ {
+ rp_binding_commons_set_algorithmsuite(commons, env, algorithmsuite);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_INCLUDE_TIMESTAMP)
+ {
+ rp_binding_commons_set_include_timestamp(commons, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_LAYOUT)
+ {
+ rp_layout_t *layout = NULL;
+ layout = (rp_layout_t *)neethi_assertion_get_value(assertion, env);
+ if(layout)
+ {
+ rp_binding_commons_set_layout(commons, env, layout);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_ENCRYPT_BEFORE_SIGNING)
+ {
+ rp_symmetric_asymmetric_binding_commons_set_protection_order(as_commons, env,
+ RP_ENCRYPT_BEFORE_SIGNING);
+ }
+ else if(type == ASSERTION_TYPE_SIGN_BEFORE_ENCRYPTING)
+ {
+ rp_symmetric_asymmetric_binding_commons_set_protection_order(as_commons, env,
+ RP_SIGN_BEFORE_ENCRYPTING);
+ }
+ else if(type == ASSERTION_TYPE_ENCRYPT_SIGNATURE)
+ {
+ rp_symmetric_asymmetric_binding_commons_set_signature_protection(as_commons, env,
+ AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_PROTECT_TOKENS)
+ {
+ rp_symmetric_asymmetric_binding_commons_set_token_protection(as_commons, env,
+ AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_ONLY_SIGN_ENTIRE_HEADERS_AND_BODY)
+ {
+ rp_symmetric_asymmetric_binding_commons_set_entire_headers_and_body_signatures(
+ as_commons, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_SUPPORTING_TOKENS)
+ {
+ rp_supporting_tokens_t *supporting_tokens = NULL;
+ supporting_tokens
+ = (rp_supporting_tokens_t *)neethi_assertion_get_value(assertion, env);
+ if(supporting_tokens)
+ {
+ rp_property_type_t type;
+ type = rp_supporting_tokens_get_type(supporting_tokens, env);
+ if(type == RP_PROPERTY_SIGNED_SUPPORTING_TOKEN)
+ {
+ rp_binding_commons_set_signed_supporting_tokens(commons, env, supporting_tokens);
+ }
+ else if(type == RP_PROPERTY_SIGNED_ENDORSING_SUPPORTING_TOKEN)
+ {
+ rp_binding_commons_set_signed_endorsing_supporting_tokens(commons, env,
+ supporting_tokens);
+ }
+ else if(type == RP_PROPERTY_SUPPORTING_SUPPORTING_TOKEN)
+ {
+ rp_binding_commons_set_supporting_tokens(commons, env, supporting_tokens);
+ }
+ else if(type == RP_PROPERTY_ENDORSING_SUPPORTING_TOKEN)
+ {
+ rp_binding_commons_set_endorsing_supporting_tokens(commons, env,
+ supporting_tokens);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ rp_symmetric_asymmetric_binding_commons_set_binding_commons(as_commons, env, commons);
+ rp_symmetric_binding_set_symmetric_asymmetric_binding_commons(symmetric_binding, env,
+ as_commons);
+
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/builder/token_identifier.c b/neethi/src/secpolicy/builder/token_identifier.c
new file mode 100644
index 0000000..938627e
--- /dev/null
+++ b/neethi/src/secpolicy/builder/token_identifier.c
@@ -0,0 +1,78 @@
+/*
+ * 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 <rp_token_identifier.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_assertion.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+/*private functions*/
+
+/***********************************/
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_token_identifier_set_token(
+ rp_property_t *token,
+ neethi_assertion_t *assertion,
+ const axutil_env_t *env)
+{
+ void *value = NULL;
+ neethi_assertion_type_t type;
+
+ value = neethi_assertion_get_value(assertion, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(value)
+ {
+ if(type == ASSERTION_TYPE_USERNAME_TOKEN)
+ {
+ rp_username_token_t *username_token = NULL;
+ username_token = (rp_username_token_t *)value;
+ rp_property_set_value(token, env, username_token, RP_PROPERTY_USERNAME_TOKEN);
+ return AXIS2_SUCCESS;
+ }
+ else if(type == ASSERTION_TYPE_X509_TOKEN)
+ {
+ rp_x509_token_t *x509_token = NULL;
+ x509_token = (rp_x509_token_t *)value;
+ rp_property_set_value(token, env, x509_token, RP_PROPERTY_X509_TOKEN);
+ return AXIS2_SUCCESS;
+ }
+ else if(type == ASSERTION_TYPE_SAML_TOKEN)
+ {
+ rp_saml_token_t *saml_token = NULL;
+ saml_token = (rp_saml_token_t *)value;
+ rp_property_set_value(token, env, saml_token, RP_PROPERTY_SAML_TOKEN);
+ return AXIS2_SUCCESS;
+ }
+ else if(type == ASSERTION_TYPE_ISSUED_TOKEN)
+ {
+ rp_issued_token_t *issued_token = NULL;
+ issued_token = (rp_issued_token_t *)value;
+ rp_property_set_value(token, env, issued_token, RP_PROPERTY_ISSUED_TOKEN);
+ return AXIS2_SUCCESS;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+
+ return AXIS2_FAILURE;
+}
+
diff --git a/neethi/src/secpolicy/builder/transport_binding_builder.c b/neethi/src/secpolicy/builder/transport_binding_builder.c
new file mode 100644
index 0000000..be84119
--- /dev/null
+++ b/neethi/src/secpolicy/builder/transport_binding_builder.c
@@ -0,0 +1,196 @@
+/*
+ * 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 <rp_transport_binding_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+/*private functions*/
+
+axis2_status_t AXIS2_CALL
+transport_binding_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_transport_binding_t *transport_binding);
+
+/***********************************/
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_transport_binding_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ rp_transport_binding_t *transport_binding = NULL;
+ neethi_policy_t *policy = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_element_t *child_element = NULL;
+ axutil_array_list_t *alternatives = NULL;
+ neethi_operator_t *component = NULL;
+ neethi_all_t *all = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_policy_t *normalized_policy = NULL;
+
+ transport_binding = rp_transport_binding_create(env);
+
+ child_node = axiom_node_get_first_element(node, env);
+
+ if(!child_node)
+ {
+ return NULL;
+ }
+
+ if(axiom_node_get_node_type(child_node, env) == AXIOM_ELEMENT)
+ {
+ child_element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+ if(child_element)
+ {
+ policy = neethi_engine_get_policy(env, child_node, child_element);
+ if(!policy)
+ {
+ return NULL;
+ }
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
+ component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
+ all = (neethi_all_t *)neethi_operator_get_value(component, env);
+ transport_binding_process_alternatives(env, all, transport_binding);
+
+ assertion = neethi_assertion_create_with_args(env,
+ (AXIS2_FREE_VOID_ARG)rp_transport_binding_free, transport_binding,
+ ASSERTION_TYPE_TRANSPORT_BINDING);
+
+ neethi_policy_free(normalized_policy, env);
+ normalized_policy = NULL;
+
+ return assertion;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
+
+axis2_status_t AXIS2_CALL
+transport_binding_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_transport_binding_t *transport_binding)
+{
+
+ neethi_operator_t *operator = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_assertion_type_t type;
+ void *value = NULL;
+ rp_binding_commons_t *commons = NULL;
+
+ int i = 0;
+
+ arraylist = neethi_all_get_policy_components(all, env);
+ commons = rp_binding_commons_create(env);
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ operator = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(operator, env);
+ value = neethi_assertion_get_value(assertion, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(type == ASSERTION_TYPE_TRANSPORT_TOKEN)
+ {
+ rp_property_t *transport_token = NULL;
+ transport_token = (rp_property_t *)neethi_assertion_get_value(assertion, env);
+ if(transport_token)
+ {
+ rp_transport_binding_set_transport_token(transport_binding, env, transport_token);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_ALGORITHM_SUITE)
+ {
+ rp_algorithmsuite_t *algorithmsuite = NULL;
+ algorithmsuite = (rp_algorithmsuite_t *)neethi_assertion_get_value(assertion, env);
+ if(algorithmsuite)
+ {
+ rp_binding_commons_set_algorithmsuite(commons, env, algorithmsuite);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_INCLUDE_TIMESTAMP)
+ {
+ rp_binding_commons_set_include_timestamp(commons, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_LAYOUT)
+ {
+ rp_layout_t *layout = NULL;
+ layout = (rp_layout_t *)neethi_assertion_get_value(assertion, env);
+ if(layout)
+ {
+ rp_binding_commons_set_layout(commons, env, layout);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_SUPPORTING_TOKENS)
+ {
+ rp_supporting_tokens_t *supporting_tokens = NULL;
+ supporting_tokens
+ = (rp_supporting_tokens_t *)neethi_assertion_get_value(assertion, env);
+ if(supporting_tokens)
+ {
+ rp_property_type_t type;
+ type = rp_supporting_tokens_get_type(supporting_tokens, env);
+ if(type == RP_PROPERTY_SIGNED_SUPPORTING_TOKEN)
+ {
+ rp_binding_commons_set_signed_supporting_tokens(commons, env, supporting_tokens);
+ }
+ else if(type == RP_PROPERTY_SIGNED_ENDORSING_SUPPORTING_TOKEN)
+ {
+ rp_binding_commons_set_signed_endorsing_supporting_tokens(commons, env,
+ supporting_tokens);
+ }
+ else if(type == RP_PROPERTY_SUPPORTING_SUPPORTING_TOKEN)
+ {
+ rp_binding_commons_set_supporting_tokens(commons, env, supporting_tokens);
+ }
+ else if(type == RP_PROPERTY_ENDORSING_SUPPORTING_TOKEN)
+ {
+ rp_binding_commons_set_endorsing_supporting_tokens(commons, env,
+ supporting_tokens);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+
+ rp_transport_binding_set_binding_commons(transport_binding, env, commons);
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/builder/transport_token_builder.c b/neethi/src/secpolicy/builder/transport_token_builder.c
new file mode 100644
index 0000000..f50183d
--- /dev/null
+++ b/neethi/src/secpolicy/builder/transport_token_builder.c
@@ -0,0 +1,138 @@
+/*
+ * 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 <rp_transport_token_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_assertion.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+/*private functions*/
+
+axis2_status_t AXIS2_CALL
+transport_token_process_alternatives(
+ const axutil_env_t * env,
+ neethi_all_t * all,
+ rp_property_t * transport_token);
+
+/***********************************/
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_transport_token_builder_build(
+ const axutil_env_t * env,
+ axiom_node_t * node,
+ axiom_element_t * element)
+{
+ rp_property_t *transport_token = NULL;
+ neethi_policy_t *policy = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_element_t *child_element = NULL;
+ axutil_array_list_t *alternatives = NULL;
+ neethi_operator_t *component = NULL;
+ neethi_all_t *all = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_policy_t *normalized_policy = NULL;
+
+ transport_token = rp_property_create(env);
+
+ child_node = axiom_node_get_first_element(node, env);
+ if(!child_node)
+ {
+ return NULL;
+ }
+
+ if(axiom_node_get_node_type(child_node, env) == AXIOM_ELEMENT)
+ {
+ child_element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+ if(child_element)
+ {
+ policy = neethi_engine_get_policy(env, child_node, child_element);
+ if(!policy)
+ {
+ return NULL;
+ }
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ policy = NULL;
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
+ component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
+ all = (neethi_all_t *)neethi_operator_get_value(component, env);
+ transport_token_process_alternatives(env, all, transport_token);
+
+ assertion = neethi_assertion_create_with_args(env,
+ (AXIS2_FREE_VOID_ARG)rp_property_free, transport_token,
+ ASSERTION_TYPE_TRANSPORT_TOKEN);
+
+ neethi_policy_free(normalized_policy, env);
+ normalized_policy = NULL;
+
+ return assertion;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
+
+axis2_status_t AXIS2_CALL
+transport_token_process_alternatives(
+ const axutil_env_t * env,
+ neethi_all_t * all,
+ rp_property_t * transport_token)
+{
+
+ neethi_operator_t *operator = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_assertion_type_t type;
+ void *value = NULL;
+
+ int i = 0;
+
+ arraylist = neethi_all_get_policy_components(all, env);
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ operator = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(operator, env);
+ value = neethi_assertion_get_value(assertion, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(value)
+ {
+ if(type == ASSERTION_TYPE_HTTPS_TOKEN)
+ {
+ rp_https_token_t *https_token = NULL;
+ https_token = (rp_https_token_t *)neethi_assertion_get_value(assertion, env);
+ if(https_token)
+ {
+ rp_property_set_value(transport_token, env, https_token,
+ RP_PROPERTY_HTTPS_TOKEN);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/builder/trust10_builder.c b/neethi/src/secpolicy/builder/trust10_builder.c
new file mode 100644
index 0000000..e97f0f7
--- /dev/null
+++ b/neethi/src/secpolicy/builder/trust10_builder.c
@@ -0,0 +1,139 @@
+/*
+ * 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 <rp_trust10_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+/*private functions*/
+
+axis2_status_t AXIS2_CALL
+trust10_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_trust10_t *trust10);
+
+/***********************************/
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_trust10_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ rp_trust10_t *trust10 = NULL;
+ neethi_policy_t *policy = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_element_t *child_element = NULL;
+ axutil_array_list_t *alternatives = NULL;
+ neethi_operator_t *component = NULL;
+ neethi_all_t *all = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_policy_t *normalized_policy = NULL;
+
+ trust10 = rp_trust10_create(env);
+
+ child_node = axiom_node_get_first_element(node, env);
+ if(!child_node)
+ {
+ return NULL;
+ }
+
+ if(axiom_node_get_node_type(child_node, env) == AXIOM_ELEMENT)
+ {
+ child_element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+ if(child_element)
+ {
+ policy = neethi_engine_get_policy(env, child_node, child_element);
+ if(!policy)
+ {
+ return NULL;
+ }
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
+ component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
+ all = (neethi_all_t *)neethi_operator_get_value(component, env);
+ trust10_process_alternatives(env, all, trust10);
+
+ assertion = neethi_assertion_create_with_args(env,
+ (AXIS2_FREE_VOID_ARG)rp_trust10_free, trust10, ASSERTION_TYPE_TRUST10);
+
+ neethi_policy_free(normalized_policy, env);
+ normalized_policy = NULL;
+
+ return assertion;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
+
+axis2_status_t AXIS2_CALL
+trust10_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_trust10_t *trust10)
+{
+ neethi_operator_t *operator = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_assertion_type_t type;
+ void *value = NULL;
+
+ int i = 0;
+
+ arraylist = neethi_all_get_policy_components(all, env);
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ operator = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(operator, env);
+ value = neethi_assertion_get_value(assertion, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(type == ASSERTION_TYPE_MUST_SUPPORT_CLIENT_CHALLENGE)
+ {
+ rp_trust10_set_must_support_client_challenge(trust10, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_MUST_SUPPORT_SERVER_CHALLENGE)
+ {
+ rp_trust10_set_must_support_server_challenge(trust10, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_REQUIRE_CLIENT_ENTROPY)
+ {
+ rp_trust10_set_require_client_entropy(trust10, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_REQUIRE_SERVER_ENTROPHY)
+ {
+ rp_trust10_set_require_server_entropy(trust10, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_MUST_SUPPORT_ISSUED_TOKENS)
+ {
+ rp_trust10_set_must_support_issued_token(trust10, env, AXIS2_TRUE);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/builder/username_token_builder.c b/neethi/src/secpolicy/builder/username_token_builder.c
new file mode 100644
index 0000000..b8ac02b
--- /dev/null
+++ b/neethi/src/secpolicy/builder/username_token_builder.c
@@ -0,0 +1,150 @@
+/*
+ * 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 <rp_username_token_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+/*private functions*/
+
+static axis2_status_t AXIS2_CALL username_token_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_username_token_t *username_token);
+
+/***********************************/
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_username_token_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ rp_username_token_t *username_token = NULL;
+ neethi_policy_t *policy = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_element_t *child_element = NULL;
+ axutil_array_list_t *alternatives = NULL;
+ neethi_operator_t *component = NULL;
+ neethi_all_t *all = NULL;
+ axis2_char_t *inclusion_value = NULL;
+ axutil_qname_t *qname = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_policy_t *normalized_policy = NULL;
+
+ username_token = rp_username_token_create(env);
+ qname = axutil_qname_create(env, RP_INCLUDE_TOKEN, RP_SP_NS_11, RP_SP_PREFIX);
+ inclusion_value = axiom_element_get_attribute_value(element, env, qname);
+ axutil_qname_free(qname, env);
+ qname = NULL;
+ if(!inclusion_value)
+ {
+ /* we can try whether WS-SP1.2 specific inclusion value */
+ qname = axutil_qname_create(env, RP_INCLUDE_TOKEN, RP_SP_NS_12, RP_SP_PREFIX);
+ inclusion_value = axiom_element_get_attribute_value(element, env, qname);
+ axutil_qname_free(qname, env);
+ qname = NULL;
+ }
+
+ rp_username_token_set_inclusion(username_token, env, inclusion_value);
+
+ child_node = axiom_node_get_first_element(node, env);
+ if(!child_node)
+ {
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, username_token, ASSERTION_TYPE_USERNAME_TOKEN);
+ return assertion;
+ }
+
+ if(axiom_node_get_node_type(child_node, env) == AXIOM_ELEMENT)
+ {
+ child_element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+ if(child_element)
+ {
+ policy = neethi_engine_get_policy(env, child_node, child_element);
+ if(!policy)
+ {
+ return NULL;
+ }
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
+ component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
+ all = (neethi_all_t *)neethi_operator_get_value(component, env);
+ username_token_process_alternatives(env, all, username_token);
+
+ assertion = neethi_assertion_create_with_args(env,
+ (AXIS2_FREE_VOID_ARG)rp_username_token_free, username_token,
+ ASSERTION_TYPE_USERNAME_TOKEN);
+
+ neethi_policy_free(normalized_policy, env);
+ normalized_policy = NULL;
+
+ return assertion;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
+
+static axis2_status_t AXIS2_CALL
+username_token_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_username_token_t *username_token)
+{
+ neethi_operator_t *operator = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_assertion_type_t type;
+ void *value = NULL;
+
+ int i = 0;
+
+ arraylist = neethi_all_get_policy_components(all, env);
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ operator = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(operator, env);
+ value = neethi_assertion_get_value(assertion, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(value)
+ {
+ if(type == ASSERTION_TYPE_WSS_USERNAME_TOKEN_10)
+ {
+ rp_username_token_set_useUTprofile10(username_token, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_WSS_USERNAME_TOKEN_11)
+ {
+ rp_username_token_set_useUTprofile11(username_token, env, AXIS2_TRUE);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/builder/wss10_builder.c b/neethi/src/secpolicy/builder/wss10_builder.c
new file mode 100644
index 0000000..6dd10ae
--- /dev/null
+++ b/neethi/src/secpolicy/builder/wss10_builder.c
@@ -0,0 +1,135 @@
+/*
+ * 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 <rp_wss10_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+/*private functions*/
+
+axis2_status_t AXIS2_CALL
+wss10_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_wss10_t *wss10);
+
+/***********************************/
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_wss10_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ rp_wss10_t *wss10 = NULL;
+ neethi_policy_t *policy = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_element_t *child_element = NULL;
+ axutil_array_list_t *alternatives = NULL;
+ neethi_operator_t *component = NULL;
+ neethi_all_t *all = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_policy_t *normalized_policy = NULL;
+
+ wss10 = rp_wss10_create(env);
+
+ child_node = axiom_node_get_first_element(node, env);
+ if(!child_node)
+ {
+ return NULL;
+ }
+
+ if(axiom_node_get_node_type(child_node, env) == AXIOM_ELEMENT)
+ {
+ child_element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+ if(child_element)
+ {
+ policy = neethi_engine_get_policy(env, child_node, child_element);
+ if(!policy)
+ {
+ return NULL;
+ }
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
+ component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
+ all = (neethi_all_t *)neethi_operator_get_value(component, env);
+ wss10_process_alternatives(env, all, wss10);
+
+ assertion = neethi_assertion_create_with_args(env, (AXIS2_FREE_VOID_ARG)rp_wss10_free,
+ wss10, ASSERTION_TYPE_WSS10);
+
+ neethi_policy_free(normalized_policy, env);
+ normalized_policy = NULL;
+
+ return assertion;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
+
+axis2_status_t AXIS2_CALL
+wss10_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_wss10_t *wss10)
+{
+ neethi_operator_t *operator = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_assertion_type_t type;
+ void *value = NULL;
+
+ int i = 0;
+
+ arraylist = neethi_all_get_policy_components(all, env);
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ operator = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(operator, env);
+ value = neethi_assertion_get_value(assertion, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(type == ASSERTION_TYPE_MUST_SUPPORT_REF_KEY_IDENTIFIER)
+ {
+ rp_wss10_set_must_support_ref_key_identifier(wss10, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_MUST_SUPPORT_REF_ISSUER_SERIAL)
+ {
+ rp_wss10_set_must_support_ref_issuer_serial(wss10, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_MUST_SUPPORT_REF_EXTERNAL_URI)
+ {
+ rp_wss10_set_must_support_ref_external_uri(wss10, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_MUST_SUPPORT_REF_EMBEDDED_TOKEN)
+ {
+ rp_wss10_set_must_support_ref_embedded_token(wss10, env, AXIS2_TRUE);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/builder/wss11_builder.c b/neethi/src/secpolicy/builder/wss11_builder.c
new file mode 100644
index 0000000..6249181
--- /dev/null
+++ b/neethi/src/secpolicy/builder/wss11_builder.c
@@ -0,0 +1,147 @@
+/*
+ * 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 <rp_wss11_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+/*private functions*/
+
+axis2_status_t AXIS2_CALL
+wss11_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_wss11_t *wss11);
+
+/***********************************/
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_wss11_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ rp_wss11_t *wss11 = NULL;
+ neethi_policy_t *policy = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_element_t *child_element = NULL;
+ axutil_array_list_t *alternatives = NULL;
+ neethi_operator_t *component = NULL;
+ neethi_all_t *all = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_policy_t *normalized_policy = NULL;
+
+ wss11 = rp_wss11_create(env);
+
+ child_node = axiom_node_get_first_element(node, env);
+ if(!child_node)
+ {
+ return NULL;
+ }
+
+ if(axiom_node_get_node_type(child_node, env) == AXIOM_ELEMENT)
+ {
+ child_element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+ if(child_element)
+ {
+ policy = neethi_engine_get_policy(env, child_node, child_element);
+ if(!policy)
+ {
+ return NULL;
+ }
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
+ component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
+ all = (neethi_all_t *)neethi_operator_get_value(component, env);
+ wss11_process_alternatives(env, all, wss11);
+
+ assertion = neethi_assertion_create_with_args(env, (AXIS2_FREE_VOID_ARG)rp_wss11_free,
+ wss11, ASSERTION_TYPE_WSS11);
+
+ neethi_policy_free(normalized_policy, env);
+ normalized_policy = NULL;
+
+ return assertion;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
+
+axis2_status_t AXIS2_CALL
+wss11_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_wss11_t *wss11)
+{
+ neethi_operator_t *operator = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_assertion_type_t type;
+ void *value = NULL;
+
+ int i = 0;
+
+ arraylist = neethi_all_get_policy_components(all, env);
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ operator = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(operator, env);
+ value = neethi_assertion_get_value(assertion, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(type == ASSERTION_TYPE_MUST_SUPPORT_REF_KEY_IDENTIFIER)
+ {
+ rp_wss11_set_must_support_ref_key_identifier(wss11, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_MUST_SUPPORT_REF_ISSUER_SERIAL)
+ {
+ rp_wss11_set_must_support_ref_issuer_serial(wss11, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_MUST_SUPPORT_REF_EXTERNAL_URI)
+ {
+ rp_wss11_set_must_support_ref_external_uri(wss11, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_MUST_SUPPORT_REF_EMBEDDED_TOKEN)
+ {
+ rp_wss11_set_must_support_ref_embedded_token(wss11, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_MUST_SUPPORT_REF_THUMBPRINT)
+ {
+ rp_wss11_set_must_support_ref_thumbprint(wss11, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_MUST_SUPPORT_REF_ENCRYPTED_KEY)
+ {
+ rp_wss11_set_must_support_ref_encryptedkey(wss11, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_REQUIRE_SIGNATURE_CONFIRMATION)
+ {
+ rp_wss11_set_require_signature_confirmation(wss11, env, AXIS2_TRUE);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/builder/x509_token_builder.c b/neethi/src/secpolicy/builder/x509_token_builder.c
new file mode 100644
index 0000000..fa8d8f9
--- /dev/null
+++ b/neethi/src/secpolicy/builder/x509_token_builder.c
@@ -0,0 +1,168 @@
+/*
+ * 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 <rp_x509_token_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+/*private functions*/
+
+axis2_status_t AXIS2_CALL
+x509_token_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_x509_token_t *x509_token);
+
+/***********************************/
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_x509_token_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ rp_x509_token_t *x509_token = NULL;
+ neethi_policy_t *policy = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_element_t *child_element = NULL;
+ axutil_array_list_t *alternatives = NULL;
+ neethi_operator_t *component = NULL;
+ neethi_all_t *all = NULL;
+ axis2_char_t *inclusion_value = NULL;
+ axutil_qname_t *qname = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_policy_t *normalized_policy = NULL;
+
+ x509_token = rp_x509_token_create(env);
+ qname = axutil_qname_create(env, RP_INCLUDE_TOKEN, RP_SP_NS_11, RP_SP_PREFIX);
+ inclusion_value = axiom_element_get_attribute_value(element, env, qname);
+ axutil_qname_free(qname, env);
+ qname = NULL;
+
+ if(!inclusion_value)
+ {
+ /* we can try whether WS-SP1.2 specific inclusion value */
+ qname = axutil_qname_create(env, RP_INCLUDE_TOKEN, RP_SP_NS_12, RP_SP_PREFIX);
+ inclusion_value = axiom_element_get_attribute_value(element, env, qname);
+ axutil_qname_free(qname, env);
+ qname = NULL;
+ }
+
+ rp_x509_token_set_inclusion(x509_token, env, inclusion_value);
+
+ child_node = axiom_node_get_first_element(node, env);
+ if(!child_node)
+ {
+ return NULL;
+ }
+
+ if(axiom_node_get_node_type(child_node, env) == AXIOM_ELEMENT)
+ {
+ child_element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+ if(child_element)
+ {
+ policy = neethi_engine_get_policy(env, child_node, child_element);
+ if(!policy)
+ {
+ return NULL;
+ }
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
+ component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
+ all = (neethi_all_t *)neethi_operator_get_value(component, env);
+ x509_token_process_alternatives(env, all, x509_token);
+
+ assertion = neethi_assertion_create_with_args(env,
+ (AXIS2_FREE_VOID_ARG)rp_x509_token_free, x509_token, ASSERTION_TYPE_X509_TOKEN);
+
+ neethi_policy_free(normalized_policy, env);
+ normalized_policy = NULL;
+
+ return assertion;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
+
+axis2_status_t AXIS2_CALL
+x509_token_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_x509_token_t *x509_token)
+{
+ neethi_operator_t *operator = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_assertion_type_t type;
+
+ int i = 0;
+
+ arraylist = neethi_all_get_policy_components(all, env);
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ operator = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(operator, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(type == ASSERTION_TYPE_REQUIRE_DERIVED_KEYS_SC10)
+ {
+ rp_x509_token_set_derivedkey(x509_token, env, DERIVEKEY_NEEDED);
+ rp_x509_token_set_derivedkey_version(x509_token, env, DERIVEKEY_VERSION_SC10);
+ }
+ else if(type == ASSERTION_TYPE_REQUIRE_DERIVED_KEYS_SC13)
+ {
+ rp_x509_token_set_derivedkey(x509_token, env, DERIVEKEY_NEEDED);
+ rp_x509_token_set_derivedkey_version(x509_token, env, DERIVEKEY_VERSION_SC13);
+ }
+ else if(type == ASSERTION_TYPE_REQUIRE_KEY_IDENTIFIRE_REFERENCE)
+ {
+ rp_x509_token_set_require_key_identifier_reference(x509_token, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_REQUIRE_ISSUER_SERIAL_REFERENCE)
+ {
+ rp_x509_token_set_require_issuer_serial_reference(x509_token, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_REQUIRE_EMBEDDED_TOKEN_REFERENCE)
+ {
+ rp_x509_token_set_require_embedded_token_reference(x509_token, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_REQUIRE_THUMBPRINT_REFERENCE)
+ {
+ rp_x509_token_set_require_thumb_print_reference(x509_token, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_WSS_X509_V1_TOKEN_10)
+ {
+ rp_x509_token_set_token_version_and_type(x509_token, env, RP_WSS_X509_V1_TOKEN_10);
+ }
+ else if(type == ASSERTION_TYPE_WSS_X509_V3_TOKEN_10)
+ {
+ rp_x509_token_set_token_version_and_type(x509_token, env, RP_WSS_X509_V3_TOKEN_10);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/model/Makefile.am b/neethi/src/secpolicy/model/Makefile.am
new file mode 100644
index 0000000..b24ddb7
--- /dev/null
+++ b/neethi/src/secpolicy/model/Makefile.am
@@ -0,0 +1,21 @@
+TESTS =
+
+noinst_LTLIBRARIES = librp_model.la
+
+librp_model_la_SOURCES = algorithmsuite.c asymmetric_binding.c \
+ binding_commons.c header.c element.c https_token.c layout.c \
+ property.c rampart_config.c secpolicy.c security_context_token.c \
+ signed_encrypted_elements.c signed_encrypted_parts.c signed_encrypted_items.c \
+ supporting_tokens.c symmetric_asymmetric_binding_commons.c \
+ symmetric_binding.c transport_binding.c ut.c wss10.c wss11.c x509_token.c \
+ trust10.c issued_token.c saml_token.c token.c
+
+
+librp_model_la_LIBADD = ../../../../util/src/libaxutil.la
+
+
+INCLUDES = -I$(top_builddir)/include \
+ -I ../../../include \
+ -I ../../../../util/include \
+ -I ../../../../axiom/include \
+ -I ../../../../include
diff --git a/neethi/src/secpolicy/model/algorithmsuite.c b/neethi/src/secpolicy/model/algorithmsuite.c
new file mode 100644
index 0000000..db3426c
--- /dev/null
+++ b/neethi/src/secpolicy/model/algorithmsuite.c
@@ -0,0 +1,627 @@
+/*
+ * 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 <rp_algorithmsuite.h>
+
+struct rp_algorithmsuite_t
+{
+ axis2_char_t *algosuite_string;
+ axis2_char_t *symmetric_signature;
+ axis2_char_t *asymmetric_signature;
+ axis2_char_t *computed_key;
+ int max_symmetric_keylength;
+ int min_asymmetric_keylength;
+ int max_asymmetric_keylength;
+ axis2_char_t *digest;
+ axis2_char_t *encryption;
+ axis2_char_t *symmetrickeywrap;
+ axis2_char_t *asymmetrickeywrap;
+ axis2_char_t *encryption_key_derivation;
+ axis2_char_t *signature_key_derivation;
+ int encryption_key_derivation_keylength;
+ int signature_key_derivation_keylength;
+ int min_symmetric_keylength;
+ axis2_char_t *c14n;
+ axis2_char_t *soap_normalization;
+ axis2_char_t *str_transformation;
+ axis2_char_t *xpath;
+ int ref;
+
+};
+
+AXIS2_EXTERN rp_algorithmsuite_t *AXIS2_CALL
+rp_algorithmsuite_create(
+ const axutil_env_t *env)
+{
+ rp_algorithmsuite_t *algorithmsuite = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ algorithmsuite = (rp_algorithmsuite_t *)AXIS2_MALLOC(env->allocator,
+ sizeof(rp_algorithmsuite_t));
+
+ if(algorithmsuite == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ return NULL;
+ }
+ algorithmsuite->algosuite_string = NULL;
+ algorithmsuite->symmetric_signature = RP_HMAC_SHA1;
+ algorithmsuite->asymmetric_signature = RP_RSA_SHA1;
+ algorithmsuite->computed_key = RP_P_SHA1;
+ algorithmsuite->max_symmetric_keylength = 256;
+ algorithmsuite->min_asymmetric_keylength = 1024;
+ algorithmsuite->max_asymmetric_keylength = 4096;
+ algorithmsuite->digest = NULL;
+ algorithmsuite->encryption = NULL;
+ algorithmsuite->symmetrickeywrap = NULL;
+ algorithmsuite->asymmetrickeywrap = NULL;
+ algorithmsuite->encryption_key_derivation = NULL;
+ algorithmsuite->signature_key_derivation = NULL;
+ algorithmsuite->encryption_key_derivation_keylength = 192;
+ algorithmsuite->signature_key_derivation_keylength = 192;
+ algorithmsuite->min_symmetric_keylength = 0;
+ ;
+ algorithmsuite->c14n = RP_EX_C14N;
+ algorithmsuite->soap_normalization = NULL;
+ algorithmsuite->str_transformation = NULL;
+ algorithmsuite->xpath = NULL;
+ algorithmsuite->ref = 0;
+ return algorithmsuite;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_algorithmsuite_free(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ if(algorithmsuite)
+ {
+ if(--(algorithmsuite->ref) > 0)
+ {
+ return;
+ }
+
+ AXIS2_FREE(env->allocator, algorithmsuite);
+ algorithmsuite = NULL;
+ }
+ return;
+}
+
+/* Implementations */
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_algorithmsuite_get_algosuite_string(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ if(!algorithmsuite)
+ return NULL;
+ else
+ return algorithmsuite->algosuite_string;
+
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_algorithmsuite_set_algosuite(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env,
+ axis2_char_t *algosuite_string)
+{
+ AXIS2_PARAM_CHECK(env->error, algosuite_string, AXIS2_FAILURE);
+
+ algorithmsuite->algosuite_string = algosuite_string;
+
+ if(axutil_strcmp(algosuite_string, RP_ALGO_SUITE_BASIC256) == 0)
+ {
+ algorithmsuite->digest = RP_SHA1;
+ algorithmsuite->encryption = RP_AES256;
+ algorithmsuite->symmetrickeywrap = RP_KW_AES256;
+ algorithmsuite->asymmetrickeywrap = RP_KW_RSA_OAEP;
+ algorithmsuite->encryption_key_derivation = RP_P_SHA1_L256;
+ algorithmsuite->signature_key_derivation = RP_P_SHA1_L192;
+ algorithmsuite->min_symmetric_keylength = 256;
+ algorithmsuite->encryption_key_derivation_keylength = 256;
+ algorithmsuite->signature_key_derivation_keylength = 192;
+
+ return AXIS2_SUCCESS;
+ }
+ else if(axutil_strcmp(algosuite_string, RP_ALGO_SUITE_BASIC192) == 0)
+ {
+ algorithmsuite->digest = RP_SHA1;
+ algorithmsuite->encryption = RP_AES192;
+ algorithmsuite->symmetrickeywrap = RP_KW_AES192;
+ algorithmsuite->asymmetrickeywrap = RP_KW_RSA_OAEP;
+ algorithmsuite->encryption_key_derivation = RP_P_SHA1_L192;
+ algorithmsuite->signature_key_derivation = RP_P_SHA1_L192;
+ algorithmsuite->min_symmetric_keylength = 192;
+ algorithmsuite->encryption_key_derivation_keylength = 192;
+ algorithmsuite->signature_key_derivation_keylength = 192;
+
+ return AXIS2_SUCCESS;
+ }
+ else if(axutil_strcmp(algosuite_string, RP_ALGO_SUITE_BASIC128) == 0)
+ {
+ algorithmsuite->digest = RP_SHA1;
+ algorithmsuite->encryption = RP_AES128;
+ algorithmsuite->symmetrickeywrap = RP_KW_AES128;
+ algorithmsuite->asymmetrickeywrap = RP_KW_RSA_OAEP;
+ algorithmsuite->encryption_key_derivation = RP_P_SHA1_L128;
+ algorithmsuite->signature_key_derivation = RP_P_SHA1_L128;
+ algorithmsuite->min_symmetric_keylength = 128;
+ algorithmsuite->encryption_key_derivation_keylength = 128;
+ algorithmsuite->signature_key_derivation_keylength = 128;
+
+ return AXIS2_SUCCESS;
+ }
+ else if(axutil_strcmp(algosuite_string, RP_ALGO_SUITE_TRIPLE_DES) == 0)
+ {
+ algorithmsuite->digest = RP_SHA1;
+ algorithmsuite->encryption = RP_TRIPLE_DES;
+ algorithmsuite->symmetrickeywrap = RP_KW_TRIPLE_DES;
+ algorithmsuite->asymmetrickeywrap = RP_KW_RSA_OAEP;
+ algorithmsuite->encryption_key_derivation = RP_P_SHA1_L192;
+ algorithmsuite->signature_key_derivation = RP_P_SHA1_L192;
+ algorithmsuite->min_symmetric_keylength = 192;
+ algorithmsuite->encryption_key_derivation_keylength = 192;
+ algorithmsuite->signature_key_derivation_keylength = 192;
+
+ return AXIS2_SUCCESS;
+ }
+ else if(axutil_strcmp(algosuite_string, RP_ALGO_SUITE_BASIC256_RSA15) == 0)
+ {
+ algorithmsuite->digest = RP_SHA1;
+ algorithmsuite->encryption = RP_AES256;
+ algorithmsuite->symmetrickeywrap = RP_KW_AES256;
+ algorithmsuite->asymmetrickeywrap = RP_KW_RSA15;
+ algorithmsuite->encryption_key_derivation = RP_P_SHA1_L256;
+ algorithmsuite->signature_key_derivation = RP_P_SHA1_L192;
+ algorithmsuite->min_symmetric_keylength = 256;
+ algorithmsuite->encryption_key_derivation_keylength = 256;
+ algorithmsuite->signature_key_derivation_keylength = 192;
+
+ return AXIS2_SUCCESS;
+ }
+ else if(axutil_strcmp(algosuite_string, RP_ALGO_SUITE_BASIC192_RSA15) == 0)
+ {
+ algorithmsuite->digest = RP_SHA1;
+ algorithmsuite->encryption = RP_AES192;
+ algorithmsuite->symmetrickeywrap = RP_KW_AES192;
+ algorithmsuite->asymmetrickeywrap = RP_KW_RSA15;
+ algorithmsuite->encryption_key_derivation = RP_P_SHA1_L192;
+ algorithmsuite->signature_key_derivation = RP_P_SHA1_L192;
+ algorithmsuite->min_symmetric_keylength = 192;
+ algorithmsuite->encryption_key_derivation_keylength = 192;
+ algorithmsuite->signature_key_derivation_keylength = 192;
+
+ return AXIS2_SUCCESS;
+ }
+ else if(axutil_strcmp(algosuite_string, RP_ALGO_SUITE_BASIC128_RSA15) == 0)
+ {
+ algorithmsuite->digest = RP_SHA1;
+ algorithmsuite->encryption = RP_AES128;
+ algorithmsuite->symmetrickeywrap = RP_KW_AES128;
+ algorithmsuite->asymmetrickeywrap = RP_KW_RSA15;
+ algorithmsuite->encryption_key_derivation = RP_P_SHA1_L128;
+ algorithmsuite->signature_key_derivation = RP_P_SHA1_L128;
+ algorithmsuite->min_symmetric_keylength = 128;
+ algorithmsuite->encryption_key_derivation_keylength = 128;
+ algorithmsuite->signature_key_derivation_keylength = 128;
+
+ return AXIS2_SUCCESS;
+ }
+ else if(axutil_strcmp(algosuite_string, RP_ALGO_SUITE_TRIPLE_DES_RSA15) == 0)
+ {
+ algorithmsuite->digest = RP_SHA1;
+ algorithmsuite->encryption = RP_TRIPLE_DES;
+ algorithmsuite->symmetrickeywrap = RP_KW_TRIPLE_DES;
+ algorithmsuite->asymmetrickeywrap = RP_KW_RSA15;
+ algorithmsuite->encryption_key_derivation = RP_P_SHA1_L192;
+ algorithmsuite->signature_key_derivation = RP_P_SHA1_L192;
+ algorithmsuite->min_symmetric_keylength = 192;
+ algorithmsuite->encryption_key_derivation_keylength = 192;
+ algorithmsuite->signature_key_derivation_keylength = 192;
+
+ return AXIS2_SUCCESS;
+ }
+ else if(axutil_strcmp(algosuite_string, RP_ALGO_SUITE_BASIC256_SHA256) == 0)
+ {
+ algorithmsuite->digest = RP_SHA256;
+ algorithmsuite->encryption = RP_AES256;
+ algorithmsuite->symmetrickeywrap = RP_KW_AES256;
+ algorithmsuite->asymmetrickeywrap = RP_KW_RSA_OAEP;
+ algorithmsuite->encryption_key_derivation = RP_P_SHA1_L256;
+ algorithmsuite->signature_key_derivation = RP_P_SHA1_L192;
+ algorithmsuite->min_symmetric_keylength = 256;
+ algorithmsuite->encryption_key_derivation_keylength = 256;
+ algorithmsuite->signature_key_derivation_keylength = 192;
+
+ return AXIS2_SUCCESS;
+ }
+ else if(axutil_strcmp(algosuite_string, RP_ALGO_SUITE_BASIC192_SHA256) == 0)
+ {
+ algorithmsuite->digest = RP_SHA256;
+ algorithmsuite->encryption = RP_AES192;
+ algorithmsuite->symmetrickeywrap = RP_KW_AES192;
+ algorithmsuite->asymmetrickeywrap = RP_KW_RSA_OAEP;
+ algorithmsuite->encryption_key_derivation = RP_P_SHA1_L192;
+ algorithmsuite->signature_key_derivation = RP_P_SHA1_L192;
+ algorithmsuite->min_symmetric_keylength = 192;
+ algorithmsuite->encryption_key_derivation_keylength = 192;
+ algorithmsuite->signature_key_derivation_keylength = 192;
+
+ return AXIS2_SUCCESS;
+ }
+ else if(axutil_strcmp(algosuite_string, RP_ALGO_SUITE_BASIC128_SHA256) == 0)
+ {
+ algorithmsuite->digest = RP_SHA256;
+ algorithmsuite->encryption = RP_AES128;
+ algorithmsuite->symmetrickeywrap = RP_KW_AES128;
+ algorithmsuite->asymmetrickeywrap = RP_KW_RSA_OAEP;
+ algorithmsuite->encryption_key_derivation = RP_P_SHA1_L128;
+ algorithmsuite->signature_key_derivation = RP_P_SHA1_L128;
+ algorithmsuite->min_symmetric_keylength = 128;
+ algorithmsuite->encryption_key_derivation_keylength = 128;
+ algorithmsuite->signature_key_derivation_keylength = 128;
+
+ return AXIS2_SUCCESS;
+ }
+ else if(axutil_strcmp(algosuite_string, RP_ALGO_SUITE_TRIPLE_DES_SHA256) == 0)
+ {
+ algorithmsuite->digest = RP_SHA256;
+ algorithmsuite->encryption = RP_TRIPLE_DES;
+ algorithmsuite->symmetrickeywrap = RP_KW_TRIPLE_DES;
+ algorithmsuite->asymmetrickeywrap = RP_KW_RSA_OAEP;
+ algorithmsuite->encryption_key_derivation = RP_P_SHA1_L192;
+ algorithmsuite->signature_key_derivation = RP_P_SHA1_L192;
+ algorithmsuite->min_symmetric_keylength = 192;
+ algorithmsuite->encryption_key_derivation_keylength = 192;
+ algorithmsuite->signature_key_derivation_keylength = 192;
+
+ return AXIS2_SUCCESS;
+ }
+ else if(axutil_strcmp(algosuite_string, RP_ALGO_SUITE_BASIC256_SHA256_RSA15) == 0)
+ {
+ algorithmsuite->digest = RP_SHA256;
+ algorithmsuite->encryption = RP_AES256;
+ algorithmsuite->symmetrickeywrap = RP_KW_AES256;
+ algorithmsuite->asymmetrickeywrap = RP_KW_RSA15;
+ algorithmsuite->encryption_key_derivation = RP_P_SHA1_L256;
+ algorithmsuite->signature_key_derivation = RP_P_SHA1_L192;
+ algorithmsuite->min_symmetric_keylength = 256;
+ algorithmsuite->encryption_key_derivation_keylength = 256;
+ algorithmsuite->signature_key_derivation_keylength = 192;
+
+ return AXIS2_SUCCESS;
+ }
+ else if(axutil_strcmp(algosuite_string, RP_ALGO_SUITE_BASIC192_SHA256_RSA15) == 0)
+ {
+ algorithmsuite->digest = RP_SHA256;
+ algorithmsuite->encryption = RP_AES192;
+ algorithmsuite->symmetrickeywrap = RP_KW_AES192;
+ algorithmsuite->asymmetrickeywrap = RP_KW_RSA15;
+ algorithmsuite->encryption_key_derivation = RP_P_SHA1_L192;
+ algorithmsuite->signature_key_derivation = RP_P_SHA1_L192;
+ algorithmsuite->min_symmetric_keylength = 192;
+ algorithmsuite->encryption_key_derivation_keylength = 192;
+ algorithmsuite->signature_key_derivation_keylength = 192;
+
+ return AXIS2_SUCCESS;
+ }
+ else if(axutil_strcmp(algosuite_string, RP_ALGO_SUITE_BASIC128_SHA256_RSA15) == 0)
+ {
+ algorithmsuite->digest = RP_SHA256;
+ algorithmsuite->encryption = RP_AES128;
+ algorithmsuite->symmetrickeywrap = RP_KW_AES128;
+ algorithmsuite->asymmetrickeywrap = RP_KW_RSA15;
+ algorithmsuite->encryption_key_derivation = RP_P_SHA1_L128;
+ algorithmsuite->signature_key_derivation = RP_P_SHA1_L128;
+ algorithmsuite->min_symmetric_keylength = 128;
+ algorithmsuite->encryption_key_derivation_keylength = 128;
+ algorithmsuite->signature_key_derivation_keylength = 128;
+
+ return AXIS2_SUCCESS;
+ }
+ else if(axutil_strcmp(algosuite_string, RP_ALGO_SUITE_TRIPLE_DES_SHA256_RSA15) == 0)
+ {
+ algorithmsuite->digest = RP_SHA256;
+ algorithmsuite->encryption = RP_TRIPLE_DES;
+ algorithmsuite->symmetrickeywrap = RP_KW_TRIPLE_DES;
+ algorithmsuite->asymmetrickeywrap = RP_KW_RSA15;
+ algorithmsuite->encryption_key_derivation = RP_P_SHA1_L192;
+ algorithmsuite->signature_key_derivation = RP_P_SHA1_L192;
+ algorithmsuite->min_symmetric_keylength = 192;
+ algorithmsuite->encryption_key_derivation_keylength = 192;
+ algorithmsuite->signature_key_derivation_keylength = 192;
+
+ return AXIS2_SUCCESS;
+ }
+ else
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_algorithmsuite_get_symmetric_signature(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ return algorithmsuite->symmetric_signature;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_algorithmsuite_set_symmetric_signature(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env,
+ axis2_char_t *symmetric_signature)
+{
+ AXIS2_PARAM_CHECK(env->error, symmetric_signature, AXIS2_FAILURE);
+
+ algorithmsuite->symmetric_signature = symmetric_signature;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_algorithmsuite_get_asymmetric_signature(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ return algorithmsuite->asymmetric_signature;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_algorithmsuite_set_asymmetric_signature(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env,
+ axis2_char_t *asymmetric_signature)
+{
+ AXIS2_PARAM_CHECK(env->error, asymmetric_signature, AXIS2_FAILURE);
+
+ algorithmsuite->asymmetric_signature = asymmetric_signature;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_algorithmsuite_get_computed_key(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ return algorithmsuite->computed_key;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_algorithmsuite_set_computed_key(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env,
+ axis2_char_t *computed_key)
+{
+ AXIS2_PARAM_CHECK(env->error, computed_key, AXIS2_FAILURE);
+
+ algorithmsuite->computed_key = computed_key;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_algorithmsuite_get_digest(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ return algorithmsuite->digest;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_algorithmsuite_get_encryption(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ return algorithmsuite->encryption;
+}
+
+AXIS2_EXTERN int AXIS2_CALL
+rp_algorithmsuite_get_max_symmetric_keylength(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ return algorithmsuite->max_symmetric_keylength;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_algorithmsuite_set_max_symmetric_keylength(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env,
+ int max_symmetric_keylength)
+{
+ algorithmsuite->max_symmetric_keylength = max_symmetric_keylength;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN int AXIS2_CALL
+rp_algorithmsuite_get_min_symmetric_keylength(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ return algorithmsuite->min_symmetric_keylength;
+}
+
+AXIS2_EXTERN int AXIS2_CALL
+rp_algorithmsuite_get_encryption_derivation_keylength(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ return algorithmsuite->encryption_key_derivation_keylength;
+}
+
+AXIS2_EXTERN int AXIS2_CALL
+rp_algorithmsuite_get_signature_derivation_keylength(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ return algorithmsuite->signature_key_derivation_keylength;
+}
+
+AXIS2_EXTERN int AXIS2_CALL
+rp_algorithmsuite_get_max_asymmetric_keylength(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ return algorithmsuite->max_asymmetric_keylength;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_algorithmsuite_set_max_asymmetric_keylength(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env,
+ int max_asymmetric_keylength)
+{
+ algorithmsuite->max_asymmetric_keylength = max_asymmetric_keylength;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN int AXIS2_CALL
+rp_algorithmsuite_get_min_asymmetric_keylength(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ return algorithmsuite->min_asymmetric_keylength;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_algorithmsuite_set_min_asymmetric_keylength(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env,
+ int min_asymmetric_keylength)
+{
+ algorithmsuite->min_asymmetric_keylength = min_asymmetric_keylength;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_algorithmsuite_get_symmetrickeywrap(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ return algorithmsuite->symmetrickeywrap;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_algorithmsuite_get_asymmetrickeywrap(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ return algorithmsuite->asymmetrickeywrap;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_algorithmsuite_get_signature_key_derivation(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ return algorithmsuite->signature_key_derivation;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_algorithmsuite_get_encryption_key_derivation(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ return algorithmsuite->encryption_key_derivation;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_algorithmsuite_get_soap_normalization(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ return algorithmsuite->soap_normalization;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_algorithmsuite_set_soap_normalization(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env,
+ axis2_char_t *soap_normalization)
+{
+ AXIS2_PARAM_CHECK(env->error, soap_normalization, AXIS2_FAILURE);
+ algorithmsuite->soap_normalization = soap_normalization;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_algorithmsuite_get_str_transformation(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ return algorithmsuite->str_transformation;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_algorithmsuite_set_str_transformation(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env,
+ axis2_char_t *str_transformation)
+{
+ AXIS2_PARAM_CHECK(env->error, str_transformation, AXIS2_FAILURE);
+ algorithmsuite->str_transformation = str_transformation;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_algorithmsuite_get_c14n(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ return algorithmsuite->c14n;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_algorithmsuite_set_c14n(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env,
+ axis2_char_t *c14n)
+{
+ AXIS2_PARAM_CHECK(env->error, c14n, AXIS2_FAILURE);
+ algorithmsuite->c14n = c14n;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_algorithmsuite_get_xpath(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ return algorithmsuite->xpath;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_algorithmsuite_set_xpath(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env,
+ axis2_char_t *xpath)
+{
+ AXIS2_PARAM_CHECK(env->error, xpath, AXIS2_FAILURE);
+ algorithmsuite->xpath = xpath;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_algorithmsuite_increment_ref(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ algorithmsuite->ref++;
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/model/asymmetric_binding.c b/neethi/src/secpolicy/model/asymmetric_binding.c
new file mode 100644
index 0000000..0e57dce
--- /dev/null
+++ b/neethi/src/secpolicy/model/asymmetric_binding.c
@@ -0,0 +1,160 @@
+/*
+ * 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 <rp_asymmetric_binding.h>
+
+struct rp_asymmetric_binding_t
+{
+ rp_symmetric_asymmetric_binding_commons_t *symmetric_asymmetric_binding_commons;
+ rp_property_t *initiator_token;
+ rp_property_t *recipient_token;
+ int ref;
+};
+
+AXIS2_EXTERN rp_asymmetric_binding_t *AXIS2_CALL
+rp_asymmetric_binding_create(
+ const axutil_env_t *env)
+{
+ rp_asymmetric_binding_t *asymmetric_binding = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ asymmetric_binding = (rp_asymmetric_binding_t *)AXIS2_MALLOC(env->allocator,
+ sizeof(rp_asymmetric_binding_t));
+
+ if(asymmetric_binding == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ return NULL;
+ }
+ asymmetric_binding->symmetric_asymmetric_binding_commons = NULL;
+ asymmetric_binding->initiator_token = NULL;
+ asymmetric_binding->recipient_token = NULL;
+ asymmetric_binding->ref = 0;
+
+ return asymmetric_binding;
+
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_asymmetric_binding_free(
+ rp_asymmetric_binding_t *asymmetric_binding,
+ const axutil_env_t *env)
+{
+ if(asymmetric_binding)
+ {
+
+ if(--(asymmetric_binding->ref) > 0)
+ {
+ return;
+ }
+
+ if(asymmetric_binding->symmetric_asymmetric_binding_commons)
+ {
+ rp_symmetric_asymmetric_binding_commons_free(
+ asymmetric_binding-> symmetric_asymmetric_binding_commons, env);
+ asymmetric_binding->symmetric_asymmetric_binding_commons = NULL;
+ }
+ if(asymmetric_binding->initiator_token)
+ {
+ rp_property_free(asymmetric_binding->initiator_token, env);
+ asymmetric_binding->initiator_token = NULL;
+ }
+ if(asymmetric_binding->recipient_token)
+ {
+ rp_property_free(asymmetric_binding->recipient_token, env);
+ asymmetric_binding->recipient_token = NULL;
+ }
+ AXIS2_FREE(env->allocator, asymmetric_binding);
+ }
+
+ return;
+}
+
+/* Implementations */
+
+AXIS2_EXTERN rp_symmetric_asymmetric_binding_commons_t *AXIS2_CALL
+rp_asymmetric_binding_get_symmetric_asymmetric_binding_commons(
+ rp_asymmetric_binding_t *asymmetric_binding,
+ const axutil_env_t *env)
+{
+ return asymmetric_binding->symmetric_asymmetric_binding_commons;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_asymmetric_binding_set_symmetric_asymmetric_binding_commons(
+ rp_asymmetric_binding_t *asymmetric_binding,
+ const axutil_env_t *env,
+ rp_symmetric_asymmetric_binding_commons_t * symmetric_asymmetric_binding_commons)
+{
+ AXIS2_PARAM_CHECK(env->error, symmetric_asymmetric_binding_commons, AXIS2_FAILURE);
+
+ asymmetric_binding->symmetric_asymmetric_binding_commons = symmetric_asymmetric_binding_commons;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_property_t *AXIS2_CALL
+rp_asymmetric_binding_get_initiator_token(
+ rp_asymmetric_binding_t *asymmetric_binding,
+ const axutil_env_t *env)
+{
+ return asymmetric_binding->initiator_token;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_asymmetric_binding_set_initiator_token(
+ rp_asymmetric_binding_t *asymmetric_binding,
+ const axutil_env_t *env,
+ rp_property_t *initiator_token)
+{
+ AXIS2_PARAM_CHECK(env->error, initiator_token, AXIS2_FAILURE);
+
+ rp_property_increment_ref(initiator_token, env);
+ asymmetric_binding->initiator_token = initiator_token;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_asymmetric_binding_set_recipient_token(
+ rp_asymmetric_binding_t *asymmetric_binding,
+ const axutil_env_t *env,
+ rp_property_t *recipient_token)
+{
+ AXIS2_PARAM_CHECK(env->error, recipient_token, AXIS2_FAILURE);
+
+ rp_property_increment_ref(recipient_token, env);
+ asymmetric_binding->recipient_token = recipient_token;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_property_t *AXIS2_CALL
+rp_asymmetric_binding_get_recipient_token(
+ rp_asymmetric_binding_t *asymmetric_binding,
+ const axutil_env_t *env)
+{
+ return asymmetric_binding->recipient_token;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_asymmetric_binding_increment_ref(
+ rp_asymmetric_binding_t *asymmetric_binding,
+ const axutil_env_t *env)
+{
+ asymmetric_binding->ref++;
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/model/binding_commons.c b/neethi/src/secpolicy/model/binding_commons.c
new file mode 100644
index 0000000..9795c78
--- /dev/null
+++ b/neethi/src/secpolicy/model/binding_commons.c
@@ -0,0 +1,245 @@
+/*
+ * 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 <rp_binding_commons.h>
+
+struct rp_binding_commons_t
+{
+ rp_algorithmsuite_t *algorithmsuite;
+ axis2_bool_t include_timestamp;
+ rp_layout_t *layout;
+ rp_supporting_tokens_t *signed_supporting_tokens;
+ rp_supporting_tokens_t *signed_endorsing_supporting_tokens;
+ rp_supporting_tokens_t *endorsing_supporting_tokens;
+ rp_supporting_tokens_t *supporting_tokens;
+};
+
+AXIS2_EXTERN rp_binding_commons_t *AXIS2_CALL
+rp_binding_commons_create(
+ const axutil_env_t *env)
+{
+ rp_binding_commons_t *binding_commons = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ binding_commons = (rp_binding_commons_t *)AXIS2_MALLOC(env->allocator,
+ sizeof(rp_binding_commons_t));
+
+ if(binding_commons == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ return NULL;
+ }
+ binding_commons->algorithmsuite = NULL;
+ binding_commons->include_timestamp = AXIS2_FALSE;
+ binding_commons->layout = NULL;
+ binding_commons->signed_supporting_tokens = NULL;
+ binding_commons->signed_endorsing_supporting_tokens = NULL;
+ binding_commons->endorsing_supporting_tokens = NULL;
+ binding_commons->supporting_tokens = NULL;
+
+ return binding_commons;
+
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_binding_commons_free(
+ rp_binding_commons_t *binding_commons,
+ const axutil_env_t *env)
+{
+ if(binding_commons)
+ {
+ if(binding_commons->algorithmsuite)
+ {
+ rp_algorithmsuite_free(binding_commons->algorithmsuite, env);
+ binding_commons->algorithmsuite = NULL;
+ }
+ if(binding_commons->layout)
+ {
+ rp_layout_free(binding_commons->layout, env);
+ binding_commons->layout = NULL;
+ }
+ if(binding_commons->signed_supporting_tokens)
+ {
+ rp_supporting_tokens_free(binding_commons->signed_supporting_tokens, env);
+ binding_commons->signed_supporting_tokens = NULL;
+ }
+ if(binding_commons->signed_endorsing_supporting_tokens)
+ {
+ rp_supporting_tokens_free(binding_commons-> signed_endorsing_supporting_tokens, env);
+ binding_commons->signed_endorsing_supporting_tokens = NULL;
+ }
+ if(binding_commons->endorsing_supporting_tokens)
+ {
+ rp_supporting_tokens_free(binding_commons-> endorsing_supporting_tokens, env);
+ binding_commons->endorsing_supporting_tokens = NULL;
+ }
+ if(binding_commons->supporting_tokens)
+ {
+ rp_supporting_tokens_free(binding_commons->supporting_tokens, env);
+ binding_commons->supporting_tokens = NULL;
+ }
+ AXIS2_FREE(env->allocator, binding_commons);
+ binding_commons = NULL;
+
+ }
+ return;
+}
+
+/* Implementations */
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_binding_commons_get_include_timestamp(
+ rp_binding_commons_t *binding_commons,
+ const axutil_env_t *env)
+{
+ return binding_commons->include_timestamp;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_binding_commons_set_include_timestamp(
+ rp_binding_commons_t *binding_commons,
+ const axutil_env_t *env,
+ axis2_bool_t include_timestamp)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, include_timestamp, AXIS2_FAILURE);
+
+ binding_commons->include_timestamp = include_timestamp;
+
+ return AXIS2_SUCCESS;
+
+}
+
+AXIS2_EXTERN rp_algorithmsuite_t *AXIS2_CALL
+rp_binding_commons_get_algorithmsuite(
+ rp_binding_commons_t *binding_commons,
+ const axutil_env_t *env)
+{
+ return binding_commons->algorithmsuite;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_binding_commons_set_algorithmsuite(
+ rp_binding_commons_t *binding_commons,
+ const axutil_env_t *env,
+ rp_algorithmsuite_t *algorithmsuite)
+{
+ AXIS2_PARAM_CHECK(env->error, algorithmsuite, AXIS2_FAILURE);
+
+ rp_algorithmsuite_increment_ref(algorithmsuite, env);
+ binding_commons->algorithmsuite = algorithmsuite;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_layout_t *AXIS2_CALL
+rp_binding_commons_get_layout(
+ rp_binding_commons_t *binding_commons,
+ const axutil_env_t *env)
+{
+ return binding_commons->layout;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_binding_commons_set_layout(
+ rp_binding_commons_t *binding_commons,
+ const axutil_env_t *env,
+ rp_layout_t *layout)
+{
+ AXIS2_PARAM_CHECK(env->error, layout, AXIS2_FAILURE);
+ rp_layout_increment_ref(layout, env);
+ binding_commons->layout = layout;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_supporting_tokens_t *AXIS2_CALL
+rp_binding_commons_get_signed_supporting_tokens(
+ rp_binding_commons_t *binding_commons,
+ const axutil_env_t *env)
+{
+ return binding_commons->signed_supporting_tokens;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_binding_commons_set_signed_supporting_tokens(
+ rp_binding_commons_t *binding_commons,
+ const axutil_env_t *env,
+ rp_supporting_tokens_t *signed_supporting_tokens)
+{
+ AXIS2_PARAM_CHECK(env->error, signed_supporting_tokens, AXIS2_FAILURE);
+ binding_commons->signed_supporting_tokens = signed_supporting_tokens;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_supporting_tokens_t *AXIS2_CALL
+rp_binding_commons_get_signed_endorsing_supporting_tokens(
+ rp_binding_commons_t *binding_commons,
+ const axutil_env_t *env)
+{
+ return binding_commons->signed_endorsing_supporting_tokens;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_binding_commons_set_signed_endorsing_supporting_tokens(
+ rp_binding_commons_t *binding_commons,
+ const axutil_env_t *env,
+ rp_supporting_tokens_t *signed_endorsing_supporting_tokens)
+{
+ AXIS2_PARAM_CHECK(env->error, signed_endorsing_supporting_tokens, AXIS2_FAILURE);
+
+ binding_commons->signed_endorsing_supporting_tokens = signed_endorsing_supporting_tokens;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_supporting_tokens_t *AXIS2_CALL
+rp_binding_commons_get_endorsing_supporting_tokens(
+ rp_binding_commons_t *binding_commons,
+ const axutil_env_t *env)
+{
+ return binding_commons->endorsing_supporting_tokens;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_binding_commons_set_endorsing_supporting_tokens(
+ rp_binding_commons_t *binding_commons,
+ const axutil_env_t *env,
+ rp_supporting_tokens_t *endorsing_supporting_tokens)
+{
+ AXIS2_PARAM_CHECK(env->error, endorsing_supporting_tokens, AXIS2_FAILURE);
+ binding_commons->endorsing_supporting_tokens = endorsing_supporting_tokens;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_supporting_tokens_t *AXIS2_CALL
+rp_binding_commons_get_supporting_tokens(
+ rp_binding_commons_t *binding_commons,
+ const axutil_env_t *env)
+{
+ return binding_commons->supporting_tokens;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_binding_commons_set_supporting_tokens(
+ rp_binding_commons_t *binding_commons,
+ const axutil_env_t *env,
+ rp_supporting_tokens_t *supporting_tokens)
+{
+ AXIS2_PARAM_CHECK(env->error, supporting_tokens, AXIS2_FAILURE);
+ binding_commons->supporting_tokens = supporting_tokens;
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/model/element.c b/neethi/src/secpolicy/model/element.c
new file mode 100644
index 0000000..125fef3
--- /dev/null
+++ b/neethi/src/secpolicy/model/element.c
@@ -0,0 +1,112 @@
+/*
+ * 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 <rp_element.h>
+
+struct rp_element_t
+{
+ axis2_char_t *name;
+ axis2_char_t *nspace;
+};
+
+AXIS2_EXTERN rp_element_t *AXIS2_CALL
+rp_element_create(
+ const axutil_env_t * env)
+{
+ rp_element_t *element = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ element = (rp_element_t *)AXIS2_MALLOC(env->allocator, sizeof(rp_element_t));
+
+ if(element == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ element->name = NULL;
+ element->nspace = NULL;
+
+ return element;
+
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_element_free(
+ rp_element_t * element,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ if(element)
+ {
+ AXIS2_FREE(env->allocator, element);
+ element = NULL;
+ }
+ return;
+}
+
+/* Implementations */
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_element_get_name(
+ rp_element_t * element,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return element->name;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_element_set_name(
+ rp_element_t * element,
+ const axutil_env_t * env,
+ axis2_char_t * name)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, name, AXIS2_FAILURE);
+
+ element->name = name;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_element_get_namespace(
+ rp_element_t * element,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return element->nspace;
+
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_element_set_namespace(
+ rp_element_t * element,
+ const axutil_env_t * env,
+ axis2_char_t * nspace)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, nspace, AXIS2_FAILURE);
+
+ element->nspace = nspace;
+
+ return AXIS2_SUCCESS;
+
+}
diff --git a/neethi/src/secpolicy/model/header.c b/neethi/src/secpolicy/model/header.c
new file mode 100644
index 0000000..9aab978
--- /dev/null
+++ b/neethi/src/secpolicy/model/header.c
@@ -0,0 +1,123 @@
+/*
+ * 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 <rp_header.h>
+
+struct rp_header_t
+{
+ axis2_char_t *name;
+ axis2_char_t *nspace;
+};
+
+AXIS2_EXTERN rp_header_t *AXIS2_CALL
+rp_header_create(
+ const axutil_env_t * env)
+{
+ rp_header_t *header = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ header = (rp_header_t *)AXIS2_MALLOC(env->allocator, sizeof(rp_header_t));
+
+ if(header == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ header->name = NULL;
+ header->nspace = NULL;
+
+ return header;
+
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_header_free(
+ rp_header_t * header,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ if(header)
+ {
+ if(header->name)
+ {
+ AXIS2_FREE(env->allocator, header->name);
+ header->name = NULL;
+ }
+ if(header->nspace)
+ {
+ AXIS2_FREE(env->allocator, header->nspace);
+ header->nspace = NULL;
+ }
+
+ AXIS2_FREE(env->allocator, header);
+ header = NULL;
+ }
+ return;
+}
+
+/* Implementations */
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_header_get_name(
+ rp_header_t * header,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return header->name;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_header_set_name(
+ rp_header_t * header,
+ const axutil_env_t * env,
+ axis2_char_t * name)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, name, AXIS2_FAILURE);
+
+ header->name = axutil_strdup(env, name);
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_header_get_namespace(
+ rp_header_t * header,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return header->nspace;
+
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_header_set_namespace(
+ rp_header_t * header,
+ const axutil_env_t * env,
+ axis2_char_t * nspace)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, nspace, AXIS2_FAILURE);
+
+ header->nspace = axutil_strdup(env, nspace);
+
+ return AXIS2_SUCCESS;
+
+}
diff --git a/neethi/src/secpolicy/model/https_token.c b/neethi/src/secpolicy/model/https_token.c
new file mode 100644
index 0000000..100af45
--- /dev/null
+++ b/neethi/src/secpolicy/model/https_token.c
@@ -0,0 +1,153 @@
+/*
+ * 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 <rp_https_token.h>
+
+struct rp_https_token_t
+{
+ axis2_char_t *inclusion;
+ axis2_bool_t derivedkeys;
+ axis2_bool_t require_client_certificate;
+ int ref;
+};
+
+AXIS2_EXTERN rp_https_token_t *AXIS2_CALL
+rp_https_token_create(
+ const axutil_env_t * env)
+{
+ rp_https_token_t *https_token = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ https_token = (rp_https_token_t *)AXIS2_MALLOC(env->allocator, sizeof(rp_https_token_t));
+
+ if(https_token == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ https_token->inclusion = RP_INCLUDE_ALWAYS;
+ https_token->derivedkeys = AXIS2_FALSE;
+ https_token->require_client_certificate = AXIS2_FALSE;
+ https_token->ref = 0;
+
+ return https_token;
+
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_https_token_free(
+ rp_https_token_t * https_token,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ if(https_token)
+ {
+ if(--(https_token->ref) > 0)
+ {
+ return;
+ }
+ AXIS2_FREE(env->allocator, https_token);
+ https_token = NULL;
+ }
+ return;
+}
+
+/* Implementations */
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_https_token_get_inclusion(
+ rp_https_token_t * https_token,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return https_token->inclusion;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_https_token_set_inclusion(
+ rp_https_token_t * https_token,
+ const axutil_env_t * env,
+ axis2_char_t * inclusion)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, inclusion, AXIS2_FAILURE);
+
+ https_token->inclusion = inclusion;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_https_token_get_derivedkeys(
+ rp_https_token_t * https_token,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ return https_token->derivedkeys;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_https_token_set_derivedkeys(
+ rp_https_token_t * https_token,
+ const axutil_env_t * env,
+ axis2_bool_t derivedkeys)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, derivedkeys, AXIS2_FAILURE);
+
+ https_token->derivedkeys = derivedkeys;
+
+ return AXIS2_SUCCESS;
+
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_https_token_get_require_client_certificate(
+ rp_https_token_t * https_token,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return https_token->require_client_certificate;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_https_token_set_require_client_certificate(
+ rp_https_token_t * https_token,
+ const axutil_env_t * env,
+ axis2_bool_t require_client_certificate)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, require_client_certificate, AXIS2_FAILURE)
+ https_token->require_client_certificate = require_client_certificate;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_https_token_increment_ref(
+ rp_https_token_t * https_token,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ https_token->ref++;
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/model/issued_token.c b/neethi/src/secpolicy/model/issued_token.c
new file mode 100644
index 0000000..00948f2
--- /dev/null
+++ b/neethi/src/secpolicy/model/issued_token.c
@@ -0,0 +1,211 @@
+/*
+ * 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 <rp_issued_token.h>
+
+struct rp_issued_token
+{
+ axis2_char_t *inclusion;
+ axiom_node_t *issuer_epr;
+ axiom_node_t *requested_sec_token_template;
+ axis2_bool_t derivedkeys;
+ axis2_bool_t require_external_reference;
+ axis2_bool_t require_internal_reference;
+ int ref;
+};
+
+AXIS2_EXTERN rp_issued_token_t * AXIS2_CALL
+rp_issued_token_create(
+ const axutil_env_t *env)
+{
+ rp_issued_token_t *issued_token = NULL;
+
+ issued_token = (rp_issued_token_t*)AXIS2_MALLOC(env->allocator, sizeof(rp_issued_token_t));
+
+ if(issued_token == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
+ issued_token->inclusion = NULL;
+ issued_token->issuer_epr = NULL;
+ issued_token->requested_sec_token_template = NULL;
+ issued_token->derivedkeys = AXIS2_FALSE;
+ issued_token->require_external_reference = AXIS2_FALSE;
+ issued_token->require_internal_reference = AXIS2_FALSE;
+ issued_token->ref = 0;
+
+ return issued_token;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_issued_token_free(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env)
+{
+ if(issued_token)
+ {
+ if(--(issued_token->ref) > 0)
+ {
+ return;
+ }
+
+ AXIS2_FREE(env->allocator, issued_token);
+ issued_token = NULL;
+ }
+ return;
+}
+
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+rp_issued_token_get_inclusion(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env)
+{
+ return issued_token->inclusion;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_issued_token_set_inclusion(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env,
+ axis2_char_t *inclusion)
+{
+ if(inclusion)
+ {
+ issued_token->inclusion = inclusion;
+ return AXIS2_SUCCESS;
+ }
+
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN axiom_node_t * AXIS2_CALL
+rp_issued_token_get_issuer_epr(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env)
+{
+ return issued_token->issuer_epr;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_issued_token_set_issuer_epr(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env,
+ axiom_node_t *issuer_epr)
+{
+ if(issuer_epr)
+ {
+ issued_token->issuer_epr = issuer_epr;
+ return AXIS2_SUCCESS;
+ }
+
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN axiom_node_t * AXIS2_CALL
+rp_issued_token_get_requested_sec_token_template(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env)
+{
+ return issued_token->requested_sec_token_template;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_issued_token_set_requested_sec_token_template(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env,
+ axiom_node_t *req_sec_token_template)
+{
+ if(req_sec_token_template)
+ {
+ issued_token->requested_sec_token_template = req_sec_token_template;
+ return AXIS2_SUCCESS;
+ }
+
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_issued_token_get_derivedkeys(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env)
+{
+ return issued_token->derivedkeys;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_issued_token_set_derivedkeys(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env,
+ axis2_bool_t derivedkeys)
+{
+ AXIS2_PARAM_CHECK(env->error, derivedkeys, AXIS2_FAILURE);
+ issued_token->derivedkeys = derivedkeys;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_issued_token_get_require_external_reference(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env)
+{
+ return issued_token->require_external_reference;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_issued_token_set_require_exernal_reference(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env,
+ axis2_bool_t require_external_reference)
+{
+ AXIS2_PARAM_CHECK(env->error, require_external_reference, AXIS2_FAILURE);
+ issued_token->require_external_reference = require_external_reference;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_issued_token_get_require_internal_reference(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env)
+{
+ return issued_token->require_internal_reference;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_issued_token_set_require_internal_reference(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env,
+ axis2_bool_t require_internal_reference)
+{
+ AXIS2_PARAM_CHECK(env->error, require_internal_reference, AXIS2_FAILURE);
+ issued_token->require_internal_reference = require_internal_reference;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_issued_token_increment_ref(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env)
+{
+ issued_token->ref++;
+ return AXIS2_SUCCESS;
+}
+
diff --git a/neethi/src/secpolicy/model/layout.c b/neethi/src/secpolicy/model/layout.c
new file mode 100644
index 0000000..b4591c4
--- /dev/null
+++ b/neethi/src/secpolicy/model/layout.c
@@ -0,0 +1,99 @@
+/*
+ * 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 <rp_layout.h>
+
+struct rp_layout_t
+{
+ axis2_char_t *value;
+ int ref;
+};
+
+AXIS2_EXTERN rp_layout_t *AXIS2_CALL
+rp_layout_create(
+ const axutil_env_t * env)
+{
+ rp_layout_t *layout = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ layout = (rp_layout_t *)AXIS2_MALLOC(env->allocator, sizeof(rp_layout_t));
+
+ if(layout == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ layout->value = RP_LAYOUT_STRICT;
+ layout->ref = 0;
+ return layout;
+
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_layout_free(
+ rp_layout_t * layout,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ if(layout)
+ {
+ if(--(layout->ref) > 0)
+ {
+ return;
+ }
+ AXIS2_FREE(env->allocator, layout);
+ layout = NULL;
+ }
+ return;
+}
+
+/* Implementations */
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_layout_get_value(
+ rp_layout_t * layout,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return layout->value;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_layout_set_value(
+ rp_layout_t * layout,
+ const axutil_env_t * env,
+ axis2_char_t * value)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, value, AXIS2_FAILURE);
+
+ layout->value = value;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_layout_increment_ref(
+ rp_layout_t * layout,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ layout->ref++;
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/model/property.c b/neethi/src/secpolicy/model/property.c
new file mode 100644
index 0000000..a8d806c
--- /dev/null
+++ b/neethi/src/secpolicy/model/property.c
@@ -0,0 +1,265 @@
+/*
+ * 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 <rp_property.h>
+#include <rp_symmetric_binding.h>
+#include <rp_asymmetric_binding.h>
+#include <rp_transport_binding.h>
+#include <rp_supporting_tokens.h>
+#include <rp_wss10.h>
+#include <rp_wss11.h>
+
+struct rp_property_t
+{
+ rp_property_type_t type;
+ void *value;
+ int ref;
+};
+
+AXIS2_EXTERN rp_property_t *AXIS2_CALL
+rp_property_create(
+ const axutil_env_t * env)
+{
+ rp_property_t *property = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ property = (rp_property_t *)AXIS2_MALLOC(env->allocator, sizeof(rp_property_t));
+
+ if(property == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ property->type = RP_PROPERTY_UNKNOWN;
+ property->value = NULL;
+ property->ref = 0;
+
+ return property;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_property_free(
+ rp_property_t * property,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ if(property)
+ {
+ if(--(property->ref) > 0)
+ {
+ return;
+ }
+
+ if(property->value)
+ {
+ switch(property->type)
+ {
+ case RP_PROPERTY_USERNAME_TOKEN:
+ rp_username_token_free((rp_username_token_t *)property->value, env);
+ property->value = NULL;
+ break;
+
+ case RP_PROPERTY_X509_TOKEN:
+ rp_x509_token_free((rp_x509_token_t *)property->value, env);
+ property->value = NULL;
+ break;
+
+ case RP_PROPERTY_ISSUED_TOKEN:
+ rp_issued_token_free((rp_issued_token_t *)property->value, env);
+ property->value = NULL;
+ break;
+
+ case RP_PROPERTY_SAML_TOKEN:
+ rp_saml_token_free((rp_saml_token_t *)property->value, env);
+ property->value = NULL;
+ break;
+
+ case RP_PROPERTY_SECURITY_CONTEXT_TOKEN:
+ rp_security_context_token_free((rp_security_context_token_t *)property->value,
+ env);
+ property->value = NULL;
+ break;
+
+ case RP_PROPERTY_HTTPS_TOKEN:
+ rp_https_token_free((rp_https_token_t *)property->value, env);
+ property->value = NULL;
+ break;
+
+ case RP_PROPERTY_SYMMETRIC_BINDING:
+ rp_symmetric_binding_free((rp_symmetric_binding_t *)property-> value, env);
+ property->value = NULL;
+ break;
+
+ case RP_PROPERTY_ASYMMETRIC_BINDING:
+ rp_asymmetric_binding_free((rp_asymmetric_binding_t *)property->value, env);
+ property->value = NULL;
+ break;
+
+ case RP_PROPERTY_TRANSPORT_BINDING:
+ rp_transport_binding_free((rp_transport_binding_t *)property-> value, env);
+ property->value = NULL;
+ break;
+
+ case RP_PROPERTY_SIGNED_SUPPORTING_TOKEN:
+ rp_supporting_tokens_free((rp_supporting_tokens_t *)property-> value, env);
+ property->value = NULL;
+ break;
+
+ case RP_PROPERTY_SIGNED_ENDORSING_SUPPORTING_TOKEN:
+ rp_supporting_tokens_free((rp_supporting_tokens_t *)property-> value, env);
+ property->value = NULL;
+ break;
+
+ case RP_PROPERTY_SUPPORTING_SUPPORTING_TOKEN:
+ rp_supporting_tokens_free((rp_supporting_tokens_t *)property-> value, env);
+ property->value = NULL;
+ break;
+
+ case RP_PROPERTY_ENDORSING_SUPPORTING_TOKEN:
+ rp_supporting_tokens_free((rp_supporting_tokens_t *)property-> value, env);
+ property->value = NULL;
+ break;
+
+ case RP_PROPERTY_SUPPORTING_TOKEN:
+ rp_supporting_tokens_free((rp_supporting_tokens_t *)property-> value, env);
+ property->value = NULL;
+ break;
+
+ case RP_PROPERTY_WSS10:
+ rp_wss10_free((rp_wss10_t *)property->value, env);
+ property->value = NULL;
+ break;
+
+ case RP_PROPERTY_WSS11:
+ rp_wss11_free((rp_wss11_t *)property->value, env);
+ property->value = NULL;
+ break;
+
+ case RP_PROPERTY_UNKNOWN:
+ break;
+ }
+ }
+ AXIS2_FREE(env->allocator, property);
+ }
+
+ return;
+}
+
+/* Implementations */
+AXIS2_EXTERN void *AXIS2_CALL
+rp_property_get_value(
+ rp_property_t * property,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return property->value;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_property_set_value(
+ rp_property_t * property,
+ const axutil_env_t * env,
+ void *value,
+ rp_property_type_t type)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, value, AXIS2_FAILURE);
+
+ property->type = type;
+
+ if(type == RP_PROPERTY_X509_TOKEN)
+ {
+ rp_x509_token_increment_ref((rp_x509_token_t *)value, env);
+ }
+ else if(type == RP_PROPERTY_SECURITY_CONTEXT_TOKEN)
+ {
+ rp_security_context_token_increment_ref((rp_security_context_token_t *)value, env);
+ }
+ else if(type == RP_PROPERTY_WSS10)
+ {
+ rp_wss10_increment_ref((rp_wss10_t *)value, env);
+ }
+ else if(type == RP_PROPERTY_WSS11)
+ {
+ rp_wss11_increment_ref((rp_wss11_t *)value, env);
+ }
+ else if(type == RP_PROPERTY_USERNAME_TOKEN)
+ {
+ rp_username_token_increment_ref((rp_username_token_t *)value, env);
+ }
+
+ else if(type == RP_PROPERTY_HTTPS_TOKEN)
+ {
+ rp_https_token_increment_ref((rp_https_token_t *)value, env);
+ }
+
+ else if(type == RP_PROPERTY_SIGNED_SUPPORTING_TOKEN)
+ {
+ rp_supporting_tokens_increment_ref((rp_supporting_tokens_t *)value, env);
+ }
+ else if(type == RP_PROPERTY_SUPPORTING_SUPPORTING_TOKEN)
+ {
+ rp_supporting_tokens_increment_ref((rp_supporting_tokens_t *)value, env);
+ }
+ else if(type == RP_PROPERTY_SIGNED_ENDORSING_SUPPORTING_TOKEN)
+ {
+ rp_supporting_tokens_increment_ref((rp_supporting_tokens_t *)value, env);
+ }
+ else if(type == RP_PROPERTY_ENDORSING_SUPPORTING_TOKEN)
+ {
+ rp_supporting_tokens_increment_ref((rp_supporting_tokens_t *)value, env);
+ }
+ else if(type == RP_PROPERTY_ASYMMETRIC_BINDING)
+ {
+ rp_asymmetric_binding_increment_ref((rp_asymmetric_binding_t *)value, env);
+ }
+ else if(type == RP_PROPERTY_TRANSPORT_BINDING)
+ {
+ rp_transport_binding_increment_ref((rp_transport_binding_t *)value, env);
+ }
+ else if(type == RP_PROPERTY_SYMMETRIC_BINDING)
+ {
+ rp_symmetric_binding_increment_ref((rp_symmetric_binding_t *)value, env);
+ }
+ property->value = (void *)value;
+
+ return AXIS2_SUCCESS;
+
+}
+
+AXIS2_EXTERN rp_property_type_t AXIS2_CALL
+rp_property_get_type(
+ rp_property_t * property,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return property->type;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_property_increment_ref(
+ rp_property_t * property,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ property->ref++;
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/model/rampart_config.c b/neethi/src/secpolicy/model/rampart_config.c
new file mode 100644
index 0000000..ba8bebd
--- /dev/null
+++ b/neethi/src/secpolicy/model/rampart_config.c
@@ -0,0 +1,446 @@
+/*
+ * 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 <rp_rampart_config.h>
+
+struct rp_rampart_config_t
+{
+ axis2_char_t *user;
+ axis2_char_t *encryption_user;
+ axis2_char_t *password_callback_class;
+ axis2_char_t *authenticate_module;
+ axis2_char_t *replay_detector;
+ axis2_char_t *sct_provider;
+ axis2_char_t *password_type;
+ axis2_char_t *time_to_live;
+ axis2_char_t *clock_skew_buffer;
+ axis2_char_t *need_millisecond_precision;
+ axis2_char_t *receiver_certificate_file;
+ axis2_char_t *certificate_file;
+ axis2_char_t *private_key_file;
+ axis2_char_t *pkcs12_file;
+ axis2_char_t *rd_val;
+ int ref;
+};
+
+AXIS2_EXTERN rp_rampart_config_t *AXIS2_CALL
+rp_rampart_config_create(
+ const axutil_env_t * env)
+{
+ rp_rampart_config_t *rampart_config = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ rampart_config = (rp_rampart_config_t *)AXIS2_MALLOC(env->allocator,
+ sizeof(rp_rampart_config_t));
+
+ if(rampart_config == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ rampart_config->user = NULL;
+ rampart_config->encryption_user = NULL;
+ rampart_config->password_callback_class = NULL;
+ rampart_config->private_key_file = NULL;
+ rampart_config->receiver_certificate_file = NULL;
+ rampart_config->certificate_file = NULL;
+ rampart_config->authenticate_module = NULL;
+ rampart_config->replay_detector = NULL;
+ rampart_config->sct_provider = NULL;
+ rampart_config->password_type = NULL;
+ rampart_config->time_to_live = NULL;
+ rampart_config->clock_skew_buffer = NULL;
+ rampart_config->need_millisecond_precision = NULL;
+ rampart_config->pkcs12_file = NULL;
+ rampart_config->rd_val = NULL;
+ rampart_config->ref = 0;
+
+ return rampart_config;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_rampart_config_free(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ if(rampart_config)
+ {
+ if(--(rampart_config->ref) > 0)
+ {
+ return;
+ }
+
+ AXIS2_FREE(env->allocator, rampart_config);
+ rampart_config = NULL;
+ }
+ return;
+}
+
+/* Implementations */
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_rampart_config_get_user(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return rampart_config->user;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_rampart_config_set_user(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * user)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, user, AXIS2_FAILURE);
+
+ rampart_config->user = user;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_rampart_config_get_encryption_user(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return rampart_config->encryption_user;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_rampart_config_set_encryption_user(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * encryption_user)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, encryption_user, AXIS2_FAILURE);
+
+ rampart_config->encryption_user = encryption_user;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_rampart_config_get_password_callback_class(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return rampart_config->password_callback_class;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_rampart_config_set_password_callback_class(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * password_callback_class)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, password_callback_class, AXIS2_FAILURE);
+
+ rampart_config->password_callback_class = password_callback_class;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_rampart_config_get_authenticate_module(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return rampart_config->authenticate_module;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_rampart_config_set_authenticate_module(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * authenticate_module)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, authenticate_module, AXIS2_FAILURE);
+
+ rampart_config->authenticate_module = authenticate_module;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_rampart_config_get_replay_detector(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return rampart_config->replay_detector;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_rampart_config_set_replay_detector(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * replay_detector)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, replay_detector, AXIS2_FAILURE);
+
+ rampart_config->replay_detector = replay_detector;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_rampart_config_get_sct_provider(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return rampart_config->sct_provider;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_rampart_config_set_sct_provider(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * sct_module)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, sct_module, AXIS2_FAILURE);
+
+ rampart_config->sct_provider = sct_module;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_rampart_config_get_password_type(
+ rp_rampart_config_t * rampart_config,
+ const axutil_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 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_char_t *AXIS2_CALL
+rp_rampart_config_get_private_key_file(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return rampart_config->private_key_file;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_rampart_config_set_private_key_file(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * private_key_file)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, private_key_file, AXIS2_FAILURE);
+
+ rampart_config->private_key_file = private_key_file;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_rampart_config_get_receiver_certificate_file(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return rampart_config->receiver_certificate_file;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_rampart_config_set_receiver_certificate_file(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * receiver_certificate_file)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, receiver_certificate_file, AXIS2_FAILURE);
+
+ rampart_config->receiver_certificate_file = receiver_certificate_file;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_rampart_config_get_certificate_file(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return rampart_config->certificate_file;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_rampart_config_set_certificate_file(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * certificate_file)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, certificate_file, AXIS2_FAILURE);
+
+ rampart_config->certificate_file = certificate_file;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_rampart_config_get_time_to_live(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return rampart_config->time_to_live;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_rampart_config_set_time_to_live(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * time_to_live)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, time_to_live, AXIS2_FAILURE);
+
+ rampart_config->time_to_live = time_to_live;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_rampart_config_get_clock_skew_buffer(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env)
+{
+ return rampart_config->clock_skew_buffer;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_rampart_config_set_clock_skew_buffer(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * clock_skew_buffer)
+{
+ rampart_config->clock_skew_buffer = clock_skew_buffer;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_rampart_config_get_need_millisecond_precision(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env)
+{
+ return rampart_config->need_millisecond_precision;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_rampart_config_set_need_millisecond_precision(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * need_millisecond_precision)
+{
+ rampart_config->need_millisecond_precision = need_millisecond_precision;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_rampart_config_get_pkcs12_file(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env)
+{
+ return rampart_config->pkcs12_file;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_rampart_config_set_pkcs12_file(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t *env,
+ axis2_char_t * pkcs12_file)
+{
+ if(rampart_config)
+ {
+ if(pkcs12_file)
+ {
+ rampart_config->pkcs12_file = pkcs12_file;
+ return AXIS2_SUCCESS;
+ }
+
+ return AXIS2_FAILURE;
+ }
+
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_rampart_config_get_rd_val(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return rampart_config->rd_val;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_rampart_config_set_rd_val(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * rd_val)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, rd_val, AXIS2_FAILURE);
+
+ rampart_config->rd_val = rd_val;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_rampart_config_increment_ref(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ rampart_config->ref++;
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/model/saml_token.c b/neethi/src/secpolicy/model/saml_token.c
new file mode 100644
index 0000000..ae0f1ea
--- /dev/null
+++ b/neethi/src/secpolicy/model/saml_token.c
@@ -0,0 +1,160 @@
+/*
+ * 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 <rp_saml_token.h>
+
+struct rp_saml_token
+{
+ axis2_char_t *inclusion;
+ axis2_bool_t derivedkeys;
+ axis2_bool_t require_key_identifier_reference;
+ axis2_char_t *token_version_and_type;
+ int ref;
+};
+
+AXIS2_EXTERN rp_saml_token_t * AXIS2_CALL
+rp_saml_token_create(
+ const axutil_env_t *env)
+{
+ rp_saml_token_t * saml_token;
+
+ saml_token = (rp_saml_token_t*)AXIS2_MALLOC(env->allocator, sizeof(rp_saml_token_t));
+
+ if(saml_token == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
+ saml_token->inclusion = NULL;
+ saml_token->derivedkeys = AXIS2_FALSE;
+ saml_token->require_key_identifier_reference = AXIS2_FALSE;
+ saml_token->token_version_and_type = NULL;
+ saml_token->ref = 0;
+
+ return saml_token;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_saml_token_free(
+ rp_saml_token_t *saml_token,
+ const axutil_env_t *env)
+{
+ if(saml_token)
+ {
+ if(--(saml_token->ref) > 0)
+ {
+ return;
+ }
+
+ AXIS2_FREE(env->allocator, saml_token);
+ saml_token = NULL;
+ }
+
+ return;
+}
+
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+rp_saml_token_get_inclusion(
+ rp_saml_token_t *saml_token,
+ const axutil_env_t *env)
+{
+ return saml_token->inclusion;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_saml_token_set_inclusion(
+ rp_saml_token_t *saml_token,
+ const axutil_env_t *env,
+ axis2_char_t * inclusion)
+{
+ AXIS2_PARAM_CHECK(env->error, inclusion, AXIS2_FAILURE);
+ saml_token->inclusion = inclusion;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_saml_token_get_derivedkeys(
+ rp_saml_token_t *saml_token,
+ const axutil_env_t *env)
+{
+ return saml_token->derivedkeys;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_saml_token_set_derivedkeys(
+ rp_saml_token_t *saml_token,
+ const axutil_env_t *env,
+ axis2_bool_t derivedkeys)
+{
+ AXIS2_PARAM_CHECK(env->error, derivedkeys, AXIS2_FAILURE);
+ saml_token->derivedkeys = derivedkeys;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_saml_token_get_require_key_identifier_reference(
+ rp_saml_token_t * saml_token,
+ const axutil_env_t * env)
+{
+ return saml_token->require_key_identifier_reference;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_saml_token_set_require_key_identifier_reference(
+ rp_saml_token_t * saml_token,
+ const axutil_env_t * env,
+ axis2_bool_t require_key_identifier_reference)
+{
+ AXIS2_PARAM_CHECK(env->error, require_key_identifier_reference, AXIS2_FAILURE);
+ saml_token->require_key_identifier_reference = require_key_identifier_reference;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_saml_token_get_token_version_and_type(
+ rp_saml_token_t * saml_token,
+ const axutil_env_t * env)
+{
+ return saml_token->token_version_and_type;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_saml_token_set_token_version_and_type(
+ rp_saml_token_t * saml_token,
+ const axutil_env_t * env,
+ axis2_char_t * token_version_and_type)
+{
+ AXIS2_PARAM_CHECK(env->error, token_version_and_type, AXIS2_FAILURE);
+
+ saml_token->token_version_and_type = token_version_and_type;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_saml_token_increment_ref(
+ rp_saml_token_t * saml_token,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ saml_token->ref++;
+ return AXIS2_SUCCESS;
+}
+
diff --git a/neethi/src/secpolicy/model/secpolicy.c b/neethi/src/secpolicy/model/secpolicy.c
new file mode 100644
index 0000000..fdd112c
--- /dev/null
+++ b/neethi/src/secpolicy/model/secpolicy.c
@@ -0,0 +1,493 @@
+/*
+ * 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 <rp_secpolicy.h>
+
+struct rp_secpolicy_t
+{
+ rp_property_t *binding;
+ rp_property_t *wss;
+ rp_trust10_t *trust10;
+ rp_supporting_tokens_t *supporting_tokens;
+ rp_supporting_tokens_t *signed_supporting_tokens;
+ rp_supporting_tokens_t *endorsing_supporting_tokens;
+ rp_supporting_tokens_t *signed_endorsing_supporting_tokens;
+ rp_signed_encrypted_parts_t *signed_parts;
+ rp_signed_encrypted_parts_t *encrypted_parts;
+ rp_signed_encrypted_elements_t *signed_elements;
+ rp_signed_encrypted_elements_t *encrypted_elements;
+ rp_signed_encrypted_items_t *signed_items;
+ rp_signed_encrypted_items_t *encrypted_items;
+ rp_rampart_config_t *rampart_config;
+
+};
+
+AXIS2_EXTERN rp_secpolicy_t *AXIS2_CALL
+rp_secpolicy_create(
+ const axutil_env_t * env)
+{
+ rp_secpolicy_t *secpolicy = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ secpolicy = (rp_secpolicy_t *)AXIS2_MALLOC(env->allocator, sizeof(rp_secpolicy_t));
+
+ if(secpolicy == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ secpolicy->binding = NULL;
+ secpolicy->wss = NULL;
+ secpolicy->trust10 = NULL;
+ secpolicy->supporting_tokens = NULL;
+ secpolicy->signed_supporting_tokens = NULL;
+ secpolicy->endorsing_supporting_tokens = NULL;
+ secpolicy->signed_endorsing_supporting_tokens = NULL;
+ secpolicy->signed_parts = NULL;
+ secpolicy->encrypted_parts = NULL;
+ secpolicy->signed_elements = NULL;
+ secpolicy->encrypted_elements = NULL;
+ secpolicy->signed_items = NULL;
+ secpolicy->encrypted_items = NULL;
+ secpolicy->rampart_config = NULL;
+
+ return secpolicy;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_secpolicy_free(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ if(secpolicy)
+ {
+ if(secpolicy->binding)
+ {
+ rp_property_free(secpolicy->binding, env);
+ secpolicy->binding = NULL;
+ }
+ if(secpolicy->wss)
+ {
+ rp_property_free(secpolicy->wss, env);
+ secpolicy->wss = NULL;
+ }
+ if(secpolicy->trust10)
+ {
+ rp_trust10_free(secpolicy->trust10, env);
+ secpolicy->trust10 = NULL;
+ }
+ if(secpolicy->supporting_tokens)
+ {
+ rp_supporting_tokens_free(secpolicy->supporting_tokens, env);
+ secpolicy->supporting_tokens = NULL;
+ }
+ if(secpolicy->signed_supporting_tokens)
+ {
+ rp_supporting_tokens_free(secpolicy->signed_supporting_tokens, env);
+ secpolicy->signed_supporting_tokens = NULL;
+ }
+ if(secpolicy->endorsing_supporting_tokens)
+ {
+ rp_supporting_tokens_free(secpolicy->endorsing_supporting_tokens, env);
+ secpolicy->endorsing_supporting_tokens = NULL;
+ }
+ if(secpolicy->signed_endorsing_supporting_tokens)
+ {
+ rp_supporting_tokens_free(secpolicy-> signed_endorsing_supporting_tokens, env);
+ secpolicy->signed_endorsing_supporting_tokens = NULL;
+ }
+ if(secpolicy->signed_parts)
+ {
+ rp_signed_encrypted_parts_free(secpolicy->signed_parts, env);
+ secpolicy->signed_parts = NULL;
+ }
+ if(secpolicy->encrypted_parts)
+ {
+ rp_signed_encrypted_parts_free(secpolicy->encrypted_parts, env);
+ secpolicy->encrypted_parts = NULL;
+ }
+ if(secpolicy->signed_elements)
+ {
+ rp_signed_encrypted_elements_free(secpolicy->signed_elements, env);
+ secpolicy->signed_elements = NULL;
+ }
+ if(secpolicy->encrypted_elements)
+ {
+ rp_signed_encrypted_elements_free(secpolicy->encrypted_elements, env);
+ secpolicy->encrypted_elements = NULL;
+ }
+ if(secpolicy->signed_items)
+ {
+ rp_signed_encrypted_items_free(secpolicy->signed_items, env);
+ secpolicy->signed_items = NULL;
+ }
+ if(secpolicy->encrypted_items)
+ {
+ rp_signed_encrypted_items_free(secpolicy->encrypted_items, env);
+ secpolicy->encrypted_items = NULL;
+ }
+ if(secpolicy->rampart_config)
+ {
+ rp_rampart_config_free(secpolicy->rampart_config, env);
+ secpolicy->rampart_config = NULL;
+ }
+ AXIS2_FREE(env->allocator, secpolicy);
+ }
+
+ return;
+}
+
+/* Implementations */
+AXIS2_EXTERN rp_property_t *AXIS2_CALL
+rp_secpolicy_get_binding(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return secpolicy->binding;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_secpolicy_set_binding(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_property_t * binding)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, binding, AXIS2_FAILURE);
+ rp_property_increment_ref(binding, env);
+ secpolicy->binding = binding;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_secpolicy_set_supporting_tokens(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_supporting_tokens_t * supporting_tokens)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, supporting_tokens, AXIS2_FAILURE);
+
+ rp_supporting_tokens_increment_ref(supporting_tokens, env);
+ secpolicy->supporting_tokens = supporting_tokens;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_supporting_tokens_t *AXIS2_CALL
+rp_secpolicy_get_supporting_tokens(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return secpolicy->supporting_tokens;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_secpolicy_set_signed_supporting_tokens(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_supporting_tokens_t * signed_supporting_tokens)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, signed_supporting_tokens, AXIS2_FAILURE);
+
+ rp_supporting_tokens_increment_ref(signed_supporting_tokens, env);
+ secpolicy->signed_supporting_tokens = signed_supporting_tokens;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_supporting_tokens_t *AXIS2_CALL
+rp_secpolicy_get_signed_supporting_tokens(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return secpolicy->signed_supporting_tokens;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_secpolicy_set_endorsing_supporting_tokens(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_supporting_tokens_t * endorsing_supporting_tokens)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, endorsing_supporting_tokens, AXIS2_FAILURE);
+
+ rp_supporting_tokens_increment_ref(endorsing_supporting_tokens, env);
+ secpolicy->endorsing_supporting_tokens = endorsing_supporting_tokens;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_supporting_tokens_t *AXIS2_CALL
+rp_secpolicy_get_endorsing_supporting_tokens(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return secpolicy->endorsing_supporting_tokens;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_secpolicy_set_signed_endorsing_supporting_tokens(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_supporting_tokens_t * signed_endorsing_supporting_tokens)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, signed_endorsing_supporting_tokens, AXIS2_FAILURE);
+
+ rp_supporting_tokens_increment_ref(signed_endorsing_supporting_tokens, env);
+ secpolicy->signed_endorsing_supporting_tokens = signed_endorsing_supporting_tokens;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_supporting_tokens_t *AXIS2_CALL
+rp_secpolicy_get_signed_endorsing_supporting_tokens(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return secpolicy->signed_endorsing_supporting_tokens;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_secpolicy_set_signed_parts(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_signed_encrypted_parts_t * signed_parts)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, signed_parts, AXIS2_FAILURE);
+ rp_signed_encrypted_parts_increment_ref(signed_parts, env);
+ secpolicy->signed_parts = signed_parts;
+
+ return AXIS2_SUCCESS;
+
+}
+
+AXIS2_EXTERN rp_signed_encrypted_parts_t *AXIS2_CALL
+rp_secpolicy_get_signed_parts(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return secpolicy->signed_parts;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_secpolicy_set_encrypted_parts(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_signed_encrypted_parts_t * encrypted_parts)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, encrypted_parts, AXIS2_FAILURE);
+
+ rp_signed_encrypted_parts_increment_ref(encrypted_parts, env);
+ secpolicy->encrypted_parts = encrypted_parts;
+ return AXIS2_SUCCESS;
+
+}
+
+AXIS2_EXTERN rp_signed_encrypted_parts_t *AXIS2_CALL
+rp_secpolicy_get_encrypted_parts(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return secpolicy->encrypted_parts;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_secpolicy_set_signed_elements(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_signed_encrypted_elements_t * signed_elements)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, signed_elements, AXIS2_FAILURE);
+
+ rp_signed_encrypted_elements_increment_ref(signed_elements, env);
+ secpolicy->signed_elements = signed_elements;
+ return AXIS2_SUCCESS;
+
+}
+
+AXIS2_EXTERN rp_signed_encrypted_elements_t *AXIS2_CALL
+rp_secpolicy_get_signed_elements(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return secpolicy->signed_elements;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_secpolicy_set_encrypted_elements(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_signed_encrypted_elements_t * encrypted_elements)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, encrypted_elements, AXIS2_FAILURE);
+
+ rp_signed_encrypted_elements_increment_ref(encrypted_elements, env);
+ secpolicy->encrypted_elements = encrypted_elements;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_signed_encrypted_elements_t *AXIS2_CALL
+rp_secpolicy_get_encrypted_elements(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return secpolicy->encrypted_elements;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_secpolicy_set_signed_items(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_signed_encrypted_items_t * signed_items)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, signed_items, AXIS2_FAILURE);
+
+ secpolicy->signed_items = signed_items;
+ return AXIS2_SUCCESS;
+
+}
+
+AXIS2_EXTERN rp_signed_encrypted_items_t *AXIS2_CALL
+rp_secpolicy_get_signed_items(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return secpolicy->signed_items;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_secpolicy_set_encrypted_items(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_signed_encrypted_items_t * encrypted_items)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, encrypted_items, AXIS2_FAILURE);
+
+ secpolicy->encrypted_items = encrypted_items;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_signed_encrypted_items_t *AXIS2_CALL
+rp_secpolicy_get_encrypted_items(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return secpolicy->encrypted_items;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_secpolicy_set_wss(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_property_t * wss)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, wss, AXIS2_FAILURE);
+
+ rp_property_increment_ref(wss, env);
+ secpolicy->wss = wss;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_property_t *AXIS2_CALL
+rp_secpolicy_get_wss(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return secpolicy->wss;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_secpolicy_set_trust10(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_trust10_t * trust10)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, trust10, AXIS2_FAILURE);
+
+ rp_trust10_increment_ref(trust10, env);
+ secpolicy->trust10 = trust10;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_trust10_t *AXIS2_CALL
+rp_secpolicy_get_trust10(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return secpolicy->trust10;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_secpolicy_set_rampart_config(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_rampart_config_t * rampart_config)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, rampart_config, AXIS2_FAILURE);
+
+ rp_rampart_config_increment_ref(rampart_config, env);
+ secpolicy->rampart_config = rampart_config;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_rampart_config_t *AXIS2_CALL
+rp_secpolicy_get_rampart_config(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return secpolicy->rampart_config;
+}
diff --git a/neethi/src/secpolicy/model/security_context_token.c b/neethi/src/secpolicy/model/security_context_token.c
new file mode 100644
index 0000000..9b00465
--- /dev/null
+++ b/neethi/src/secpolicy/model/security_context_token.c
@@ -0,0 +1,239 @@
+/*
+ * 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 <rp_security_context_token.h>
+
+struct rp_security_context_token_t
+{
+ rp_token_t *token;
+ axis2_bool_t require_external_uri_ref;
+ axis2_bool_t sc10_security_context_token;
+ neethi_policy_t *bootstrap_policy;
+ axis2_bool_t is_secure_conversation_token;
+ int ref;
+};
+
+AXIS2_EXTERN rp_security_context_token_t *AXIS2_CALL
+rp_security_context_token_create(
+ const axutil_env_t * env)
+{
+ rp_security_context_token_t *security_context_token = NULL;
+
+ security_context_token = (rp_security_context_token_t *)AXIS2_MALLOC(env->allocator,
+ sizeof(rp_security_context_token_t));
+
+ if(!security_context_token)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Security context token assertion creation failed. Insufficient memory");
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
+ security_context_token->ref = 0;
+ security_context_token->require_external_uri_ref = AXIS2_FALSE;
+ security_context_token->sc10_security_context_token = AXIS2_FALSE;
+ security_context_token->bootstrap_policy = NULL;
+ security_context_token->is_secure_conversation_token = AXIS2_FALSE;
+
+ security_context_token->token = rp_token_create(env);
+ if(!security_context_token->token)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Security context token assertion creation failed.");
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ rp_security_context_token_free(security_context_token, env);
+ return NULL;
+ }
+
+ return security_context_token;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_security_context_token_free(
+ rp_security_context_token_t * security_context_token,
+ const axutil_env_t * env)
+{
+ if(security_context_token)
+ {
+ if(--(security_context_token->ref) > 0)
+ {
+ return;
+ }
+
+ if(security_context_token->bootstrap_policy)
+ {
+ neethi_policy_free(security_context_token->bootstrap_policy, env);
+ }
+
+ rp_token_free(security_context_token->token, env);
+ AXIS2_FREE(env->allocator, security_context_token);
+ security_context_token = NULL;
+ }
+}
+
+/* Implementations */
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_security_context_token_get_inclusion(
+ rp_security_context_token_t * security_context_token,
+ const axutil_env_t * env)
+{
+ return rp_token_get_inclusion(security_context_token->token, env);
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_security_context_token_set_inclusion(
+ rp_security_context_token_t * security_context_token,
+ const axutil_env_t * env,
+ axis2_char_t * inclusion)
+{
+ return rp_token_set_inclusion(security_context_token->token, env, inclusion);
+}
+
+AXIS2_EXTERN derive_key_type_t AXIS2_CALL
+rp_security_context_token_get_derivedkey(
+ rp_security_context_token_t * security_context_token,
+ const axutil_env_t * env)
+{
+ return rp_token_get_derivedkey_type(security_context_token->token, env);
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_security_context_token_set_derivedkey(
+ rp_security_context_token_t * security_context_token,
+ const axutil_env_t * env,
+ derive_key_type_t derivedkey)
+{
+ return rp_token_set_derivedkey_type(security_context_token->token, env, derivedkey);
+}
+
+AXIS2_EXTERN derive_key_version_t AXIS2_CALL
+rp_security_context_token_get_derivedkey_version(
+ rp_security_context_token_t *security_context_token,
+ const axutil_env_t *env)
+{
+ return rp_token_get_derive_key_version(security_context_token->token, env);
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_security_context_token_set_derivedkey_version(
+ rp_security_context_token_t *security_context_token,
+ const axutil_env_t *env,
+ derive_key_version_t version)
+{
+ return rp_token_set_derive_key_version(security_context_token->token, env, version);
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_security_context_token_get_require_external_uri_ref(
+ rp_security_context_token_t * security_context_token,
+ const axutil_env_t * env)
+{
+ return security_context_token->require_external_uri_ref;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_security_context_token_set_require_external_uri_ref(
+ rp_security_context_token_t * security_context_token,
+ const axutil_env_t * env,
+ axis2_bool_t require_external_uri_ref)
+{
+ security_context_token->require_external_uri_ref = require_external_uri_ref;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_security_context_token_get_sc10_security_context_token(
+ rp_security_context_token_t * security_context_token,
+ const axutil_env_t * env)
+{
+ return security_context_token->sc10_security_context_token;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_security_context_token_set_sc10_security_context_token(
+ rp_security_context_token_t * security_context_token,
+ const axutil_env_t * env,
+ axis2_bool_t sc10_security_context_token)
+{
+ security_context_token->sc10_security_context_token = sc10_security_context_token;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_security_context_token_get_issuer(
+ rp_security_context_token_t *security_context_token,
+ const axutil_env_t *env)
+{
+ return rp_token_get_issuer(security_context_token->token, env);
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_security_context_token_set_issuer(
+ rp_security_context_token_t * security_context_token,
+ const axutil_env_t * env,
+ axis2_char_t *issuer)
+{
+ return rp_token_set_issuer(security_context_token->token, env, issuer);
+}
+
+AXIS2_EXTERN neethi_policy_t *AXIS2_CALL
+rp_security_context_token_get_bootstrap_policy(
+ rp_security_context_token_t *security_context_token,
+ const axutil_env_t *env)
+{
+ return security_context_token->bootstrap_policy;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_security_context_token_set_bootstrap_policy(
+ rp_security_context_token_t * security_context_token,
+ const axutil_env_t * env,
+ neethi_policy_t *bootstrap_policy)
+{
+ security_context_token->bootstrap_policy = bootstrap_policy;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_security_context_token_get_is_secure_conversation_token(
+ rp_security_context_token_t *security_context_token,
+ const axutil_env_t *env)
+{
+ return security_context_token->is_secure_conversation_token;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_security_context_token_set_is_secure_conversation_token(
+ rp_security_context_token_t * security_context_token,
+ const axutil_env_t * env,
+ axis2_bool_t is_secure_conversation_token)
+{
+ security_context_token->is_secure_conversation_token = is_secure_conversation_token;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_security_context_token_increment_ref(
+ rp_security_context_token_t * security_context_token,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ security_context_token->ref++;
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/model/signed_encrypted_elements.c b/neethi/src/secpolicy/model/signed_encrypted_elements.c
new file mode 100644
index 0000000..b656f0f
--- /dev/null
+++ b/neethi/src/secpolicy/model/signed_encrypted_elements.c
@@ -0,0 +1,180 @@
+/*
+ * 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 <rp_signed_encrypted_elements.h>
+
+struct rp_signed_encrypted_elements_t
+{
+ axis2_bool_t signedelements;
+ axutil_array_list_t *xpath_expressions;
+ axis2_char_t *xpath_version;
+ int ref;
+
+};
+
+AXIS2_EXTERN rp_signed_encrypted_elements_t *AXIS2_CALL
+rp_signed_encrypted_elements_create(
+ const axutil_env_t * env)
+{
+ rp_signed_encrypted_elements_t *signed_encrypted_elements = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ signed_encrypted_elements = (rp_signed_encrypted_elements_t *)AXIS2_MALLOC(env->allocator,
+ sizeof(rp_signed_encrypted_elements_t));
+
+ if(signed_encrypted_elements == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ signed_encrypted_elements->xpath_expressions = NULL;
+
+ signed_encrypted_elements->xpath_expressions = axutil_array_list_create(env, 0);
+ if(!(signed_encrypted_elements->xpath_expressions))
+ {
+ rp_signed_encrypted_elements_free(signed_encrypted_elements, env);
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
+ signed_encrypted_elements->xpath_version = NULL;
+ signed_encrypted_elements->ref = 0;
+
+ return signed_encrypted_elements;
+
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_signed_encrypted_elements_free(
+ rp_signed_encrypted_elements_t * signed_encrypted_elements,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ if(signed_encrypted_elements)
+ {
+ if(--(signed_encrypted_elements->ref) > 0)
+ {
+ return;
+ }
+
+ if(signed_encrypted_elements->xpath_expressions)
+ {
+ int i = 0;
+ for(i = 0; i < axutil_array_list_size(signed_encrypted_elements-> xpath_expressions,
+ env); i++)
+ {
+ axis2_char_t *expression = NULL;
+ expression = (axis2_char_t *)axutil_array_list_get(
+ signed_encrypted_elements-> xpath_expressions, env, i);
+ if(expression)
+ AXIS2_FREE(env->allocator, expression);
+
+ expression = NULL;
+ }
+ axutil_array_list_free(signed_encrypted_elements->xpath_expressions, env);
+ signed_encrypted_elements->xpath_expressions = NULL;
+
+ }
+ AXIS2_FREE(env->allocator, signed_encrypted_elements);
+ signed_encrypted_elements = NULL;
+ }
+ return;
+}
+
+/* Implementations */
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_signed_encrypted_elements_get_signedelements(
+ rp_signed_encrypted_elements_t * signed_encrypted_elements,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return signed_encrypted_elements->signedelements;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_signed_encrypted_elements_set_signedelements(
+ rp_signed_encrypted_elements_t * signed_encrypted_elements,
+ const axutil_env_t * env,
+ axis2_bool_t signedelements)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, signedelements, AXIS2_FAILURE);
+
+ signed_encrypted_elements->signedelements = signedelements;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
+rp_signed_encrypted_elements_get_xpath_expressions(
+ rp_signed_encrypted_elements_t * signed_encrypted_elements,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return signed_encrypted_elements->xpath_expressions;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_signed_encrypted_elements_add_expression(
+ rp_signed_encrypted_elements_t * signed_encrypted_elements,
+ const axutil_env_t * env,
+ axis2_char_t * expression)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, expression, AXIS2_FAILURE);
+
+ axutil_array_list_add(signed_encrypted_elements->xpath_expressions, env, expression);
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_signed_encrypted_elements_get_xpath_version(
+ rp_signed_encrypted_elements_t * signed_encrypted_elements,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return signed_encrypted_elements->xpath_version;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_signed_encrypted_elements_set_xpath_version(
+ rp_signed_encrypted_elements_t * signed_encrypted_elements,
+ const axutil_env_t * env,
+ axis2_char_t * xpath_version)
+{
+
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, xpath_version, AXIS2_FAILURE);
+
+ signed_encrypted_elements->xpath_version = xpath_version;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_signed_encrypted_elements_increment_ref(
+ rp_signed_encrypted_elements_t * signed_encrypted_elements,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ signed_encrypted_elements->ref++;
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/model/signed_encrypted_items.c b/neethi/src/secpolicy/model/signed_encrypted_items.c
new file mode 100644
index 0000000..e3e6150
--- /dev/null
+++ b/neethi/src/secpolicy/model/signed_encrypted_items.c
@@ -0,0 +1,136 @@
+/*
+ * 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 <rp_signed_encrypted_items.h>
+
+struct rp_signed_encrypted_items_t
+{
+ axis2_bool_t signeditems;
+ axutil_array_list_t *elements;
+
+};
+
+AXIS2_EXTERN rp_signed_encrypted_items_t *AXIS2_CALL
+rp_signed_encrypted_items_create(
+ const axutil_env_t * env)
+{
+ rp_signed_encrypted_items_t *signed_encrypted_items = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ signed_encrypted_items = (rp_signed_encrypted_items_t *)AXIS2_MALLOC(env->allocator,
+ sizeof(rp_signed_encrypted_items_t));
+
+ if(signed_encrypted_items == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ signed_encrypted_items->elements = NULL;
+
+ signed_encrypted_items->elements = axutil_array_list_create(env, 0);
+ if(!(signed_encrypted_items->elements))
+ {
+ rp_signed_encrypted_items_free(signed_encrypted_items, env);
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
+ return signed_encrypted_items;
+
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_signed_encrypted_items_free(
+ rp_signed_encrypted_items_t * signed_encrypted_items,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ if(signed_encrypted_items)
+ {
+
+ if(signed_encrypted_items->elements)
+ {
+ int i = 0;
+ for(i = 0; i < axutil_array_list_size(signed_encrypted_items->elements, env); i++)
+ {
+ rp_element_t *element = NULL;
+ element = (rp_element_t *)axutil_array_list_get(signed_encrypted_items->elements,
+ env, i);
+ if(element)
+ rp_element_free(element, env);
+
+ element = NULL;
+ }
+ axutil_array_list_free(signed_encrypted_items->elements, env);
+ signed_encrypted_items->elements = NULL;
+
+ }
+ AXIS2_FREE(env->allocator, signed_encrypted_items);
+ signed_encrypted_items = NULL;
+ }
+ return;
+}
+
+/* Implementations */
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_signed_encrypted_items_get_signeditems(
+ rp_signed_encrypted_items_t * signed_encrypted_items,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return signed_encrypted_items->signeditems;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_signed_encrypted_items_set_signeditems(
+ rp_signed_encrypted_items_t * signed_encrypted_items,
+ const axutil_env_t * env,
+ axis2_bool_t signeditems)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, signeditems, AXIS2_FAILURE);
+ signed_encrypted_items->signeditems = signeditems;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
+rp_signed_encrypted_items_get_elements(
+ rp_signed_encrypted_items_t * signed_encrypted_items,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return signed_encrypted_items->elements;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_signed_encrypted_items_add_element(
+ rp_signed_encrypted_items_t * signed_encrypted_items,
+ const axutil_env_t * env,
+ rp_element_t * element)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, element, AXIS2_FAILURE);
+
+ axutil_array_list_add(signed_encrypted_items->elements, env, element);
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/model/signed_encrypted_parts.c b/neethi/src/secpolicy/model/signed_encrypted_parts.c
new file mode 100644
index 0000000..0f16e83
--- /dev/null
+++ b/neethi/src/secpolicy/model/signed_encrypted_parts.c
@@ -0,0 +1,176 @@
+/*
+ * 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 <rp_signed_encrypted_parts.h>
+
+struct rp_signed_encrypted_parts_t
+{
+ axis2_bool_t body;
+ axis2_bool_t signedparts;
+ axis2_bool_t attachments;
+ axutil_array_list_t *headers;
+ int ref;
+};
+
+AXIS2_EXTERN rp_signed_encrypted_parts_t *AXIS2_CALL
+rp_signed_encrypted_parts_create(
+ const axutil_env_t * env)
+{
+ rp_signed_encrypted_parts_t *signed_encrypted_parts = NULL;
+ signed_encrypted_parts = (rp_signed_encrypted_parts_t *)AXIS2_MALLOC(env->allocator,
+ sizeof(rp_signed_encrypted_parts_t));
+
+ if(!signed_encrypted_parts)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Cannot create signed_encrypted_parts. Insuficient memory.");
+ return NULL;
+ }
+
+ signed_encrypted_parts->headers = axutil_array_list_create(env, 0);
+ if(!signed_encrypted_parts->headers)
+ {
+ rp_signed_encrypted_parts_free(signed_encrypted_parts, env);
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Cannot create signed_encrypted_parts. Headers array list creation failed.");
+ return NULL;
+ }
+
+ signed_encrypted_parts->body = AXIS2_FALSE;
+ signed_encrypted_parts->ref = 0;
+ signed_encrypted_parts->signedparts = AXIS2_FALSE;
+ signed_encrypted_parts->attachments = AXIS2_FALSE;
+ return signed_encrypted_parts;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_signed_encrypted_parts_free(
+ rp_signed_encrypted_parts_t * signed_encrypted_parts,
+ const axutil_env_t * env)
+{
+ if(signed_encrypted_parts)
+ {
+ if(--(signed_encrypted_parts->ref) > 0)
+ {
+ return;
+ }
+
+ if(signed_encrypted_parts->headers)
+ {
+ int i = 0;
+ for(i = 0; i < axutil_array_list_size(signed_encrypted_parts->headers, env); i++)
+ {
+ rp_header_t *header = NULL;
+ header = (rp_header_t *)axutil_array_list_get(signed_encrypted_parts->headers, env,
+ i);
+ if(header)
+ {
+ rp_header_free(header, env);
+ }
+ }
+ axutil_array_list_free(signed_encrypted_parts->headers, env);
+ signed_encrypted_parts->headers = NULL;
+ }
+ AXIS2_FREE(env->allocator, signed_encrypted_parts);
+ signed_encrypted_parts = NULL;
+ }
+}
+
+/* Implementations */
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_signed_encrypted_parts_get_body(
+ rp_signed_encrypted_parts_t * signed_encrypted_parts,
+ const axutil_env_t * env)
+{
+ return signed_encrypted_parts->body;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_signed_encrypted_parts_set_body(
+ rp_signed_encrypted_parts_t * signed_encrypted_parts,
+ const axutil_env_t * env,
+ axis2_bool_t body)
+{
+ AXIS2_PARAM_CHECK(env->error, body, AXIS2_FAILURE);
+ signed_encrypted_parts->body = body;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_signed_encrypted_parts_get_signedparts(
+ rp_signed_encrypted_parts_t * signed_encrypted_parts,
+ const axutil_env_t * env)
+{
+ return signed_encrypted_parts->signedparts;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_signed_encrypted_parts_set_signedparts(
+ rp_signed_encrypted_parts_t * signed_encrypted_parts,
+ const axutil_env_t * env,
+ axis2_bool_t signedparts)
+{
+ signed_encrypted_parts->signedparts = signedparts;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
+rp_signed_encrypted_parts_get_headers(
+ rp_signed_encrypted_parts_t * signed_encrypted_parts,
+ const axutil_env_t * env)
+{
+ return signed_encrypted_parts->headers;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_signed_encrypted_parts_add_header(
+ rp_signed_encrypted_parts_t * signed_encrypted_parts,
+ const axutil_env_t * env,
+ rp_header_t * header)
+{
+ AXIS2_PARAM_CHECK(env->error, header, AXIS2_FAILURE);
+ axutil_array_list_add(signed_encrypted_parts->headers, env, header);
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_signed_encrypted_parts_increment_ref(
+ rp_signed_encrypted_parts_t * signed_encrypted_parts,
+ const axutil_env_t * env)
+{
+ signed_encrypted_parts->ref++;
+ return AXIS2_SUCCESS;
+}
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_signed_encrypted_parts_get_attachments(
+ rp_signed_encrypted_parts_t * signed_encrypted_parts,
+ const axutil_env_t * env)
+{
+ return signed_encrypted_parts->attachments;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_signed_encrypted_parts_set_attachments(
+ rp_signed_encrypted_parts_t * signed_encrypted_parts,
+ const axutil_env_t * env,
+ axis2_bool_t attachments)
+{
+ signed_encrypted_parts->attachments = attachments;
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/model/supporting_tokens.c b/neethi/src/secpolicy/model/supporting_tokens.c
new file mode 100644
index 0000000..7ec2d7f
--- /dev/null
+++ b/neethi/src/secpolicy/model/supporting_tokens.c
@@ -0,0 +1,300 @@
+/*
+ * 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 <rp_supporting_tokens.h>
+
+struct rp_supporting_tokens_t
+{
+ rp_algorithmsuite_t *algorithmsuite;
+ axutil_array_list_t *tokens;
+ rp_signed_encrypted_elements_t *signed_elements;
+ rp_signed_encrypted_parts_t *signed_parts;
+ rp_signed_encrypted_elements_t *encrypted_elements;
+ rp_signed_encrypted_parts_t *encrypted_parts;
+ int type;
+ int ref;
+};
+
+AXIS2_EXTERN rp_supporting_tokens_t *AXIS2_CALL
+rp_supporting_tokens_create(
+ const axutil_env_t * env)
+{
+ rp_supporting_tokens_t *supporting_tokens = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ supporting_tokens = (rp_supporting_tokens_t *)AXIS2_MALLOC(env->allocator,
+ sizeof(rp_supporting_tokens_t));
+
+ if(supporting_tokens == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ supporting_tokens->tokens = NULL;
+ supporting_tokens->tokens = axutil_array_list_create(env, 0);
+ if(!(supporting_tokens->tokens))
+ {
+ rp_supporting_tokens_free(supporting_tokens, env);
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
+ supporting_tokens->algorithmsuite = NULL;
+ supporting_tokens->signed_parts = NULL;
+ supporting_tokens->signed_elements = NULL;
+ supporting_tokens->encrypted_parts = NULL;
+ supporting_tokens->encrypted_elements = NULL;
+ supporting_tokens->type = 0;
+ supporting_tokens->ref = 0;
+ return supporting_tokens;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_supporting_tokens_free(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ if(supporting_tokens)
+ {
+
+ if(--(supporting_tokens->ref) > 0)
+ {
+ return;
+ }
+
+ if(supporting_tokens->tokens)
+ {
+ int i = 0;
+ for(i = 0; i < axutil_array_list_size(supporting_tokens->tokens, env); i++)
+ {
+ rp_property_t *token = NULL;
+ token = (rp_property_t *)axutil_array_list_get(supporting_tokens->tokens, env, i);
+ if(token)
+ rp_property_free(token, env);
+
+ token = NULL;
+ }
+ axutil_array_list_free(supporting_tokens->tokens, env);
+ supporting_tokens->tokens = NULL;
+
+ }
+ if(supporting_tokens->algorithmsuite)
+ {
+ rp_algorithmsuite_free(supporting_tokens->algorithmsuite, env);
+ supporting_tokens->algorithmsuite = NULL;
+ }
+ if(supporting_tokens->signed_parts)
+ {
+ rp_signed_encrypted_parts_free(supporting_tokens->signed_parts, env);
+ supporting_tokens->signed_parts = NULL;
+ }
+ if(supporting_tokens->signed_elements)
+ {
+ rp_signed_encrypted_elements_free(supporting_tokens-> signed_elements, env);
+ supporting_tokens->signed_elements = NULL;
+ }
+ if(supporting_tokens->encrypted_parts)
+ {
+ rp_signed_encrypted_parts_free(supporting_tokens->encrypted_parts, env);
+ supporting_tokens->encrypted_parts = NULL;
+ }
+ if(supporting_tokens->encrypted_elements)
+ {
+ rp_signed_encrypted_elements_free(supporting_tokens-> encrypted_elements, env);
+ supporting_tokens->encrypted_elements = NULL;
+ }
+ AXIS2_FREE(env->allocator, supporting_tokens);
+ supporting_tokens = NULL;
+ }
+ return;
+}
+
+/* Implementations */
+
+AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
+rp_supporting_tokens_get_tokens(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return supporting_tokens->tokens;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_supporting_tokens_add_token(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env,
+ rp_property_t * token)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, token, AXIS2_FAILURE);
+
+ rp_property_increment_ref(token, env);
+ axutil_array_list_add(supporting_tokens->tokens, env, token);
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_algorithmsuite_t *AXIS2_CALL
+rp_supporting_tokens_get_algorithmsuite(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, NULL);
+
+ return supporting_tokens->algorithmsuite;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_supporting_tokens_set_algorithmsuite(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env,
+ rp_algorithmsuite_t * algorithmsuite)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, algorithmsuite, AXIS2_FAILURE);
+
+ rp_algorithmsuite_increment_ref(algorithmsuite, env);
+ supporting_tokens->algorithmsuite = algorithmsuite;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_signed_encrypted_parts_t *AXIS2_CALL
+rp_supporting_tokens_get_signed_parts(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, NULL);
+
+ return supporting_tokens->signed_parts;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_supporting_tokens_set_signed_parts(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env,
+ rp_signed_encrypted_parts_t * signed_parts)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, signed_parts, AXIS2_FAILURE);
+
+ supporting_tokens->signed_parts = signed_parts;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_signed_encrypted_elements_t *AXIS2_CALL
+rp_supporting_tokens_get_signed_elements(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, NULL);
+
+ return supporting_tokens->signed_elements;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_supporting_tokens_set_signed_elements(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env,
+ rp_signed_encrypted_elements_t * signed_elements)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, signed_elements, AXIS2_FAILURE);
+
+ supporting_tokens->signed_elements = signed_elements;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_signed_encrypted_parts_t *AXIS2_CALL
+rp_supporting_tokens_get_encrypted_parts(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, NULL);
+
+ return supporting_tokens->encrypted_parts;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_supporting_tokens_set_encrypted_parts(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env,
+ rp_signed_encrypted_parts_t * encrypted_parts)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, encrypted_parts, AXIS2_FAILURE);
+
+ supporting_tokens->encrypted_parts = encrypted_parts;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_signed_encrypted_elements_t *AXIS2_CALL
+rp_supporting_tokens_get_encrypted_elements(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return supporting_tokens->encrypted_elements;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_supporting_tokens_set_encrypted_elements(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env,
+ rp_signed_encrypted_elements_t * encrypted_elements)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, encrypted_elements, AXIS2_FAILURE);
+
+ supporting_tokens->encrypted_elements = encrypted_elements;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN int AXIS2_CALL
+rp_supporting_tokens_get_type(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return supporting_tokens->type;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_supporting_tokens_set_type(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env,
+ int type)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ supporting_tokens->type = type;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_supporting_tokens_increment_ref(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ supporting_tokens->ref++;
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/model/symmetric_asymmetric_binding_commons.c b/neethi/src/secpolicy/model/symmetric_asymmetric_binding_commons.c
new file mode 100644
index 0000000..06a4188
--- /dev/null
+++ b/neethi/src/secpolicy/model/symmetric_asymmetric_binding_commons.c
@@ -0,0 +1,192 @@
+/*
+ * 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 <rp_symmetric_asymmetric_binding_commons.h>
+
+struct rp_symmetric_asymmetric_binding_commons_t
+{
+ rp_binding_commons_t *binding_commons;
+ axis2_char_t *protection_order;
+ axis2_bool_t signature_protection;
+ axis2_bool_t token_protection;
+ axis2_bool_t entire_headers_and_body_signatures;
+
+};
+
+AXIS2_EXTERN rp_symmetric_asymmetric_binding_commons_t *AXIS2_CALL
+rp_symmetric_asymmetric_binding_commons_create(
+ const axutil_env_t * env)
+{
+ rp_symmetric_asymmetric_binding_commons_t *symmetric_asymmetric_binding_commons = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ symmetric_asymmetric_binding_commons
+ = (rp_symmetric_asymmetric_binding_commons_t *)AXIS2_MALLOC(env-> allocator,
+ sizeof(rp_symmetric_asymmetric_binding_commons_t));
+
+ if(symmetric_asymmetric_binding_commons == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ symmetric_asymmetric_binding_commons->binding_commons = NULL;
+ symmetric_asymmetric_binding_commons->protection_order = RP_SIGN_BEFORE_ENCRYPTING;
+ symmetric_asymmetric_binding_commons->signature_protection = AXIS2_FALSE;
+ symmetric_asymmetric_binding_commons->token_protection = AXIS2_FALSE;
+ symmetric_asymmetric_binding_commons->entire_headers_and_body_signatures = AXIS2_FALSE;
+
+ return symmetric_asymmetric_binding_commons;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_symmetric_asymmetric_binding_commons_free(
+ rp_symmetric_asymmetric_binding_commons_t * symmetric_asymmetric_binding_commons,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ if(symmetric_asymmetric_binding_commons)
+ {
+ if(symmetric_asymmetric_binding_commons->binding_commons)
+ {
+ rp_binding_commons_free(symmetric_asymmetric_binding_commons-> binding_commons, env);
+ symmetric_asymmetric_binding_commons->binding_commons = NULL;
+ }
+ AXIS2_FREE(env->allocator, symmetric_asymmetric_binding_commons);
+ symmetric_asymmetric_binding_commons = NULL;
+ }
+ return;
+}
+
+/* Implementations */
+AXIS2_EXTERN rp_binding_commons_t *AXIS2_CALL
+rp_symmetric_asymmetric_binding_commons_get_binding_commons(
+ rp_symmetric_asymmetric_binding_commons_t * symmetric_asymmetric_binding_commons,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, NULL);
+
+ return symmetric_asymmetric_binding_commons->binding_commons;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_symmetric_asymmetric_binding_commons_set_binding_commons(
+ rp_symmetric_asymmetric_binding_commons_t * symmetric_asymmetric_binding_commons,
+ const axutil_env_t * env,
+ rp_binding_commons_t * binding_commons)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, binding_commons, AXIS2_FAILURE);
+
+ symmetric_asymmetric_binding_commons->binding_commons = binding_commons;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_symmetric_asymmetric_binding_commons_get_signature_protection(
+ rp_symmetric_asymmetric_binding_commons_t * symmetric_asymmetric_binding_commons,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ return symmetric_asymmetric_binding_commons->signature_protection;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_symmetric_asymmetric_binding_commons_set_signature_protection(
+ rp_symmetric_asymmetric_binding_commons_t * symmetric_asymmetric_binding_commons,
+ const axutil_env_t * env,
+ axis2_bool_t signature_protection)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, signature_protection, AXIS2_FAILURE);
+ symmetric_asymmetric_binding_commons->signature_protection = signature_protection;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_symmetric_asymmetric_binding_commons_get_token_protection(
+ rp_symmetric_asymmetric_binding_commons_t * symmetric_asymmetric_binding_commons,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ return symmetric_asymmetric_binding_commons->token_protection;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_symmetric_asymmetric_binding_commons_set_token_protection(
+ rp_symmetric_asymmetric_binding_commons_t * symmetric_asymmetric_binding_commons,
+ const axutil_env_t * env,
+ axis2_bool_t token_protection)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, token_protection, AXIS2_FAILURE);
+
+ symmetric_asymmetric_binding_commons->token_protection = token_protection;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_symmetric_asymmetric_binding_commons_get_entire_headers_and_body_signatures(
+ rp_symmetric_asymmetric_binding_commons_t * symmetric_asymmetric_binding_commons,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ return symmetric_asymmetric_binding_commons-> entire_headers_and_body_signatures;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_symmetric_asymmetric_binding_commons_set_entire_headers_and_body_signatures(
+ rp_symmetric_asymmetric_binding_commons_t * symmetric_asymmetric_binding_commons,
+ const axutil_env_t * env,
+ axis2_bool_t entire_headers_and_body_signatures)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, entire_headers_and_body_signatures, AXIS2_FAILURE);
+
+ symmetric_asymmetric_binding_commons->entire_headers_and_body_signatures
+ = entire_headers_and_body_signatures;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_symmetric_asymmetric_binding_commons_get_protection_order(
+ rp_symmetric_asymmetric_binding_commons_t * symmetric_asymmetric_binding_commons,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, NULL);
+
+ return symmetric_asymmetric_binding_commons->protection_order;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_symmetric_asymmetric_binding_commons_set_protection_order(
+ rp_symmetric_asymmetric_binding_commons_t * symmetric_asymmetric_binding_commons,
+ const axutil_env_t * env,
+ axis2_char_t * protection_order)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, protection_order, AXIS2_FAILURE);
+
+ symmetric_asymmetric_binding_commons->protection_order = protection_order;
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/model/symmetric_binding.c b/neethi/src/secpolicy/model/symmetric_binding.c
new file mode 100644
index 0000000..4d6dc2d
--- /dev/null
+++ b/neethi/src/secpolicy/model/symmetric_binding.c
@@ -0,0 +1,216 @@
+/*
+ * 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 <rp_symmetric_binding.h>
+
+struct rp_symmetric_binding_t
+{
+ rp_symmetric_asymmetric_binding_commons_t *symmetric_asymmetric_binding_commons;
+ rp_property_t *protection_token;
+ rp_property_t *signature_token;
+ rp_property_t *encryption_token;
+ int ref;
+};
+
+AXIS2_EXTERN rp_symmetric_binding_t *AXIS2_CALL
+rp_symmetric_binding_create(
+ const axutil_env_t * env)
+{
+ rp_symmetric_binding_t *symmetric_binding = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ symmetric_binding = (rp_symmetric_binding_t *)AXIS2_MALLOC(env->allocator,
+ sizeof(rp_symmetric_binding_t));
+
+ if(symmetric_binding == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ symmetric_binding->symmetric_asymmetric_binding_commons = NULL;
+ symmetric_binding->protection_token = NULL;
+ symmetric_binding->signature_token = NULL;
+ symmetric_binding->encryption_token = NULL;
+ symmetric_binding->ref = 0;
+
+ return symmetric_binding;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_symmetric_binding_free(
+ rp_symmetric_binding_t * symmetric_binding,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ if(symmetric_binding)
+ {
+ if(--(symmetric_binding->ref) > 0)
+ {
+ return;
+ }
+
+ if(symmetric_binding->symmetric_asymmetric_binding_commons)
+ {
+ rp_symmetric_asymmetric_binding_commons_free(
+ symmetric_binding-> symmetric_asymmetric_binding_commons, env);
+ symmetric_binding->symmetric_asymmetric_binding_commons = NULL;
+ }
+ if(symmetric_binding->protection_token)
+ {
+ rp_property_free(symmetric_binding->protection_token, env);
+ symmetric_binding->protection_token = NULL;
+ }
+ if(symmetric_binding->encryption_token)
+ {
+ rp_property_free(symmetric_binding->encryption_token, env);
+ symmetric_binding->encryption_token = NULL;
+ }
+ if(symmetric_binding->signature_token)
+ {
+ rp_property_free(symmetric_binding->signature_token, env);
+ symmetric_binding->signature_token = NULL;
+ }
+ AXIS2_FREE(env->allocator, symmetric_binding);
+ }
+
+ return;
+}
+
+/* Implementations */
+
+AXIS2_EXTERN rp_symmetric_asymmetric_binding_commons_t *AXIS2_CALL
+rp_symmetric_binding_get_symmetric_asymmetric_binding_commons(
+ rp_symmetric_binding_t * symmetric_binding,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, NULL);
+
+ return symmetric_binding->symmetric_asymmetric_binding_commons;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_symmetric_binding_set_symmetric_asymmetric_binding_commons(
+ rp_symmetric_binding_t * symmetric_binding,
+ const axutil_env_t * env,
+ rp_symmetric_asymmetric_binding_commons_t * symmetric_asymmetric_binding_commons)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, symmetric_asymmetric_binding_commons, AXIS2_FAILURE);
+
+ symmetric_binding->symmetric_asymmetric_binding_commons = symmetric_asymmetric_binding_commons;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_property_t *AXIS2_CALL
+rp_symmetric_binding_get_protection_token(
+ rp_symmetric_binding_t * symmetric_binding,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, NULL);
+
+ return symmetric_binding->protection_token;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_symmetric_binding_set_protection_token(
+ rp_symmetric_binding_t * symmetric_binding,
+ const axutil_env_t * env,
+ rp_property_t * protection_token)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, protection_token, AXIS2_FAILURE);
+ if(symmetric_binding->signature_token || symmetric_binding->encryption_token)
+ {
+ return AXIS2_FAILURE;
+ }
+ rp_property_increment_ref(protection_token, env);
+ symmetric_binding->protection_token = protection_token;
+
+ return AXIS2_SUCCESS;
+
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_symmetric_binding_set_encryption_token(
+ rp_symmetric_binding_t * symmetric_binding,
+ const axutil_env_t * env,
+ rp_property_t * encryption_token)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, encryption_token, AXIS2_FAILURE);
+ if(symmetric_binding->protection_token)
+ {
+ return AXIS2_FAILURE;
+ }
+ rp_property_increment_ref(encryption_token, env);
+ symmetric_binding->encryption_token = encryption_token;
+
+ return AXIS2_SUCCESS;
+
+}
+
+AXIS2_EXTERN rp_property_t *AXIS2_CALL
+rp_symmetric_binding_get_encryption_token(
+ rp_symmetric_binding_t * symmetric_binding,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, NULL);
+
+ return symmetric_binding->encryption_token;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_symmetric_binding_set_signature_token(
+ rp_symmetric_binding_t * symmetric_binding,
+ const axutil_env_t * env,
+ rp_property_t * signature_token)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, signature_token, AXIS2_FAILURE);
+ if(symmetric_binding->protection_token)
+ {
+ return AXIS2_FAILURE;
+ }
+ rp_property_increment_ref(signature_token, env);
+ symmetric_binding->signature_token = signature_token;
+
+ return AXIS2_SUCCESS;
+
+}
+
+AXIS2_EXTERN rp_property_t *AXIS2_CALL
+rp_symmetric_binding_get_signature_token(
+ rp_symmetric_binding_t * symmetric_binding,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, NULL);
+
+ return symmetric_binding->signature_token;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_symmetric_binding_increment_ref(
+ rp_symmetric_binding_t * symmetric_binding,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ symmetric_binding->ref++;
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/model/token.c b/neethi/src/secpolicy/model/token.c
new file mode 100644
index 0000000..ccb80e4
--- /dev/null
+++ b/neethi/src/secpolicy/model/token.c
@@ -0,0 +1,190 @@
+/*
+ * 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 <rp_token.h>
+
+struct rp_token_t
+{
+ axis2_char_t *issuer;
+ axis2_char_t *inclusion;
+ axiom_node_t *claim;
+ axis2_bool_t is_issuer_name; /* shows whether 'issuer' points to issuer name or end point */
+ derive_key_type_t derive_key;
+ derive_key_version_t derive_key_version;
+ int ref;
+};
+
+AXIS2_EXTERN rp_token_t *AXIS2_CALL
+rp_token_create(
+ const axutil_env_t * env)
+{
+ rp_token_t *token = NULL;
+ token = (rp_token_t *)AXIS2_MALLOC(env->allocator, sizeof(rp_token_t));
+
+ if(!token)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Token creation failed. Insufficient memory");
+ return NULL;
+ }
+ token->issuer = NULL;
+ token->is_issuer_name = AXIS2_FALSE;
+ token->claim = NULL;
+ token->derive_key = DERIVEKEY_NONE;
+ token->derive_key_version = DERIVEKEY_VERSION_SC13;
+ token->inclusion = RP_INCLUDE_ALWAYS_SP12;
+ token->ref = 0;
+
+ return token;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_token_free(
+ rp_token_t * token,
+ const axutil_env_t * env)
+{
+ if(token)
+ {
+ if(--(token->ref) > 0)
+ {
+ return;
+ }
+
+ AXIS2_FREE(env->allocator, token);
+ token = NULL;
+ }
+}
+
+/* Implementations */
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_token_get_issuer(
+ rp_token_t * token,
+ const axutil_env_t * env)
+{
+ return token->issuer;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_token_set_issuer(
+ rp_token_t * token,
+ const axutil_env_t * env,
+ axis2_char_t * issuer)
+{
+ token->issuer = issuer;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_token_set_derive_key_version(
+ rp_token_t *token,
+ const axutil_env_t *env,
+ derive_key_version_t version)
+{
+ token->derive_key_version = version;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN derive_key_version_t AXIS2_CALL
+rp_token_get_derive_key_version(
+ rp_token_t *token,
+ const axutil_env_t *env)
+{
+ return token->derive_key_version;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_token_set_inclusion(
+ rp_token_t *token,
+ const axutil_env_t *env,
+ axis2_char_t *inclusion)
+{
+ token->inclusion = inclusion;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_token_get_inclusion(
+ rp_token_t *token,
+ const axutil_env_t *env)
+{
+ return token->inclusion;
+}
+
+AXIS2_EXTERN derive_key_type_t AXIS2_CALL
+rp_token_get_derivedkey_type(
+ rp_token_t * token,
+ const axutil_env_t * env)
+{
+ return token->derive_key;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_token_set_derivedkey_type(
+ rp_token_t * token,
+ const axutil_env_t * env,
+ derive_key_type_t derivedkey)
+{
+ token->derive_key = derivedkey;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_token_get_is_issuer_name(
+ rp_token_t * token,
+ const axutil_env_t * env)
+{
+ return token->is_issuer_name;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_token_set_is_issuer_name(
+ rp_token_t * token,
+ const axutil_env_t * env,
+ axis2_bool_t is_issuer_name)
+{
+ token->is_issuer_name = is_issuer_name;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axiom_node_t *AXIS2_CALL
+rp_token_get_claim(
+ rp_token_t * token,
+ const axutil_env_t * env)
+{
+ return token->claim;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_token_set_claim(
+ rp_token_t * token,
+ const axutil_env_t * env,
+ axiom_node_t *claim)
+{
+ token->claim = claim;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_token_increment_ref(
+ rp_token_t * token,
+ const axutil_env_t * env)
+{
+ token->ref++;
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/model/transport_binding.c b/neethi/src/secpolicy/model/transport_binding.c
new file mode 100644
index 0000000..cb84fff
--- /dev/null
+++ b/neethi/src/secpolicy/model/transport_binding.c
@@ -0,0 +1,137 @@
+/*
+ * 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 <rp_transport_binding.h>
+
+struct rp_transport_binding_t
+{
+ rp_binding_commons_t *binding_commons;
+ rp_property_t *transport_token;
+ int ref;
+};
+
+AXIS2_EXTERN rp_transport_binding_t *AXIS2_CALL
+rp_transport_binding_create(
+ const axutil_env_t * env)
+{
+ rp_transport_binding_t *transport_binding = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ transport_binding = (rp_transport_binding_t *)AXIS2_MALLOC(env->allocator,
+ sizeof(rp_transport_binding_t));
+
+ if(transport_binding == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ transport_binding->binding_commons = NULL;
+ transport_binding->transport_token = NULL;
+ transport_binding->ref = 0;
+
+ return transport_binding;
+
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_transport_binding_free(
+ rp_transport_binding_t * transport_binding,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ if(transport_binding)
+ {
+ if(--(transport_binding->ref) > 0)
+ {
+ return;
+ }
+ if(transport_binding->binding_commons)
+ {
+ rp_binding_commons_free(transport_binding->binding_commons, env);
+ transport_binding->binding_commons = NULL;
+ }
+ if(transport_binding->transport_token)
+ {
+ rp_property_free(transport_binding->transport_token, env);
+ transport_binding->transport_token = NULL;
+ }
+ AXIS2_FREE(env->allocator, transport_binding);
+ }
+
+ return;
+}
+
+/* Implementations */
+
+AXIS2_EXTERN rp_binding_commons_t *AXIS2_CALL
+rp_transport_binding_get_binding_commons(
+ rp_transport_binding_t * transport_binding,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, NULL);
+
+ return transport_binding->binding_commons;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_transport_binding_set_binding_commons(
+ rp_transport_binding_t * transport_binding,
+ const axutil_env_t * env,
+ rp_binding_commons_t * binding_commons)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, binding_commons, AXIS2_FAILURE);
+
+ transport_binding->binding_commons = binding_commons;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_property_t *AXIS2_CALL
+rp_transport_binding_get_transport_token(
+ rp_transport_binding_t * transport_binding,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, NULL);
+
+ return transport_binding->transport_token;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_transport_binding_set_transport_token(
+ rp_transport_binding_t * transport_binding,
+ const axutil_env_t * env,
+ rp_property_t * transport_token)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, transport_token, AXIS2_FAILURE);
+
+ rp_property_increment_ref(transport_token, env);
+ transport_binding->transport_token = transport_token;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_transport_binding_increment_ref(
+ rp_transport_binding_t * transport_binding,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ transport_binding->ref++;
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/model/trust10.c b/neethi/src/secpolicy/model/trust10.c
new file mode 100644
index 0000000..54d98c8
--- /dev/null
+++ b/neethi/src/secpolicy/model/trust10.c
@@ -0,0 +1,201 @@
+/*
+ * 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 <rp_trust10.h>
+
+struct rp_trust10_t
+{
+ axis2_bool_t must_support_client_challenge;
+ axis2_bool_t must_support_server_challenge;
+ axis2_bool_t require_client_entropy;
+ axis2_bool_t require_server_entropy;
+ axis2_bool_t must_support_issued_token;
+ int ref;
+};
+
+AXIS2_EXTERN rp_trust10_t *AXIS2_CALL
+rp_trust10_create(
+ const axutil_env_t * env)
+{
+ rp_trust10_t *trust10 = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ trust10 = (rp_trust10_t *)AXIS2_MALLOC(env->allocator, sizeof(rp_trust10_t));
+
+ if(trust10 == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ trust10->must_support_client_challenge = AXIS2_FALSE;
+ trust10->must_support_server_challenge = AXIS2_FALSE;
+ trust10->require_client_entropy = AXIS2_FALSE;
+ trust10->require_server_entropy = AXIS2_FALSE;
+ trust10->must_support_issued_token = AXIS2_FALSE;
+ trust10->ref = 0;
+
+ return trust10;
+
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_trust10_free(
+ rp_trust10_t * trust10,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ if(trust10)
+ {
+ if(--(trust10->ref) > 0)
+ {
+ return;
+ }
+
+ AXIS2_FREE(env->allocator, trust10);
+ trust10 = NULL;
+ }
+ return;
+}
+
+/* Implementations */
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_trust10_get_must_support_client_challenge(
+ rp_trust10_t * trust10,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ return trust10->must_support_client_challenge;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_trust10_set_must_support_client_challenge(
+ rp_trust10_t * trust10,
+ const axutil_env_t * env,
+ axis2_bool_t must_support_client_challenge)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, must_support_client_challenge, AXIS2_FAILURE);
+ trust10->must_support_client_challenge = must_support_client_challenge;
+
+ return AXIS2_SUCCESS;
+
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_trust10_get_must_support_server_challenge(
+ rp_trust10_t * trust10,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ return trust10->must_support_server_challenge;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_trust10_set_must_support_server_challenge(
+ rp_trust10_t * trust10,
+ const axutil_env_t * env,
+ axis2_bool_t must_support_server_challenge)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, must_support_server_challenge, AXIS2_FAILURE);
+ trust10->must_support_server_challenge = must_support_server_challenge;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_trust10_get_require_client_entropy(
+ rp_trust10_t * trust10,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ return trust10->require_client_entropy;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_trust10_set_require_client_entropy(
+ rp_trust10_t * trust10,
+ const axutil_env_t * env,
+ axis2_bool_t require_client_entropy)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, require_client_entropy, AXIS2_FAILURE);
+ trust10->require_client_entropy = require_client_entropy;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_trust10_get_require_server_entropy(
+ rp_trust10_t * trust10,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ return trust10->require_server_entropy;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_trust10_set_require_server_entropy(
+ rp_trust10_t * trust10,
+ const axutil_env_t * env,
+ axis2_bool_t require_server_entropy)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, require_server_entropy, AXIS2_FAILURE);
+ trust10->require_server_entropy = require_server_entropy;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_trust10_get_must_support_issued_token(
+ rp_trust10_t * trust10,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ return trust10->must_support_issued_token;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_trust10_set_must_support_issued_token(
+ rp_trust10_t * trust10,
+ const axutil_env_t * env,
+ axis2_bool_t must_support_issued_token)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, must_support_issued_token, AXIS2_FAILURE);
+ trust10->must_support_issued_token = must_support_issued_token;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_trust10_increment_ref(
+ rp_trust10_t * trust10,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ trust10->ref++;
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/model/ut.c b/neethi/src/secpolicy/model/ut.c
new file mode 100644
index 0000000..867e5c1
--- /dev/null
+++ b/neethi/src/secpolicy/model/ut.c
@@ -0,0 +1,214 @@
+/*
+ * 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 <rp_username_token.h>
+#include <rp_token.h>
+
+struct rp_username_token_t
+{
+ axis2_char_t *inclusion;
+ password_type_t password_type;
+ axis2_bool_t useUTprofile10;
+ axis2_bool_t useUTprofile11;
+ rp_token_t *token;
+ int ref;
+};
+
+AXIS2_EXTERN rp_username_token_t *AXIS2_CALL
+rp_username_token_create(
+ const axutil_env_t * env)
+{
+ rp_username_token_t *username_token = NULL;
+ username_token = (rp_username_token_t *)AXIS2_MALLOC(env->allocator,
+ sizeof(rp_username_token_t));
+
+ if(!username_token)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] User name token creation failed. Insufficient memory");
+ return NULL;
+ }
+
+ username_token->token = rp_token_create(env);
+ if(!username_token->token)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] User name token creation failed.");
+ rp_username_token_free(username_token, env);
+ return NULL;
+ }
+
+ username_token->inclusion = RP_INCLUDE_ALWAYS;
+ username_token->password_type = PASSWORD_PLAIN;
+ username_token->useUTprofile10 = AXIS2_TRUE;
+ username_token->useUTprofile11 = AXIS2_FALSE;
+ username_token->ref = 0;
+
+ return username_token;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_username_token_free(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env)
+{
+ if(username_token)
+ {
+ if(--(username_token->ref) > 0)
+ {
+ return;
+ }
+
+ rp_token_free(username_token->token, env);
+ AXIS2_FREE(env->allocator, username_token);
+ username_token = NULL;
+ }
+}
+
+/* Implementations */
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_username_token_get_inclusion(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env)
+{
+ return username_token->inclusion;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_username_token_set_inclusion(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env,
+ axis2_char_t * inclusion)
+{
+ AXIS2_PARAM_CHECK(env->error, inclusion, AXIS2_FAILURE);
+ username_token->inclusion = inclusion;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_username_token_get_useUTprofile10(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env)
+{
+ return username_token->useUTprofile10;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_username_token_set_useUTprofile10(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env,
+ axis2_bool_t useUTprofile10)
+{
+ username_token->useUTprofile10 = useUTprofile10;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_username_token_get_useUTprofile11(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env)
+{
+ return username_token->useUTprofile10;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_username_token_set_useUTprofile11(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env,
+ axis2_bool_t useUTprofile11)
+{
+ username_token->useUTprofile11 = useUTprofile11;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_username_token_increment_ref(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env)
+{
+ username_token->ref++;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_username_token_get_issuer(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env)
+{
+ return rp_token_get_issuer(username_token->token, env);
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_username_token_set_issuer(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env,
+ axis2_char_t * issuer)
+{
+ return rp_token_set_issuer(username_token->token, env, issuer);
+}
+
+AXIS2_EXTERN derive_key_type_t AXIS2_CALL
+rp_username_token_get_derivedkey_type(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env)
+{
+ return rp_token_get_derivedkey_type(username_token->token, env);
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_username_token_set_derivedkey_type(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env,
+ derive_key_type_t derivedkey)
+{
+ return rp_token_set_derivedkey_type(username_token->token, env, derivedkey);
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_username_token_get_is_issuer_name(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env)
+{
+ return rp_token_get_is_issuer_name(username_token->token, env);
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_username_token_set_is_issuer_name(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env,
+ axis2_bool_t is_issuer_name)
+{
+ return rp_token_set_is_issuer_name(username_token->token, env, is_issuer_name);
+}
+
+AXIS2_EXTERN axiom_node_t *AXIS2_CALL
+rp_username_token_get_claim(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env)
+{
+ return rp_token_get_claim(username_token->token, env);
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_username_token_set_claim(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env,
+ axiom_node_t *claim)
+{
+ return rp_token_set_claim(username_token->token, env, claim);
+}
diff --git a/neethi/src/secpolicy/model/wss10.c b/neethi/src/secpolicy/model/wss10.c
new file mode 100644
index 0000000..2ee451d
--- /dev/null
+++ b/neethi/src/secpolicy/model/wss10.c
@@ -0,0 +1,178 @@
+/*
+ * 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 <rp_wss10.h>
+
+struct rp_wss10_t
+{
+ axis2_bool_t must_support_ref_key_identifier;
+ axis2_bool_t must_support_ref_issuer_serial;
+ axis2_bool_t must_support_ref_external_uri;
+ axis2_bool_t must_support_ref_embedded_token;
+ axis2_bool_t must_support_direct_reference;
+ int ref;
+};
+
+AXIS2_EXTERN rp_wss10_t *AXIS2_CALL
+rp_wss10_create(
+ const axutil_env_t * env)
+{
+ rp_wss10_t *wss10 = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ wss10 = (rp_wss10_t *)AXIS2_MALLOC(env->allocator, sizeof(rp_wss10_t));
+
+ if(wss10 == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ wss10->must_support_ref_key_identifier = AXIS2_FALSE;
+ wss10->must_support_ref_issuer_serial = AXIS2_FALSE;
+ wss10->must_support_ref_external_uri = AXIS2_FALSE;
+ wss10->must_support_ref_embedded_token = AXIS2_FALSE;
+ wss10->must_support_direct_reference = AXIS2_TRUE;
+ wss10->ref = 0;
+
+ return wss10;
+
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_wss10_free(
+ rp_wss10_t * wss10,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ if(wss10)
+ {
+ if(--(wss10->ref) > 0)
+ {
+ return;
+ }
+
+ AXIS2_FREE(env->allocator, wss10);
+ wss10 = NULL;
+ }
+ return;
+}
+
+/* Implementations */
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_wss10_get_must_support_ref_key_identifier(
+ rp_wss10_t * wss10,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ return wss10->must_support_ref_key_identifier;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_wss10_set_must_support_ref_key_identifier(
+ rp_wss10_t * wss10,
+ const axutil_env_t * env,
+ axis2_bool_t must_support_ref_key_identifier)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, must_support_ref_key_identifier, AXIS2_FAILURE);
+ wss10->must_support_ref_key_identifier = must_support_ref_key_identifier;
+
+ return AXIS2_SUCCESS;
+
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_wss10_get_must_support_ref_issuer_serial(
+ rp_wss10_t * wss10,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ return wss10->must_support_ref_issuer_serial;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_wss10_set_must_support_ref_issuer_serial(
+ rp_wss10_t * wss10,
+ const axutil_env_t * env,
+ axis2_bool_t must_support_ref_issuer_serial)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, must_support_ref_issuer_serial, AXIS2_FAILURE);
+ wss10->must_support_ref_issuer_serial = must_support_ref_issuer_serial;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_wss10_get_must_support_ref_external_uri(
+ rp_wss10_t * wss10,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ return wss10->must_support_ref_external_uri;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_wss10_set_must_support_ref_external_uri(
+ rp_wss10_t * wss10,
+ const axutil_env_t * env,
+ axis2_bool_t must_support_ref_external_uri)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, must_support_ref_external_uri, AXIS2_FAILURE);
+ wss10->must_support_ref_external_uri = must_support_ref_external_uri;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_wss10_get_must_support_ref_embedded_token(
+ rp_wss10_t * wss10,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ return wss10->must_support_ref_embedded_token;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_wss10_set_must_support_ref_embedded_token(
+ rp_wss10_t * wss10,
+ const axutil_env_t * env,
+ axis2_bool_t must_support_ref_embedded_token)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, must_support_ref_embedded_token, AXIS2_FAILURE);
+ wss10->must_support_ref_embedded_token = must_support_ref_embedded_token;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_wss10_increment_ref(
+ rp_wss10_t * wss10,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ wss10->ref++;
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/model/wss11.c b/neethi/src/secpolicy/model/wss11.c
new file mode 100644
index 0000000..552646c
--- /dev/null
+++ b/neethi/src/secpolicy/model/wss11.c
@@ -0,0 +1,256 @@
+/*
+ * 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 <rp_wss11.h>
+
+struct rp_wss11_t
+{
+ axis2_bool_t must_support_ref_key_identifier;
+ axis2_bool_t must_support_ref_issuer_serial;
+ axis2_bool_t must_support_ref_external_uri;
+ axis2_bool_t must_support_ref_embedded_token;
+ axis2_bool_t must_support_ref_thumbprint;
+ axis2_bool_t must_support_ref_encryptedkey;
+ axis2_bool_t require_signature_confirmation;
+ axis2_bool_t must_support_direct_reference;
+ int ref;
+};
+
+AXIS2_EXTERN rp_wss11_t *AXIS2_CALL
+rp_wss11_create(
+ const axutil_env_t * env)
+{
+ rp_wss11_t *wss11 = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ wss11 = (rp_wss11_t *)AXIS2_MALLOC(env->allocator, sizeof(rp_wss11_t));
+
+ if(wss11 == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ wss11->must_support_ref_key_identifier = AXIS2_FALSE;
+ wss11->must_support_ref_issuer_serial = AXIS2_FALSE;
+ wss11->must_support_ref_external_uri = AXIS2_FALSE;
+ wss11->must_support_ref_embedded_token = AXIS2_FALSE;
+ wss11->must_support_ref_thumbprint = AXIS2_FALSE;
+ wss11->must_support_ref_encryptedkey = AXIS2_FALSE;
+ wss11->require_signature_confirmation = AXIS2_FALSE;
+ wss11->must_support_direct_reference = AXIS2_TRUE;
+ wss11->ref = 0;
+
+ return wss11;
+
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_wss11_free(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ if(wss11)
+ {
+ if(--(wss11->ref) > 0)
+ {
+ return;
+ }
+ AXIS2_FREE(env->allocator, wss11);
+ wss11 = NULL;
+ }
+ return;
+}
+
+/* Implementations */
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_wss11_get_must_support_ref_key_identifier(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ return wss11->must_support_ref_key_identifier;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_wss11_set_must_support_ref_key_identifier(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env,
+ axis2_bool_t must_support_ref_key_identifier)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, must_support_ref_key_identifier, AXIS2_FAILURE);
+ wss11->must_support_ref_key_identifier = must_support_ref_key_identifier;
+
+ return AXIS2_SUCCESS;
+
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_wss11_get_must_support_ref_issuer_serial(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ return wss11->must_support_ref_issuer_serial;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_wss11_set_must_support_ref_issuer_serial(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env,
+ axis2_bool_t must_support_ref_issuer_serial)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, must_support_ref_issuer_serial, AXIS2_FAILURE);
+ wss11->must_support_ref_issuer_serial = must_support_ref_issuer_serial;
+
+ return AXIS2_SUCCESS;
+
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_wss11_get_must_support_ref_external_uri(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ return wss11->must_support_ref_external_uri;
+
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_wss11_set_must_support_ref_external_uri(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env,
+ axis2_bool_t must_support_ref_external_uri)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, must_support_ref_external_uri, AXIS2_FAILURE);
+ wss11->must_support_ref_external_uri = must_support_ref_external_uri;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_wss11_get_must_support_ref_embedded_token(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ return wss11->must_support_ref_embedded_token;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_wss11_set_must_support_ref_embedded_token(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env,
+ axis2_bool_t must_support_ref_embedded_token)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, must_support_ref_embedded_token, AXIS2_FAILURE);
+ wss11->must_support_ref_embedded_token = must_support_ref_embedded_token;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_wss11_get_must_support_ref_thumbprint(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ return wss11->must_support_ref_thumbprint;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_wss11_set_must_support_ref_thumbprint(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env,
+ axis2_bool_t must_support_ref_thumbprint)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+ AXIS2_PARAM_CHECK(env->error, must_support_ref_thumbprint, AXIS2_FAILURE);
+ wss11->must_support_ref_thumbprint = must_support_ref_thumbprint;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_wss11_get_must_support_ref_encryptedkey(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ return wss11->must_support_ref_encryptedkey;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_wss11_set_must_support_ref_encryptedkey(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env,
+ axis2_bool_t must_support_ref_encryptedkey)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, must_support_ref_encryptedkey, AXIS2_FAILURE);
+ wss11->must_support_ref_encryptedkey = must_support_ref_encryptedkey;
+
+ return AXIS2_SUCCESS;
+
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_wss11_get_require_signature_confirmation(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ return wss11->require_signature_confirmation;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_wss11_set_require_signature_confirmation(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env,
+ axis2_bool_t require_signature_confirmation)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, require_signature_confirmation, AXIS2_FAILURE);
+ wss11->require_signature_confirmation = require_signature_confirmation;
+
+ return AXIS2_SUCCESS;
+
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_wss11_increment_ref(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ wss11->ref++;
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/model/x509_token.c b/neethi/src/secpolicy/model/x509_token.c
new file mode 100644
index 0000000..057af86
--- /dev/null
+++ b/neethi/src/secpolicy/model/x509_token.c
@@ -0,0 +1,231 @@
+/*
+ * 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 <rp_x509_token.h>
+
+struct rp_x509_token_t
+{
+ rp_token_t *token;
+ axis2_bool_t require_key_identifier_reference;
+ axis2_bool_t require_issuer_serial_reference;
+ axis2_bool_t require_embedded_token_reference;
+ axis2_bool_t require_thumb_print_reference;
+ axis2_char_t *token_version_and_type;
+ int ref;
+
+};
+
+AXIS2_EXTERN rp_x509_token_t *AXIS2_CALL
+rp_x509_token_create(
+ const axutil_env_t * env)
+{
+ rp_x509_token_t *x509_token = NULL;
+ x509_token = (rp_x509_token_t *)AXIS2_MALLOC(env->allocator, sizeof(rp_x509_token_t));
+
+ if(!x509_token)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] X509 token assertion creation failed. Insufficient memory");
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ x509_token->require_key_identifier_reference = AXIS2_FALSE;
+ x509_token->require_issuer_serial_reference = AXIS2_FALSE;
+ x509_token->require_embedded_token_reference = AXIS2_FALSE;
+ x509_token->require_thumb_print_reference = AXIS2_FALSE;
+ x509_token->token_version_and_type = RP_WSS_X509_V3_TOKEN_10;
+ x509_token->ref = 0;
+
+ x509_token->token = rp_token_create(env);
+ if(!x509_token->token)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] X509 token assertion creation failed.");
+ rp_x509_token_free(x509_token, env);
+ return NULL;
+ }
+ return x509_token;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_x509_token_free(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env)
+{
+ if(x509_token)
+ {
+ if(--(x509_token->ref) > 0)
+ {
+ return;
+ }
+
+ rp_token_free(x509_token->token, env);
+ AXIS2_FREE(env->allocator, x509_token);
+ x509_token = NULL;
+ }
+}
+
+/* Implementations */
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_x509_token_get_inclusion(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env)
+{
+ return rp_token_get_inclusion(x509_token->token, env);
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_x509_token_set_inclusion(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env,
+ axis2_char_t * inclusion)
+{
+ return rp_token_set_inclusion(x509_token->token, env, inclusion);
+}
+
+AXIS2_EXTERN derive_key_type_t AXIS2_CALL
+rp_x509_token_get_derivedkey(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env)
+{
+ return rp_token_get_derivedkey_type(x509_token->token, env);
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_x509_token_set_derivedkey(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env,
+ derive_key_type_t derivedkeys)
+{
+ return rp_token_set_derivedkey_type(x509_token->token, env, derivedkeys);
+}
+
+AXIS2_EXTERN derive_key_version_t AXIS2_CALL
+rp_x509_token_get_derivedkey_version(
+ rp_x509_token_t *x509_token,
+ const axutil_env_t *env)
+{
+ return rp_token_get_derive_key_version(x509_token->token, env);
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_x509_token_set_derivedkey_version(
+ rp_x509_token_t *x509_token,
+ const axutil_env_t *env,
+ derive_key_version_t version)
+{
+ return rp_token_set_derive_key_version(x509_token->token, env, version);
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_x509_token_get_require_key_identifier_reference(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env)
+{
+ return x509_token->require_key_identifier_reference;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_x509_token_set_require_key_identifier_reference(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env,
+ axis2_bool_t require_key_identifier_reference)
+{
+ x509_token->require_key_identifier_reference = require_key_identifier_reference;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_x509_token_get_require_issuer_serial_reference(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env)
+{
+ return x509_token->require_issuer_serial_reference;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_x509_token_set_require_issuer_serial_reference(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env,
+ axis2_bool_t require_issuer_serial_reference)
+{
+ x509_token->require_issuer_serial_reference = require_issuer_serial_reference;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_x509_token_get_require_embedded_token_reference(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env)
+{
+ return x509_token->require_embedded_token_reference;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_x509_token_set_require_embedded_token_reference(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env,
+ axis2_bool_t require_embedded_token_reference)
+{
+ x509_token->require_embedded_token_reference = require_embedded_token_reference;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_x509_token_get_require_thumb_print_reference(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env)
+{
+ return x509_token->require_thumb_print_reference;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_x509_token_set_require_thumb_print_reference(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env,
+ axis2_bool_t require_thumb_print_reference)
+{
+ x509_token->require_thumb_print_reference = require_thumb_print_reference;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_x509_token_get_token_version_and_type(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env)
+{
+ return x509_token->token_version_and_type;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_x509_token_set_token_version_and_type(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env,
+ axis2_char_t * token_version_and_type)
+{
+ x509_token->token_version_and_type = token_version_and_type;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_x509_token_increment_ref(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env)
+{
+ x509_token->ref++;
+ return AXIS2_SUCCESS;
+}