Author: shankar Date: Mon Jan 28 23:02:48 2008 New Revision: 616187 URL: http://svn.apache.org/viewvc?rev=616187&view=rev Log: SecurityContextToken assertion and SecureConversationToken assertion support
Added: webservices/axis2/trunk/c/neethi/include/rp_bootstrap_policy_builder.h webservices/axis2/trunk/c/neethi/include/rp_security_context_token_builder.h webservices/axis2/trunk/c/neethi/src/secpolicy/builder/bootstrap_policy_builder.c webservices/axis2/trunk/c/neethi/src/secpolicy/builder/security_context_token_builder.c Modified: webservices/axis2/trunk/c/ides/vc/axis2c/neethi/neethi.vcproj webservices/axis2/trunk/c/neethi/include/neethi_assertion.h webservices/axis2/trunk/c/neethi/include/rp_builders.h webservices/axis2/trunk/c/neethi/include/rp_defines.h webservices/axis2/trunk/c/neethi/include/rp_encryption_token_builder.h webservices/axis2/trunk/c/neethi/include/rp_protection_token_builder.h webservices/axis2/trunk/c/neethi/include/rp_security_context_token.h webservices/axis2/trunk/c/neethi/include/rp_signature_token_builder.h webservices/axis2/trunk/c/neethi/src/assertion.c webservices/axis2/trunk/c/neethi/src/assertion_builder.c webservices/axis2/trunk/c/neethi/src/secpolicy/builder/Makefile.am webservices/axis2/trunk/c/neethi/src/secpolicy/builder/encryption_token_builder.c webservices/axis2/trunk/c/neethi/src/secpolicy/builder/protection_token_builder.c webservices/axis2/trunk/c/neethi/src/secpolicy/builder/signature_token_builder.c webservices/axis2/trunk/c/neethi/src/secpolicy/model/property.c webservices/axis2/trunk/c/neethi/src/secpolicy/model/security_context_token.c Modified: webservices/axis2/trunk/c/ides/vc/axis2c/neethi/neethi.vcproj URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/ides/vc/axis2c/neethi/neethi.vcproj?rev=616187&r1=616186&r2=616187&view=diff ============================================================================== --- webservices/axis2/trunk/c/ides/vc/axis2c/neethi/neethi.vcproj (original) +++ webservices/axis2/trunk/c/ides/vc/axis2c/neethi/neethi.vcproj Mon Jan 28 23:02:48 2008 @@ -239,6 +239,10 @@ > </File> <File + RelativePath="..\..\..\..\neethi\src\secpolicy\builder\bootstrap_policy_builder.c" + > + </File> + <File RelativePath="..\..\..\..\neethi\src\secpolicy\builder\encryption_token_builder.c" > </File> @@ -275,6 +279,10 @@ > </File> <File + RelativePath="..\..\..\..\neethi\src\secpolicy\builder\security_context_token_builder.c" + > + </File> + <File RelativePath="..\..\..\..\neethi\src\secpolicy\builder\signature_token_builder.c" > </File> @@ -495,6 +503,10 @@ > </File> <File + RelativePath="..\..\..\..\neethi\include\rp_bootstrap_policy_builder.h" + > + </File> + <File RelativePath="..\..\..\..\neethi\include\rp_builders.h" > </File> @@ -576,6 +588,10 @@ </File> <File RelativePath="..\..\..\..\neethi\include\rp_security_context_token.h" + > + </File> + <File + RelativePath="..\..\..\..\neethi\include\rp_security_context_token_builder.h" > </File> <File Modified: webservices/axis2/trunk/c/neethi/include/neethi_assertion.h URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/include/neethi_assertion.h?rev=616187&r1=616186&r2=616187&view=diff ============================================================================== --- webservices/axis2/trunk/c/neethi/include/neethi_assertion.h (original) +++ webservices/axis2/trunk/c/neethi/include/neethi_assertion.h Mon Jan 28 23:02:48 2008 @@ -47,6 +47,11 @@ ASSERTION_TYPE_WSS_USERNAME_TOKEN_11, ASSERTION_TYPE_USERNAME_TOKEN, ASSERTION_TYPE_X509_TOKEN, + ASSERTION_TYPE_SECURITY_CONTEXT_TOKEN, + ASSERTION_TYPE_REQUIRE_EXTERNAL_URI, + ASSERTION_TYPE_SC10_SECURITY_CONTEXT_TOKEN, + ASSERTION_TYPE_ISSUER, + ASSERTION_TYPE_BOOTSTRAP_POLICY, ASSERTION_TYPE_MUST_SUPPORT_REF_KEY_IDENTIFIER, ASSERTION_TYPE_MUST_SUPPORT_REF_ISSUER_SERIAL, ASSERTION_TYPE_MUST_SUPPORT_REF_EXTERNAL_URI, Added: webservices/axis2/trunk/c/neethi/include/rp_bootstrap_policy_builder.h URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/include/rp_bootstrap_policy_builder.h?rev=616187&view=auto ============================================================================== --- webservices/axis2/trunk/c/neethi/include/rp_bootstrap_policy_builder.h (added) +++ webservices/axis2/trunk/c/neethi/include/rp_bootstrap_policy_builder.h Mon Jan 28 23:02:48 2008 @@ -0,0 +1,44 @@ + +/* + * Copyright 2004,2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef RP_BOOTSTRAP_POLICY_BUILDER_H +#define RP_BOOTSTRAP_POLICY_BUILDER_H + +/** @defgroup rp_bootstrap_policy_builder + * @ingroup rp_bootstrap_policy_builder + * @{ + */ + +#include <rp_includes.h> +#include <rp_property.h> +#include <neethi_assertion.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + 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); + +#ifdef __cplusplus +} +#endif +#endif Modified: webservices/axis2/trunk/c/neethi/include/rp_builders.h URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/include/rp_builders.h?rev=616187&r1=616186&r2=616187&view=diff ============================================================================== --- webservices/axis2/trunk/c/neethi/include/rp_builders.h (original) +++ webservices/axis2/trunk/c/neethi/include/rp_builders.h Mon Jan 28 23:02:48 2008 @@ -33,6 +33,8 @@ #include <rp_qname_matcher.h> #include <rp_https_token_builder.h> #include <rp_x509_token_builder.h> +#include <rp_security_context_token_builder.h> +#include <rp_bootstrap_policy_builder.h> #include <rp_recipient_token_builder.h> #include <rp_initiator_token_builder.h> #include <rp_asymmetric_binding_builder.h> Modified: webservices/axis2/trunk/c/neethi/include/rp_defines.h URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/include/rp_defines.h?rev=616187&r1=616186&r2=616187&view=diff ============================================================================== --- webservices/axis2/trunk/c/neethi/include/rp_defines.h (original) +++ webservices/axis2/trunk/c/neethi/include/rp_defines.h Mon Jan 28 23:02:48 2008 @@ -145,6 +145,7 @@ #define RP_USERNAME_TOKEN "UsernameToken" #define RP_X509_TOKEN "X509Token" #define RP_SECURITY_CONTEXT_TOKEN "SecurityContextToken" +#define RP_SECURE_CONVERSATION_TOKEN "SecureConversationToken" #define RP_HTTPS_TOKEN "HttpsToken" #define RP_INCLUDE_TOKEN "IncludeToken" @@ -172,6 +173,8 @@ #define RP_REQUIRE_EXTERNAL_URI_REFERENCE "RequireExternalUriReference" #define RP_SC10_SECURITY_CONTEXT_TOKEN "SC10SecurityContextToken" +#define RP_BOOTSTRAP_POLICY "BootstrapPolicy" +#define RP_ISSUER "Issuer" #define RP_REQUIRE_CLIENT_CERTIFICATE "RequireClientCertificate" Modified: webservices/axis2/trunk/c/neethi/include/rp_encryption_token_builder.h URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/include/rp_encryption_token_builder.h?rev=616187&r1=616186&r2=616187&view=diff ============================================================================== --- webservices/axis2/trunk/c/neethi/include/rp_encryption_token_builder.h (original) +++ webservices/axis2/trunk/c/neethi/include/rp_encryption_token_builder.h Mon Jan 28 23:02:48 2008 @@ -26,6 +26,7 @@ #include <rp_includes.h> #include <rp_property.h> #include <rp_x509_token.h> +#include <rp_security_context_token.h> #include <neethi_assertion.h> #ifdef __cplusplus Modified: webservices/axis2/trunk/c/neethi/include/rp_protection_token_builder.h URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/include/rp_protection_token_builder.h?rev=616187&r1=616186&r2=616187&view=diff ============================================================================== --- webservices/axis2/trunk/c/neethi/include/rp_protection_token_builder.h (original) +++ webservices/axis2/trunk/c/neethi/include/rp_protection_token_builder.h Mon Jan 28 23:02:48 2008 @@ -26,6 +26,7 @@ #include <rp_includes.h> #include <rp_property.h> #include <rp_x509_token.h> +#include <rp_security_context_token.h> #include <neethi_assertion.h> #ifdef __cplusplus Modified: webservices/axis2/trunk/c/neethi/include/rp_security_context_token.h URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/include/rp_security_context_token.h?rev=616187&r1=616186&r2=616187&view=diff ============================================================================== --- webservices/axis2/trunk/c/neethi/include/rp_security_context_token.h (original) +++ webservices/axis2/trunk/c/neethi/include/rp_security_context_token.h Mon Jan 28 23:02:48 2008 @@ -24,6 +24,7 @@ */ #include <rp_includes.h> +#include <neethi_policy.h> #ifdef __cplusplus extern "C" @@ -84,6 +85,39 @@ rp_security_context_token_t * security_context_token, const axutil_env_t * env, axis2_bool_t sc10_security_context_token); + + 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); + + 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); + + 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); + + 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); + + 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); + + 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); AXIS2_EXTERN axis2_status_t AXIS2_CALL rp_security_context_token_increment_ref( Added: webservices/axis2/trunk/c/neethi/include/rp_security_context_token_builder.h URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/include/rp_security_context_token_builder.h?rev=616187&view=auto ============================================================================== --- webservices/axis2/trunk/c/neethi/include/rp_security_context_token_builder.h (added) +++ webservices/axis2/trunk/c/neethi/include/rp_security_context_token_builder.h Mon Jan 28 23:02:48 2008 @@ -0,0 +1,46 @@ + +/* + * Copyright 2004,2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef RP_SECURITY_CONTEXT_TOKEN_BUILDER_H +#define RP_SECURITY_CONTEXT_TOKEN_BUILDER_H + +/** @defgroup rp_security_context_token_builder + * @ingroup rp_security_context_token_builder + * @{ + */ + +#include <rp_includes.h> +#include <rp_property.h> +#include <rp_security_context_token.h> +#include <neethi_assertion.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + 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_bool_t *is_secure_conversation_token); + +#ifdef __cplusplus +} +#endif +#endif Modified: webservices/axis2/trunk/c/neethi/include/rp_signature_token_builder.h URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/include/rp_signature_token_builder.h?rev=616187&r1=616186&r2=616187&view=diff ============================================================================== --- webservices/axis2/trunk/c/neethi/include/rp_signature_token_builder.h (original) +++ webservices/axis2/trunk/c/neethi/include/rp_signature_token_builder.h Mon Jan 28 23:02:48 2008 @@ -26,6 +26,7 @@ #include <rp_includes.h> #include <rp_property.h> #include <rp_x509_token.h> +#include <rp_security_context_token.h> #include <neethi_assertion.h> #ifdef __cplusplus Modified: webservices/axis2/trunk/c/neethi/src/assertion.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/assertion.c?rev=616187&r1=616186&r2=616187&view=diff ============================================================================== --- webservices/axis2/trunk/c/neethi/src/assertion.c (original) +++ webservices/axis2/trunk/c/neethi/src/assertion.c Mon Jan 28 23:02:48 2008 @@ -115,84 +115,88 @@ { rp_x509_token_increment_ref((rp_x509_token_t *) value, env); } - if (type == ASSERTION_TYPE_INITIATOR_TOKEN) + else if (type == ASSERTION_TYPE_SECURITY_CONTEXT_TOKEN) + { + rp_security_context_token_increment_ref((rp_security_context_token_t *) value, env); + } + else if (type == ASSERTION_TYPE_INITIATOR_TOKEN) { rp_property_increment_ref((rp_property_t *) value, env); } - if (type == ASSERTION_TYPE_RECIPIENT_TOKEN) + else if (type == ASSERTION_TYPE_RECIPIENT_TOKEN) { rp_property_increment_ref((rp_property_t *) value, env); } - if (type == ASSERTION_TYPE_PROTECTION_TOKEN) + else if (type == ASSERTION_TYPE_PROTECTION_TOKEN) { rp_property_increment_ref((rp_property_t *) value, env); } - if (type == ASSERTION_TYPE_ENCRYPTION_TOKEN) + else if (type == ASSERTION_TYPE_ENCRYPTION_TOKEN) { rp_property_increment_ref((rp_property_t *) value, env); } - if (type == ASSERTION_TYPE_TRANSPORT_TOKEN) + else if (type == ASSERTION_TYPE_TRANSPORT_TOKEN) { rp_property_increment_ref((rp_property_t *) value, env); } - if (type == ASSERTION_TYPE_SIGNATURE_TOKEN) + else if (type == ASSERTION_TYPE_SIGNATURE_TOKEN) { rp_property_increment_ref((rp_property_t *) value, env); } - if (type == ASSERTION_TYPE_LAYOUT) + else if (type == ASSERTION_TYPE_LAYOUT) { rp_layout_increment_ref((rp_layout_t *) value, env); } - if (type == ASSERTION_TYPE_ALGORITHM_SUITE) + else if (type == ASSERTION_TYPE_ALGORITHM_SUITE) { rp_algorithmsuite_increment_ref((rp_algorithmsuite_t *) value, env); } - if (type == ASSERTION_TYPE_WSS10) + else if (type == ASSERTION_TYPE_WSS10) { rp_wss10_increment_ref((rp_wss10_t *) value, env); } - if (type == ASSERTION_TYPE_WSS11) + else if (type == ASSERTION_TYPE_WSS11) { rp_wss11_increment_ref((rp_wss11_t *) value, env); } - if (type == ASSERTION_TYPE_TRUST10) + else if (type == ASSERTION_TYPE_TRUST10) { rp_trust10_increment_ref((rp_trust10_t *) value, env); } - if (type == ASSERTION_TYPE_SUPPORTING_TOKENS) + else if (type == ASSERTION_TYPE_SUPPORTING_TOKENS) { rp_supporting_tokens_increment_ref((rp_supporting_tokens_t *) value, env); } - if (type == ASSERTION_TYPE_USERNAME_TOKEN) + else if (type == ASSERTION_TYPE_USERNAME_TOKEN) { rp_username_token_increment_ref((rp_username_token_t *) value, env); } - if (type == ASSERTION_TYPE_ASSYMMETRIC_BINDING) + else if (type == ASSERTION_TYPE_ASSYMMETRIC_BINDING) { rp_asymmetric_binding_increment_ref((rp_asymmetric_binding_t *) value, env); } - if (type == ASSERTION_TYPE_SYMMETRIC_BINDING) + else if (type == ASSERTION_TYPE_SYMMETRIC_BINDING) { rp_symmetric_binding_increment_ref((rp_symmetric_binding_t *) value, env); } - if (type == ASSERTION_TYPE_TRANSPORT_BINDING) + else if (type == ASSERTION_TYPE_TRANSPORT_BINDING) { rp_transport_binding_increment_ref((rp_transport_binding_t *) value, env); } - if (type == ASSERTION_TYPE_SIGNED_ENCRYPTED_PARTS) + else if (type == ASSERTION_TYPE_SIGNED_ENCRYPTED_PARTS) { rp_signed_encrypted_parts_increment_ref((rp_signed_encrypted_parts_t *) value, env); } - if (type == ASSERTION_TYPE_RAMPART_CONFIG) + else if (type == ASSERTION_TYPE_RAMPART_CONFIG) { rp_rampart_config_increment_ref((rp_rampart_config_t *) value, env); } @@ -283,6 +287,10 @@ if (type == ASSERTION_TYPE_X509_TOKEN) { rp_x509_token_increment_ref((rp_x509_token_t *) value, env); + } + else if (type == ASSERTION_TYPE_SECURITY_CONTEXT_TOKEN) + { + rp_security_context_token_increment_ref((rp_security_context_token_t *)value, env); } neethi_assertion->value = (void *) value; Modified: webservices/axis2/trunk/c/neethi/src/assertion_builder.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/assertion_builder.c?rev=616187&r1=616186&r2=616187&view=diff ============================================================================== --- webservices/axis2/trunk/c/neethi/src/assertion_builder.c (original) +++ webservices/axis2/trunk/c/neethi/src/assertion_builder.c Mon Jan 28 23:02:48 2008 @@ -132,6 +132,24 @@ else return NULL; } + else if (axutil_strcmp(localname, RP_SECURITY_CONTEXT_TOKEN) == 0) + { + if (rp_match_secpolicy_qname(env, RP_SECURITY_CONTEXT_TOKEN, node, element)) + { + return rp_security_context_token_builder_build(env, node, element, AXIS2_FALSE); + } + else + return NULL; + } + else if (axutil_strcmp(localname, RP_SECURE_CONVERSATION_TOKEN) == 0) + { + if (rp_match_secpolicy_qname(env, RP_SECURE_CONVERSATION_TOKEN, node, element)) + { + return rp_security_context_token_builder_build(env, node, element, AXIS2_TRUE); + } + else + return NULL; + } else if (axutil_strcmp(localname, RP_ENCRYPT_BEFORE_SIGNING) == 0) { if (rp_match_secpolicy_qname @@ -495,6 +513,15 @@ else return NULL; } + else if(axutil_strcmp(localname, RP_BOOTSTRAP_POLICY) == 0) + { + if (rp_match_secpolicy_qname(env, RP_BOOTSTRAP_POLICY, node, element)) + { + return rp_bootstrap_policy_builder_build(env, node, element); + } + else + return NULL; + } else if (axutil_strcmp(localname, RP_MUST_SUPPORT_REF_THUMBPRINT) == 0) { if (rp_match_secpolicy_qname @@ -627,7 +654,49 @@ else return NULL; } + else if (axutil_strcmp(localname, RP_REQUIRE_EXTERNAL_URI_REFERENCE) == 0) + { + if (rp_match_secpolicy_qname + (env, RP_REQUIRE_EXTERNAL_URI_REFERENCE, node, element)) + { + neethi_assertion_t *assertion = NULL; + assertion = neethi_assertion_create(env); + neethi_assertion_set_value(assertion, env, NULL, + ASSERTION_TYPE_REQUIRE_EXTERNAL_URI); + return assertion; + } + else + return NULL; + } + else if (axutil_strcmp(localname, RP_SC10_SECURITY_CONTEXT_TOKEN) == 0) + { + if (rp_match_secpolicy_qname + (env, RP_SC10_SECURITY_CONTEXT_TOKEN, node, element)) + { + neethi_assertion_t *assertion = NULL; + assertion = neethi_assertion_create(env); + neethi_assertion_set_value(assertion, env, NULL, + ASSERTION_TYPE_SC10_SECURITY_CONTEXT_TOKEN); + return assertion; + } + else + return NULL; + } + else if (axutil_strcmp(localname, RP_ISSUER) == 0) + { + if (rp_match_secpolicy_qname(env, RP_ISSUER, node, element)) + { + neethi_assertion_t *assertion = NULL; + axis2_char_t *issuer = NULL; + issuer = axiom_element_get_text(element, env, node); + assertion = neethi_assertion_create(env); + neethi_assertion_set_value(assertion, env, issuer, ASSERTION_TYPE_ISSUER); + return assertion; + } + else + return NULL; + } else { AXIS2_ERROR_SET(env->error, Modified: webservices/axis2/trunk/c/neethi/src/secpolicy/builder/Makefile.am URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/secpolicy/builder/Makefile.am?rev=616187&r1=616186&r2=616187&view=diff ============================================================================== --- webservices/axis2/trunk/c/neethi/src/secpolicy/builder/Makefile.am (original) +++ webservices/axis2/trunk/c/neethi/src/secpolicy/builder/Makefile.am Mon Jan 28 23:02:48 2008 @@ -11,7 +11,8 @@ 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 + encryption_token_builder.c wss11_builder.c trust10_builder.c \ + bootstrap_policy_builder.c security_context_token_builder.c librp_builder_la_LIBADD = ../../../../axiom/src/om/libaxis2_axiom.la \ ../../../../util/src/libaxutil.la Added: webservices/axis2/trunk/c/neethi/src/secpolicy/builder/bootstrap_policy_builder.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/secpolicy/builder/bootstrap_policy_builder.c?rev=616187&view=auto ============================================================================== --- webservices/axis2/trunk/c/neethi/src/secpolicy/builder/bootstrap_policy_builder.c (added) +++ webservices/axis2/trunk/c/neethi/src/secpolicy/builder/bootstrap_policy_builder.c Mon Jan 28 23:02:48 2008 @@ -0,0 +1,76 @@ + +/* + * 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; + 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; + + 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; + + assertion = neethi_assertion_create_with_args(env, + (void *) neethi_policy_free, + normalized_policy, + ASSERTION_TYPE_BOOTSTRAP_POLICY); + return assertion; + } + else + return NULL; + } + else + return NULL; +} \ No newline at end of file Modified: webservices/axis2/trunk/c/neethi/src/secpolicy/builder/encryption_token_builder.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/secpolicy/builder/encryption_token_builder.c?rev=616187&r1=616186&r2=616187&view=diff ============================================================================== --- webservices/axis2/trunk/c/neethi/src/secpolicy/builder/encryption_token_builder.c (original) +++ webservices/axis2/trunk/c/neethi/src/secpolicy/builder/encryption_token_builder.c Mon Jan 28 23:02:48 2008 @@ -140,6 +140,19 @@ 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; } Modified: webservices/axis2/trunk/c/neethi/src/secpolicy/builder/protection_token_builder.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/secpolicy/builder/protection_token_builder.c?rev=616187&r1=616186&r2=616187&view=diff ============================================================================== --- webservices/axis2/trunk/c/neethi/src/secpolicy/builder/protection_token_builder.c (original) +++ webservices/axis2/trunk/c/neethi/src/secpolicy/builder/protection_token_builder.c Mon Jan 28 23:02:48 2008 @@ -140,6 +140,19 @@ 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; } Added: webservices/axis2/trunk/c/neethi/src/secpolicy/builder/security_context_token_builder.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/secpolicy/builder/security_context_token_builder.c?rev=616187&view=auto ============================================================================== --- webservices/axis2/trunk/c/neethi/src/secpolicy/builder/security_context_token_builder.c (added) +++ webservices/axis2/trunk/c/neethi/src/secpolicy/builder/security_context_token_builder.c Mon Jan 28 23:02:48 2008 @@ -0,0 +1,167 @@ + +/* + * 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_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; + 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; + /*axutil_array_list_t *temp = NULL; */ + + security_context_token = rp_security_context_token_create(env); + qname = axutil_qname_create(env, RP_INCLUDE_TOKEN, RP_SP_NS, 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); + + 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); + security_context_token_process_alternatives(env, all, security_context_token); + + assertion = + neethi_assertion_create_with_args(env, + (void *) rp_security_context_token_free, + security_context_token, + ASSERTION_TYPE_SECURITY_CONTEXT_TOKEN); + + neethi_policy_free(normalized_policy, env); + normalized_policy = NULL; + + return assertion; + } + else + return NULL; + } + else + return NULL; +} + +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) + { + rp_security_context_token_set_derivedkeys(security_context_token, env, + AXIS2_TRUE); + } + 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_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; +} Modified: webservices/axis2/trunk/c/neethi/src/secpolicy/builder/signature_token_builder.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/secpolicy/builder/signature_token_builder.c?rev=616187&r1=616186&r2=616187&view=diff ============================================================================== --- webservices/axis2/trunk/c/neethi/src/secpolicy/builder/signature_token_builder.c (original) +++ webservices/axis2/trunk/c/neethi/src/secpolicy/builder/signature_token_builder.c Mon Jan 28 23:02:48 2008 @@ -140,6 +140,19 @@ 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; } Modified: webservices/axis2/trunk/c/neethi/src/secpolicy/model/property.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/secpolicy/model/property.c?rev=616187&r1=616186&r2=616187&view=diff ============================================================================== --- webservices/axis2/trunk/c/neethi/src/secpolicy/model/property.c (original) +++ webservices/axis2/trunk/c/neethi/src/secpolicy/model/property.c Mon Jan 28 23:02:48 2008 @@ -189,40 +189,44 @@ { rp_x509_token_increment_ref((rp_x509_token_t *) value, env); } - if (type == RP_PROPERTY_WSS10) + 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); } - if (type == RP_PROPERTY_WSS11) + else if (type == RP_PROPERTY_WSS11) { rp_wss11_increment_ref((rp_wss11_t *) value, env); } - if (type == RP_PROPERTY_USERNAME_TOKEN) + else if (type == RP_PROPERTY_USERNAME_TOKEN) { rp_username_token_increment_ref((rp_username_token_t *) value, env); } - if (type == RP_PROPERTY_HTTPS_TOKEN) + else if (type == RP_PROPERTY_HTTPS_TOKEN) { rp_https_token_increment_ref((rp_https_token_t *) value, env); } - if (type == RP_PROPERTY_SIGNED_SUPPORTING_TOKEN) + else if (type == RP_PROPERTY_SIGNED_SUPPORTING_TOKEN) { rp_supporting_tokens_increment_ref((rp_supporting_tokens_t *) value, env); } - if (type == RP_PROPERTY_ASYMMETRIC_BINDING) + else if (type == RP_PROPERTY_ASYMMETRIC_BINDING) { rp_asymmetric_binding_increment_ref((rp_asymmetric_binding_t *) value, env); } - if (type == RP_PROPERTY_TRANSPORT_BINDING) + else if (type == RP_PROPERTY_TRANSPORT_BINDING) { rp_transport_binding_increment_ref((rp_transport_binding_t *) value, env); } - if (type == RP_PROPERTY_SYMMETRIC_BINDING) + else if (type == RP_PROPERTY_SYMMETRIC_BINDING) { rp_symmetric_binding_increment_ref((rp_symmetric_binding_t *) value, env); Modified: webservices/axis2/trunk/c/neethi/src/secpolicy/model/security_context_token.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/secpolicy/model/security_context_token.c?rev=616187&r1=616186&r2=616187&view=diff ============================================================================== --- webservices/axis2/trunk/c/neethi/src/secpolicy/model/security_context_token.c (original) +++ webservices/axis2/trunk/c/neethi/src/secpolicy/model/security_context_token.c Mon Jan 28 23:02:48 2008 @@ -24,6 +24,9 @@ axis2_bool_t derivedkeys; axis2_bool_t require_external_uri_ref; axis2_bool_t sc10_security_context_token; + axis2_char_t *issuer; + neethi_policy_t *bootstrap_policy; + axis2_bool_t is_secure_conversation_token; int ref; }; @@ -49,6 +52,9 @@ security_context_token->derivedkeys = AXIS2_FALSE; 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->issuer = NULL; + security_context_token->is_secure_conversation_token = AXIS2_FALSE; security_context_token->ref = 0; return security_context_token; @@ -69,6 +75,11 @@ return; } + if(security_context_token->bootstrap_policy) + { + neethi_policy_free(security_context_token->bootstrap_policy, env); + } + AXIS2_FREE(env->allocator, security_context_token); security_context_token = NULL; } @@ -169,6 +180,71 @@ 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) +{ + AXIS2_ENV_CHECK(env, AXIS2_FAILURE); + return security_context_token->issuer; +} + +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) +{ + AXIS2_ENV_CHECK(env, AXIS2_FAILURE); + AXIS2_PARAM_CHECK(env->error, issuer, AXIS2_FAILURE); + + security_context_token->issuer = issuer; + return AXIS2_SUCCESS; +} + +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) +{ + AXIS2_ENV_CHECK(env, AXIS2_FAILURE); + 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) +{ + AXIS2_ENV_CHECK(env, AXIS2_FAILURE); + AXIS2_PARAM_CHECK(env->error, bootstrap_policy, AXIS2_FAILURE); + + 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) +{ + AXIS2_ENV_CHECK(env, AXIS2_FAILURE); + 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) +{ + AXIS2_ENV_CHECK(env, AXIS2_FAILURE); + + security_context_token->is_secure_conversation_token = is_secure_conversation_token; return AXIS2_SUCCESS; } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]