axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shan...@apache.org
Subject svn commit: r685799 [1/2] - in /webservices/axis2/trunk/c: ides/vc/axis2c/neethi/ neethi/include/ neethi/src/ neethi/src/secpolicy/builder/ neethi/src/secpolicy/model/
Date Thu, 14 Aug 2008 08:03:34 GMT
Author: shankar
Date: Thu Aug 14 01:03:32 2008
New Revision: 685799

URL: http://svn.apache.org/viewvc?rev=685799&view=rev
Log:
WS-Security policy 1.2 support

Modified:
    webservices/axis2/trunk/c/ides/vc/axis2c/neethi/neethi.vcproj
    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_signed_encrypted_parts.h
    webservices/axis2/trunk/c/neethi/include/rp_signed_encrypted_parts_builder.h
    webservices/axis2/trunk/c/neethi/include/rp_username_token.h
    webservices/axis2/trunk/c/neethi/include/rp_username_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/issued_token_builder.c
    webservices/axis2/trunk/c/neethi/src/secpolicy/builder/rampart_config_builder.c
    webservices/axis2/trunk/c/neethi/src/secpolicy/builder/saml_token_builder.c
    webservices/axis2/trunk/c/neethi/src/secpolicy/builder/security_context_token_builder.c
    webservices/axis2/trunk/c/neethi/src/secpolicy/builder/signed_encrypted_parts_builder.c
    webservices/axis2/trunk/c/neethi/src/secpolicy/builder/username_token_builder.c
    webservices/axis2/trunk/c/neethi/src/secpolicy/builder/x509_token_builder.c
    webservices/axis2/trunk/c/neethi/src/secpolicy/model/signed_encrypted_parts.c
    webservices/axis2/trunk/c/neethi/src/secpolicy/model/ut.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=685799&r1=685798&r2=685799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/ides/vc/axis2c/neethi/neethi.vcproj (original)
+++ webservices/axis2/trunk/c/ides/vc/axis2c/neethi/neethi.vcproj Thu Aug 14 01:03:32 2008
@@ -182,11 +182,11 @@
 	<References>
 		<ProjectReference
 			ReferencedProjectIdentifier="{7C816A64-FA96-4C6C-8DB0-5256441F54BC}"
-			RelativePathToProject=".\axiom\axiom.vcproj"
+			RelativePathToProject="..\Axis2C\ides\vc\axis2c\axiom\axiom.vcproj"
 		/>
 		<ProjectReference
 			ReferencedProjectIdentifier="{3887B3E3-1A45-40E5-BC95-9C51000C86DB}"
-			RelativePathToProject=".\axutil\axutil.vcproj"
+			RelativePathToProject="..\Axis2C\ides\vc\axis2c\axutil\axutil.vcproj"
 		/>
 	</References>
 	<Files>
@@ -278,10 +278,6 @@
 						>
 					</File>
 					<File
-						RelativePath="..\..\..\..\neethi\src\secpolicy\builder\qname_matcher.c"
-						>
-					</File>
-					<File
 						RelativePath="..\..\..\..\neethi\src\secpolicy\builder\rampart_config_builder.c"
 						>
 					</File>
@@ -430,6 +426,10 @@
 						>
 					</File>
 					<File
+						RelativePath="..\..\..\..\neethi\src\secpolicy\model\token.c"
+						>
+					</File>
+					<File
 						RelativePath="..\..\..\..\neethi\src\secpolicy\model\transport_binding.c"
 						>
 					</File>
@@ -598,10 +598,6 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\..\..\neethi\include\rp_qname_matcher.h"
-				>
-			</File>
-			<File
 				RelativePath="..\..\..\..\neethi\include\rp_rampart_config.h"
 				>
 			</File>
@@ -678,6 +674,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\..\..\neethi\include\rp_token.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\..\..\neethi\include\rp_token_identifier.h"
 				>
 			</File>

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=685799&r1=685798&r2=685799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/neethi/include/rp_builders.h (original)
+++ webservices/axis2/trunk/c/neethi/include/rp_builders.h Thu Aug 14 01:03:32 2008
@@ -30,7 +30,6 @@
 #include <rp_wss10_builder.h>
 #include <rp_wss11_builder.h>
 #include <rp_trust10_builder.h>
-#include <rp_qname_matcher.h>
 #include <rp_https_token_builder.h>
 #include <rp_x509_token_builder.h>
 #include <rp_issued_token_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=685799&r1=685798&r2=685799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/neethi/include/rp_defines.h (original)
+++ webservices/axis2/trunk/c/neethi/include/rp_defines.h Thu Aug 14 01:03:32 2008
@@ -1,10 +1,10 @@
-
 /*
- * 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
+ * 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
  *
@@ -52,6 +52,7 @@
 #define RP_NAME "Name"
 #define RP_NAMESPACE "Namespace"
 #define RP_ELEMENT "Element"
+#define RP_ATTACHMENTS "Attachments"
 
 #define RP_XPATH "XPath"
 #define RP_XPATH_VERSION "XPathVersion"
@@ -155,6 +156,11 @@
 #define RP_INCLUDE_NEVER "http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never"
 #define RP_INCLUDE_ONCE "http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Once"
 #define RP_INCLUDE_ALWAYS_TO_RECIPIENT "http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient"
+#define RP_INCLUDE_NEVER_SP12 "http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Never"
+#define RP_INCLUDE_ONCE_SP12 "http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Once"
+#define RP_INCLUDE_ALWAYS_TO_RECIPIENT_SP12 "http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient"
+#define RP_INCLUDE_ALWAYS_TO_INITIATOR_SP12 "http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToInitiator"
+#define RP_INCLUDE_ALWAYS_SP12 "http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Always"
 
 #define RP_REQUEST_SEC_TOKEN_TEMPLATE "RequestSecurityTokenTemplate"
     
@@ -207,7 +213,8 @@
 #define RP_RD_MODULE "ReplayDetectionModule"
 #define RP_SCT_MODULE "SecurityContextTokenProvider"
 
-#define RP_SP_NS "http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"
+#define RP_SP_NS_11 "http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"
+#define RP_SP_NS_12 "http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"
 #define RP_SECURITY_NS "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
 #define RP_POLICY_NS "http://schemas.xmlsoap.org/ws/2004/09/policy"
 #define RP_RAMPART_NS "http://ws.apache.org/rampart/c/policy"

Modified: webservices/axis2/trunk/c/neethi/include/rp_signed_encrypted_parts.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/include/rp_signed_encrypted_parts.h?rev=685799&r1=685798&r2=685799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/neethi/include/rp_signed_encrypted_parts.h (original)
+++ webservices/axis2/trunk/c/neethi/include/rp_signed_encrypted_parts.h Thu Aug 14 01:03:32 2008
@@ -1,10 +1,11 @@
 
 /*
- * 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
+ * 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
  *
@@ -64,6 +65,17 @@
         const axutil_env_t * env,
         axis2_bool_t signedparts);
 
+    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);
+
+    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);
+
     AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
     rp_signed_encrypted_parts_get_headers(
         rp_signed_encrypted_parts_t * signed_encrypted_parts,

Modified: webservices/axis2/trunk/c/neethi/include/rp_signed_encrypted_parts_builder.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/include/rp_signed_encrypted_parts_builder.h?rev=685799&r1=685798&r2=685799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/neethi/include/rp_signed_encrypted_parts_builder.h (original)
+++ webservices/axis2/trunk/c/neethi/include/rp_signed_encrypted_parts_builder.h Thu Aug 14 01:03:32 2008
@@ -1,10 +1,10 @@
-
 /*
- * 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
+ * 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
  *
@@ -34,11 +34,20 @@
 {
 #endif
 
+    /**
+     * 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 * node,
-        axiom_element_t * element);
+        axiom_element_t * element, 
+        axis2_bool_t is_signed);
 
 #ifdef __cplusplus
 }

Modified: webservices/axis2/trunk/c/neethi/include/rp_username_token.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/include/rp_username_token.h?rev=685799&r1=685798&r2=685799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/neethi/include/rp_username_token.h (original)
+++ webservices/axis2/trunk/c/neethi/include/rp_username_token.h Thu Aug 14 01:03:32 2008
@@ -1,10 +1,11 @@
 
 /*
- * 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
+ * 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
  *
@@ -24,12 +25,20 @@
  */
 
 #include <rp_includes.h>
+#include <rp_token.h>
 
 #ifdef __cplusplus
 extern "C"
 {
 #endif
 
+    typedef enum
+    {
+        PASSWORD_PLAIN = 0,
+        PASSWORD_HASH,
+        PASSWORD_NONE /* no password will be provided in the user name token */
+    } password_type_t;
+
     typedef struct rp_username_token_t rp_username_token_t;
 
     AXIS2_EXTERN rp_username_token_t *AXIS2_CALL
@@ -53,37 +62,70 @@
         axis2_char_t * inclusion);
 
     AXIS2_EXTERN axis2_bool_t AXIS2_CALL
-    rp_username_token_get_derivedkeys(
+    rp_username_token_get_useUTprofile10(
         rp_username_token_t * username_token,
         const axutil_env_t * env);
 
     AXIS2_EXTERN axis2_status_t AXIS2_CALL
-    rp_username_token_set_derivedkeys(
+    rp_username_token_set_useUTprofile10(
         rp_username_token_t * username_token,
         const axutil_env_t * env,
-        axis2_bool_t derivedkeys);
+        axis2_bool_t useUTprofile10);
 
     AXIS2_EXTERN axis2_bool_t AXIS2_CALL
-    rp_username_token_get_useUTprofile10(
+    rp_username_token_get_useUTprofile11(
         rp_username_token_t * username_token,
         const axutil_env_t * env);
 
     AXIS2_EXTERN axis2_status_t AXIS2_CALL
-    rp_username_token_set_useUTprofile10(
+    rp_username_token_set_useUTprofile11(
         rp_username_token_t * username_token,
         const axutil_env_t * env,
-        axis2_bool_t useUTprofile10);
+        axis2_bool_t useUTprofile11);
+
+    AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+    rp_username_token_get_issuer(
+        rp_username_token_t * username_token,
+        const axutil_env_t * 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);
+
+    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);
+
+    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);
 
     AXIS2_EXTERN axis2_bool_t AXIS2_CALL
-    rp_username_token_get_useUTprofile11(
+    rp_username_token_get_is_issuer_name(
         rp_username_token_t * username_token,
         const axutil_env_t * env);
 
     AXIS2_EXTERN axis2_status_t AXIS2_CALL
-    rp_username_token_set_useUTprofile11(
+    rp_username_token_set_is_issuer_name(
         rp_username_token_t * username_token,
         const axutil_env_t * env,
-        axis2_bool_t useUTprofile11);
+        axis2_bool_t 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);
+
+    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);
 
     AXIS2_EXTERN axis2_status_t AXIS2_CALL
     rp_username_token_increment_ref(

Modified: webservices/axis2/trunk/c/neethi/include/rp_username_token_builder.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/include/rp_username_token_builder.h?rev=685799&r1=685798&r2=685799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/neethi/include/rp_username_token_builder.h (original)
+++ webservices/axis2/trunk/c/neethi/include/rp_username_token_builder.h Thu Aug 14 01:03:32 2008
@@ -1,10 +1,10 @@
-
 /*
- * 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
+ * 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
  *

Modified: webservices/axis2/trunk/c/neethi/src/assertion.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/assertion.c?rev=685799&r1=685798&r2=685799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/neethi/src/assertion.c (original)
+++ webservices/axis2/trunk/c/neethi/src/assertion.c Thu Aug 14 01:03:32 2008
@@ -89,27 +89,23 @@
     neethi_assertion_type_t type)
 {
     neethi_assertion_t *neethi_assertion = NULL;
+    neethi_assertion = (neethi_assertion_t *) AXIS2_MALLOC(
+        env->allocator, sizeof(neethi_assertion_t));
 
-    AXIS2_ENV_CHECK(env, NULL);
-
-    neethi_assertion = (neethi_assertion_t *) AXIS2_MALLOC(env->allocator,
-                                                           sizeof
-                                                           (neethi_assertion_t));
-
-    if (neethi_assertion == NULL)
+    if (!neethi_assertion)
     {
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Neethi assertion creation failed. Out of memory");
         return NULL;
     }
-    neethi_assertion->policy_components = NULL;
 
+    neethi_assertion->policy_components = NULL;
     neethi_assertion->policy_components = axutil_array_list_create(env, 0);
     if (!(neethi_assertion->policy_components))
     {
-
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
+            "Neethi assertion policy components creation failed.");
         return NULL;
     }
 
@@ -172,46 +168,37 @@
     }
     else if (type == ASSERTION_TYPE_SUPPORTING_TOKENS)
     {
-        rp_supporting_tokens_increment_ref((rp_supporting_tokens_t *) value,
-                                           env);
+        rp_supporting_tokens_increment_ref((rp_supporting_tokens_t *) value, env);
     }
     else if (type == ASSERTION_TYPE_USERNAME_TOKEN)
     {
         rp_username_token_increment_ref((rp_username_token_t *) value, env);
     }
-
     else if (type == ASSERTION_TYPE_ASSYMMETRIC_BINDING)
     {
-        rp_asymmetric_binding_increment_ref((rp_asymmetric_binding_t *) value,
-                                            env);
+        rp_asymmetric_binding_increment_ref((rp_asymmetric_binding_t *) value, env);
     }
-    
     else if (type == ASSERTION_TYPE_SYMMETRIC_BINDING)
     {
-        rp_symmetric_binding_increment_ref((rp_symmetric_binding_t *) value,
-                                            env);
+        rp_symmetric_binding_increment_ref((rp_symmetric_binding_t *) value, env);
     }
-
     else if (type == ASSERTION_TYPE_TRANSPORT_BINDING)
     {
-        rp_transport_binding_increment_ref((rp_transport_binding_t *) value,
-                                            env);
+        rp_transport_binding_increment_ref((rp_transport_binding_t *) value, env);
     }
-    
     else if (type == ASSERTION_TYPE_SIGNED_ENCRYPTED_PARTS)
     {
-        rp_signed_encrypted_parts_increment_ref((rp_signed_encrypted_parts_t *)
-                                                value, env);
+        rp_signed_encrypted_parts_increment_ref((rp_signed_encrypted_parts_t *)value, env);
     }
     else if (type == ASSERTION_TYPE_RAMPART_CONFIG)
     {
         rp_rampart_config_increment_ref((rp_rampart_config_t *) value, env);
     }
-    if (type == ASSERTION_TYPE_ISSUED_TOKEN)
+    else if (type == ASSERTION_TYPE_ISSUED_TOKEN)
     {
         rp_issued_token_increment_ref((rp_issued_token_t *) value, env);
     }
-    if (type == ASSERTION_TYPE_SAML_TOKEN)
+    else if (type == ASSERTION_TYPE_SAML_TOKEN)
     {
         rp_saml_token_increment_ref((rp_saml_token_t *) value, env);
     }
@@ -224,7 +211,6 @@
     neethi_assertion->free_func = free_func;
 
     return neethi_assertion;
-
 }
 
 AXIS2_EXTERN void AXIS2_CALL
@@ -296,10 +282,6 @@
     {
         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;
 
     return AXIS2_SUCCESS;

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=685799&r1=685798&r2=685799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/neethi/src/assertion_builder.c (original)
+++ webservices/axis2/trunk/c/neethi/src/assertion_builder.c Thu Aug 14 01:03:32 2008
@@ -24,687 +24,367 @@
     axiom_node_t *node,
     axiom_element_t *element)
 {
-
     axis2_char_t *localname = NULL;
+    axis2_char_t *ns = NULL;
+    axutil_qname_t *node_qname = NULL;
 
     localname = axiom_element_get_localname(element, env);
-    if (!localname)
+    if(!localname)
     {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] Cannot get localname from element.");
         return NULL;
     }
 
-    if (axutil_strcmp(localname, RP_TRANSPORT_BINDING) == 0)
+    node_qname = axiom_element_get_qname(element, env, node);
+    if(!node_qname)
     {
-        if (rp_match_secpolicy_qname(env, RP_TRANSPORT_BINDING, node, element))
-        {
-            return rp_transport_binding_builder_build(env, node, element);
-        }
-        else
-            return NULL;
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
+            "[neethi] Cannot get qname from element %s.", localname);
+        return NULL;
     }
 
-    else if (axutil_strcmp(localname, RP_ASYMMETRIC_BINDING) == 0)
+    ns = axutil_qname_get_uri(node_qname, env);
+    if(!ns)
     {
-        if (rp_match_secpolicy_qname(env, RP_ASYMMETRIC_BINDING, node, element))
-        {
-            return rp_asymmetric_binding_builder_build(env, node, element);
-        }
-        else
-            return NULL;
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
+            "[neethi] Cannot get namespace from element %s.", localname);
+        return NULL;
     }
 
-    else if (axutil_strcmp(localname, RP_SYMMETRIC_BINDING) == 0)
+    if(!(axutil_strcmp(ns, RP_SP_NS_11) && axutil_strcmp(ns, RP_SP_NS_12)))
     {
-        if (rp_match_secpolicy_qname(env, RP_SYMMETRIC_BINDING, node, element))
+        /* if namespace is WS-SecurityPolicy Namespace */
+        if(!axutil_strcmp(localname, RP_TRANSPORT_BINDING))
+        {
+            return rp_transport_binding_builder_build(env, node, element);
+        }
+        else if(!axutil_strcmp(localname, RP_ASYMMETRIC_BINDING))
+        {
+            return rp_asymmetric_binding_builder_build(env, node, element);
+        }
+        else if(!axutil_strcmp(localname, RP_SYMMETRIC_BINDING))
         {
             return rp_symmetric_binding_builder_build(env, node, element);
         }
-        else
-            return NULL;
-    }
-
-    else if (axutil_strcmp(localname, RP_TRANSPORT_TOKEN) == 0)
-    {
-        if (rp_match_secpolicy_qname(env, RP_TRANSPORT_TOKEN, node, element))
+        else if(!axutil_strcmp(localname, RP_TRANSPORT_TOKEN))
         {
             return rp_transport_token_builder_build(env, node, element);
         }
-        else
-            return NULL;
-    }
-
-    else if (axutil_strcmp(localname, RP_RECIPIENT_TOKEN) == 0)
-    {
-        if (rp_match_secpolicy_qname(env, RP_RECIPIENT_TOKEN, node, element))
+        else if(!axutil_strcmp(localname, RP_RECIPIENT_TOKEN))
         {
             return rp_recipient_token_builder_build(env, node, element);
         }
-        else
-            return NULL;
-    }
-    
-    else if (axutil_strcmp(localname, RP_INITIATOR_TOKEN) == 0)
-    {
-        if (rp_match_secpolicy_qname(env, RP_INITIATOR_TOKEN, node, element))
+        else if(!axutil_strcmp(localname, RP_INITIATOR_TOKEN))
         {
             return rp_initiator_token_builder_build(env, node, element);
         }
-        else
-            return NULL;
-    }
-
-    else if (axutil_strcmp(localname, RP_PROTECTION_TOKEN) == 0)
-    {
-        if (rp_match_secpolicy_qname(env, RP_PROTECTION_TOKEN, node, element))
+        else if(!axutil_strcmp(localname, RP_PROTECTION_TOKEN))
         {
             return rp_protection_token_builder_build(env, node, element);
         }
-        else
-            return NULL;
-    }
-
-    else if (axutil_strcmp(localname, RP_ENCRYPTION_TOKEN) == 0)
-    {
-        if (rp_match_secpolicy_qname(env, RP_ENCRYPTION_TOKEN, node, element))
+        else if(!axutil_strcmp(localname, RP_ENCRYPTION_TOKEN))
         {
             return rp_encryption_token_builder_build(env, node, element);
         }
-        else
-            return NULL;
-    }
 
-    else if (axutil_strcmp(localname, RP_SIGNATURE_TOKEN) == 0)
-    {
-        if (rp_match_secpolicy_qname(env, RP_SIGNATURE_TOKEN, node, element))
+        else if(!axutil_strcmp(localname, RP_SIGNATURE_TOKEN))
         {
             return rp_signature_token_builder_build(env, node, element);
         }
-        else
-            return NULL;
-    }
-
-    else if (axutil_strcmp(localname, RP_X509_TOKEN) == 0)
-    {
-        if (rp_match_secpolicy_qname(env, RP_X509_TOKEN, node, element))
+        else if(!axutil_strcmp(localname, RP_X509_TOKEN))
         {
             return rp_x509_token_builder_build(env, node, element);
         }
-        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))
+        else if(!axutil_strcmp(localname, RP_SECURITY_CONTEXT_TOKEN))
         {
             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))
+        else if(!axutil_strcmp(localname, RP_SECURE_CONVERSATION_TOKEN))
         {
             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
-            (env, RP_ENCRYPT_BEFORE_SIGNING, node, element))
+        else if(!axutil_strcmp(localname, RP_ENCRYPT_BEFORE_SIGNING))
         {
             neethi_assertion_t *assertion = NULL;
             assertion = neethi_assertion_create(env);
-            neethi_assertion_set_value(assertion, env, NULL,
-                                       ASSERTION_TYPE_ENCRYPT_BEFORE_SIGNING);
+            neethi_assertion_set_value(assertion, env, NULL, ASSERTION_TYPE_ENCRYPT_BEFORE_SIGNING);
             return assertion;
         }
-        else
-            return NULL;
-    }
-    else if (axutil_strcmp(localname, RP_SIGN_BEFORE_ENCRYPTING) == 0)
-    {
-        if (rp_match_secpolicy_qname
-            (env, RP_SIGN_BEFORE_ENCRYPTING, node, element))
+        else if(!axutil_strcmp(localname, RP_SIGN_BEFORE_ENCRYPTING))
         {
             neethi_assertion_t *assertion = NULL;
             assertion = neethi_assertion_create(env);
-            neethi_assertion_set_value(assertion, env, NULL,
-                                       ASSERTION_TYPE_SIGN_BEFORE_ENCRYPTING);
+            neethi_assertion_set_value(assertion, env, NULL, ASSERTION_TYPE_SIGN_BEFORE_ENCRYPTING);
             return assertion;
         }
-        else
-            return NULL;
-    }
-    else if (axutil_strcmp(localname, RP_ENCRYPT_SIGNATURE) == 0)
-    {
-        if (rp_match_secpolicy_qname(env, RP_ENCRYPT_SIGNATURE, node, element))
+        else if(!axutil_strcmp(localname, RP_ENCRYPT_SIGNATURE))
         {
             neethi_assertion_t *assertion = NULL;
             assertion = neethi_assertion_create(env);
-            neethi_assertion_set_value(assertion, env, NULL,
-                                       ASSERTION_TYPE_ENCRYPT_SIGNATURE);
+            neethi_assertion_set_value(assertion, env, NULL, ASSERTION_TYPE_ENCRYPT_SIGNATURE);
             return assertion;
         }
-        else
-            return NULL;
-    }
-    else if (axutil_strcmp(localname, RP_PROTECT_TOKENS) == 0)
-    {
-        if (rp_match_secpolicy_qname(env, RP_PROTECT_TOKENS, node, element))
+        else if(!axutil_strcmp(localname, RP_PROTECT_TOKENS))
         {
             neethi_assertion_t *assertion = NULL;
             assertion = neethi_assertion_create(env);
-            neethi_assertion_set_value(assertion, env, NULL,
-                                       ASSERTION_TYPE_PROTECT_TOKENS);
+            neethi_assertion_set_value(assertion, env, NULL, ASSERTION_TYPE_PROTECT_TOKENS);
             return assertion;
         }
-        else
-            return NULL;
-    }
-    else if (axutil_strcmp(localname, RP_ONLY_SIGN_ENTIRE_HEADERS_AND_BODY) ==
-             0)
-    {
-        if (rp_match_secpolicy_qname
-            (env, RP_ONLY_SIGN_ENTIRE_HEADERS_AND_BODY, node, element))
+        else if(!axutil_strcmp(localname, RP_ONLY_SIGN_ENTIRE_HEADERS_AND_BODY))
         {
             neethi_assertion_t *assertion = NULL;
             assertion = neethi_assertion_create(env);
-            neethi_assertion_set_value(assertion, env, NULL,
-                                       ASSERTION_TYPE_ONLY_SIGN_ENTIRE_HEADERS_AND_BODY);
+            neethi_assertion_set_value(assertion, env, NULL, 
+                ASSERTION_TYPE_ONLY_SIGN_ENTIRE_HEADERS_AND_BODY);
             return assertion;
         }
-        else
-            return NULL;
-    }
-    else if (axutil_strcmp(localname, RP_REQUIRE_KEY_IDENTIFIRE_REFERENCE) == 0)
-    {
-        if (rp_match_secpolicy_qname
-            (env, RP_REQUIRE_KEY_IDENTIFIRE_REFERENCE, node, element))
+        else if(!axutil_strcmp(localname, RP_REQUIRE_KEY_IDENTIFIRE_REFERENCE))
         {
             neethi_assertion_t *assertion = NULL;
             assertion = neethi_assertion_create(env);
             neethi_assertion_set_value(assertion, env, NULL,
-                                       ASSERTION_TYPE_REQUIRE_KEY_IDENTIFIRE_REFERENCE);
+                ASSERTION_TYPE_REQUIRE_KEY_IDENTIFIRE_REFERENCE);
             return assertion;
         }
-        else
-            return NULL;
-    }
-    else if (axutil_strcmp(localname, RP_REQUIRE_ISSUER_SERIAL_REFERENCE) == 0)
-    {
-        if (rp_match_secpolicy_qname
-            (env, RP_REQUIRE_ISSUER_SERIAL_REFERENCE, node, element))
+        else if(!axutil_strcmp(localname, RP_REQUIRE_ISSUER_SERIAL_REFERENCE))
         {
             neethi_assertion_t *assertion = NULL;
             assertion = neethi_assertion_create(env);
             neethi_assertion_set_value(assertion, env, NULL,
-                                       ASSERTION_TYPE_REQUIRE_ISSUER_SERIAL_REFERENCE);
+                ASSERTION_TYPE_REQUIRE_ISSUER_SERIAL_REFERENCE);
             return assertion;
         }
-        else
-            return NULL;
-    }
-    else if (axutil_strcmp(localname, RP_REQUIRE_EMBEDDED_TOKEN_REFERENCE) == 0)
-    {
-        if (rp_match_secpolicy_qname
-            (env, RP_REQUIRE_EMBEDDED_TOKEN_REFERENCE, node, element))
+        else if(!axutil_strcmp(localname, RP_REQUIRE_EMBEDDED_TOKEN_REFERENCE))
         {
             neethi_assertion_t *assertion = NULL;
             assertion = neethi_assertion_create(env);
             neethi_assertion_set_value(assertion, env, NULL,
-                                       ASSERTION_TYPE_REQUIRE_EMBEDDED_TOKEN_REFERENCE);
+                ASSERTION_TYPE_REQUIRE_EMBEDDED_TOKEN_REFERENCE);
             return assertion;
         }
-        else
-            return NULL;
-    }
-    else if (axutil_strcmp(localname, RP_REQUIRE_THUMBPRINT_REFERENCE) == 0)
-    {
-        if (rp_match_secpolicy_qname
-            (env, RP_REQUIRE_THUMBPRINT_REFERENCE, node, element))
+        else if(!axutil_strcmp(localname, RP_REQUIRE_THUMBPRINT_REFERENCE))
         {
             neethi_assertion_t *assertion = NULL;
             assertion = neethi_assertion_create(env);
-            neethi_assertion_set_value(assertion, env, NULL,
-                                       ASSERTION_TYPE_REQUIRE_THUMBPRINT_REFERENCE);
+            neethi_assertion_set_value(assertion, env, NULL, 
+                ASSERTION_TYPE_REQUIRE_THUMBPRINT_REFERENCE);
             return assertion;
         }
-        else
-            return NULL;
-    }
-    else if (axutil_strcmp(localname, RP_WSS_X509_V1_TOKEN_10) == 0)
-    {
-        if (rp_match_secpolicy_qname
-            (env, RP_WSS_X509_V1_TOKEN_10, node, element))
+        else if(!axutil_strcmp(localname, RP_WSS_X509_V1_TOKEN_10))
         {
             neethi_assertion_t *assertion = NULL;
             assertion = neethi_assertion_create(env);
-            neethi_assertion_set_value(assertion, env, NULL,
-                                       ASSERTION_TYPE_WSS_X509_V1_TOKEN_10);
+            neethi_assertion_set_value(assertion, env, NULL, ASSERTION_TYPE_WSS_X509_V1_TOKEN_10);
             return assertion;
         }
-        else
-            return NULL;
-    }
-    else if (axutil_strcmp(localname, RP_WSS_X509_V3_TOKEN_10) == 0)
-    {
-        if (rp_match_secpolicy_qname
-            (env, RP_WSS_X509_V3_TOKEN_10, node, element))
+        else if(!axutil_strcmp(localname, RP_WSS_X509_V3_TOKEN_10))
         {
             neethi_assertion_t *assertion = NULL;
             assertion = neethi_assertion_create(env);
-            neethi_assertion_set_value(assertion, env, NULL,
-                                       ASSERTION_TYPE_WSS_X509_V3_TOKEN_10);
+            neethi_assertion_set_value(assertion, env, NULL, ASSERTION_TYPE_WSS_X509_V3_TOKEN_10);
             return assertion;
         }
-        else
-            return NULL;
-    }
-    else if (axutil_strcmp(localname, RP_ALGORITHM_SUITE) == 0)
-    {
-        if (rp_match_secpolicy_qname(env, RP_ALGORITHM_SUITE, node, element))
+        else if(!axutil_strcmp(localname, RP_ALGORITHM_SUITE))
         {
             return rp_algorithmsuite_builder_build(env, node, element);
         }
-        else
-            return NULL;
-    }
-    else if (axutil_strcmp(localname, RP_LAYOUT) == 0)
-    {
-        if (rp_match_secpolicy_qname(env, RP_LAYOUT, node, element))
+        else if(!axutil_strcmp(localname, RP_LAYOUT))
         {
             return rp_layout_builder_build(env, node, element);
         }
-        else
-            return NULL;
-    }
-    else if (axutil_strcmp(localname, RP_USERNAME_TOKEN) == 0)
-    {
-        if (rp_match_secpolicy_qname(env, RP_USERNAME_TOKEN, node, element))
+        else if(!axutil_strcmp(localname, RP_USERNAME_TOKEN))
         {
             return rp_username_token_builder_build(env, node, element);
         }
-        else
-            return NULL;
-    }
-    else if (axutil_strcmp(localname, RP_SIGNED_SUPPORTING_TOKENS) == 0)
-    {
-        if (rp_match_secpolicy_qname
-            (env, RP_SIGNED_SUPPORTING_TOKENS, node, element))
+        else if(!axutil_strcmp(localname, RP_SIGNED_SUPPORTING_TOKENS))
         {
             return rp_supporting_tokens_builder_build(env, node, element);
         }
-        else
-            return NULL;
-    }
-    else if (axutil_strcmp(localname, RP_SUPPORTING_TOKENS) == 0)
-    {
-        if (rp_match_secpolicy_qname
-            (env, RP_SUPPORTING_TOKENS, node, element))
+        else if(!axutil_strcmp(localname, RP_SUPPORTING_TOKENS))
         {
             return rp_supporting_tokens_builder_build(env, node, element);
         }
-        else
-            return NULL;
-    }
-    else if (axutil_strcmp(localname, RP_ENDORSING_SUPPORTING_TOKENS) == 0)
-    {
-        if (rp_match_secpolicy_qname
-            (env, RP_ENDORSING_SUPPORTING_TOKENS, node, element))
+        else if(!axutil_strcmp(localname, RP_ENDORSING_SUPPORTING_TOKENS))
         {
             return rp_supporting_tokens_builder_build(env, node, element);
         }
-        else
-            return NULL;
-    }
-    else if (axutil_strcmp(localname, RP_SIGNED_ENDORSING_SUPPORTING_TOKENS) ==
-             0)
-    {
-        if (rp_match_secpolicy_qname
-            (env, RP_SIGNED_ENDORSING_SUPPORTING_TOKENS, node, element))
+        else if(!axutil_strcmp(localname, RP_SIGNED_ENDORSING_SUPPORTING_TOKENS))
         {
             return rp_supporting_tokens_builder_build(env, node, element);
         }
-        else
-            return NULL;
-    }
-    else if (axutil_strcmp(localname, RP_WSS10) == 0)
-    {
-        if (rp_match_secpolicy_qname(env, RP_WSS10, node, element))
+        else if(!axutil_strcmp(localname, RP_WSS10))
         {
             return rp_wss10_builder_build(env, node, element);
         }
-        else
-            return NULL;
-    }
-    else if (axutil_strcmp(localname, RP_WSS11) == 0)
-    {
-        if (rp_match_secpolicy_qname(env, RP_WSS11, node, element))
+        else if(!axutil_strcmp(localname, RP_WSS11))
         {
             return rp_wss11_builder_build(env, node, element);
         }
-        else
-            return NULL;
-    }
-    else if (axutil_strcmp(localname, RP_TRUST10) == 0)
-    {
-        if (rp_match_secpolicy_qname(env, RP_TRUST10, node, element))
+        else if(!axutil_strcmp(localname, RP_TRUST10))
         {
             return rp_trust10_builder_build(env, node, element);
         }
-        else
-            return NULL;
-    }
-    
-    else if (axutil_strcmp(localname, RP_INCLUDE_TIMESTAMP) == 0)
-    {
-        if (rp_match_secpolicy_qname(env, RP_INCLUDE_TIMESTAMP, node, element))
+        else if(!axutil_strcmp(localname, RP_INCLUDE_TIMESTAMP))
         {
             neethi_assertion_t *assertion = NULL;
             assertion = neethi_assertion_create(env);
-            neethi_assertion_set_value(assertion, env, NULL,
-                                       ASSERTION_TYPE_INCLUDE_TIMESTAMP);
+            neethi_assertion_set_value(assertion, env, NULL, ASSERTION_TYPE_INCLUDE_TIMESTAMP);
             return assertion;
         }
-        else
-            return NULL;
-    }
-    else if (axutil_strcmp(localname, RP_HTTPS_TOKEN) == 0)
-    {
-        if (rp_match_secpolicy_qname(env, RP_HTTPS_TOKEN, node, element))
+        else if(!axutil_strcmp(localname, RP_HTTPS_TOKEN))
         {
             return rp_https_token_builder_build(env, node, element);
         }
-        else
-            return NULL;
-    }
-    else if (axutil_strcmp(localname, RP_WSS_USERNAME_TOKEN_10) == 0)
-    {
-        if (rp_match_secpolicy_qname
-            (env, RP_WSS_USERNAME_TOKEN_10, node, element))
+        else if(!axutil_strcmp(localname, RP_WSS_USERNAME_TOKEN_10))
         {
             neethi_assertion_t *assertion = NULL;
             assertion = neethi_assertion_create(env);
-            neethi_assertion_set_value(assertion, env, NULL,
-                                       ASSERTION_TYPE_WSS_USERNAME_TOKEN_10);
+            neethi_assertion_set_value(assertion, env, NULL, ASSERTION_TYPE_WSS_USERNAME_TOKEN_10);
             return assertion;
         }
-        else
-            return NULL;
-    }
-    else if (axutil_strcmp(localname, RP_WSS_USERNAME_TOKEN_11) == 0)
-    {
-        if (rp_match_secpolicy_qname
-            (env, RP_WSS_USERNAME_TOKEN_11, node, element))
+        else if(!axutil_strcmp(localname, RP_WSS_USERNAME_TOKEN_11))
         {
             neethi_assertion_t *assertion = NULL;
             assertion = neethi_assertion_create(env);
-            neethi_assertion_set_value(assertion, env, NULL,
-                                       ASSERTION_TYPE_WSS_USERNAME_TOKEN_11);
+            neethi_assertion_set_value(assertion, env, NULL, ASSERTION_TYPE_WSS_USERNAME_TOKEN_11);
             return assertion;
         }
-        else
-            return NULL;
-    }
-    else if (axutil_strcmp(localname, RP_MUST_SUPPORT_REF_KEY_IDENTIFIER) == 0)
-    {
-        if (rp_match_secpolicy_qname
-            (env, RP_MUST_SUPPORT_REF_KEY_IDENTIFIER, node, element))
+        else if(!axutil_strcmp(localname, RP_MUST_SUPPORT_REF_KEY_IDENTIFIER))
         {
             neethi_assertion_t *assertion = NULL;
             assertion = neethi_assertion_create(env);
-            neethi_assertion_set_value(assertion, env, NULL,
-                                       ASSERTION_TYPE_MUST_SUPPORT_REF_KEY_IDENTIFIER);
+            neethi_assertion_set_value(assertion, env, NULL, 
+                ASSERTION_TYPE_MUST_SUPPORT_REF_KEY_IDENTIFIER);
             return assertion;
         }
-        else
-            return NULL;
-    }
-    else if (axutil_strcmp(localname, RP_MUST_SUPPORT_REF_ISSUER_SERIAL) == 0)
-    {
-        if (rp_match_secpolicy_qname
-            (env, RP_MUST_SUPPORT_REF_ISSUER_SERIAL, node, element))
+        else if(!axutil_strcmp(localname, RP_MUST_SUPPORT_REF_ISSUER_SERIAL))
         {
             neethi_assertion_t *assertion = NULL;
             assertion = neethi_assertion_create(env);
-            neethi_assertion_set_value(assertion, env, NULL,
-                                       ASSERTION_TYPE_MUST_SUPPORT_REF_ISSUER_SERIAL);
+            neethi_assertion_set_value(assertion, env, NULL, 
+                ASSERTION_TYPE_MUST_SUPPORT_REF_ISSUER_SERIAL);
             return assertion;
         }
-        else
-            return NULL;
-    }
-    else if (axutil_strcmp(localname, RP_MUST_SUPPORT_REF_EXTERNAL_URI) == 0)
-    {
-        if (rp_match_secpolicy_qname
-            (env, RP_MUST_SUPPORT_REF_EXTERNAL_URI, node, element))
+        else if(!axutil_strcmp(localname, RP_MUST_SUPPORT_REF_EXTERNAL_URI))
         {
             neethi_assertion_t *assertion = NULL;
             assertion = neethi_assertion_create(env);
             neethi_assertion_set_value(assertion, env, NULL,
-                                       ASSERTION_TYPE_MUST_SUPPORT_REF_EXTERNAL_URI);
+                ASSERTION_TYPE_MUST_SUPPORT_REF_EXTERNAL_URI);
             return assertion;
         }
-        else
-            return NULL;
-    }
-    else if (axutil_strcmp(localname, RP_MUST_SUPPORT_REF_EMBEDDED_TOKEN) == 0)
-    {
-        if (rp_match_secpolicy_qname
-            (env, RP_MUST_SUPPORT_REF_EMBEDDED_TOKEN, node, element))
+        else if(!axutil_strcmp(localname, RP_MUST_SUPPORT_REF_EMBEDDED_TOKEN))
         {
             neethi_assertion_t *assertion = NULL;
             assertion = neethi_assertion_create(env);
-            neethi_assertion_set_value(assertion, env, NULL,
-                                       ASSERTION_TYPE_MUST_SUPPORT_REF_EMBEDDED_TOKEN);
+            neethi_assertion_set_value(assertion, env, NULL, 
+                ASSERTION_TYPE_MUST_SUPPORT_REF_EMBEDDED_TOKEN);
             return assertion;
         }
-        else
-            return NULL;
-    }
-    else if (axutil_strcmp(localname, RP_SIGNED_PARTS) == 0)
-    {
-        if (rp_match_secpolicy_qname(env, RP_SIGNED_PARTS, node, element))
+        else if(!axutil_strcmp(localname, RP_SIGNED_PARTS))
         {
-            return rp_signed_encrypted_parts_builder_build(env, node, element);
+            return rp_signed_encrypted_parts_builder_build(env, node, element, AXIS2_TRUE);
         }
-        else
-            return NULL;
-    }
-    else if (axutil_strcmp(localname, RP_ENCRYPTED_PARTS) == 0)
-    {
-        if (rp_match_secpolicy_qname(env, RP_ENCRYPTED_PARTS, node, element))
+        else if(!axutil_strcmp(localname, RP_ENCRYPTED_PARTS))
         {
-            return rp_signed_encrypted_parts_builder_build(env, node, element);
+            return rp_signed_encrypted_parts_builder_build(env, node, element, AXIS2_FALSE);
         }
-        else
-            return NULL;
-    }
-    else if (axutil_strcmp(localname, RP_RAMPART_CONFIG) == 0)
-    {
-        if (rp_match_rampart_config_qname
-            (env, RP_RAMPART_CONFIG, node, element))
-        {
-            return rp_rampart_config_builder_build(env, node, element);
-        }
-        else
-            return NULL;
-    }
-    else if(axutil_strcmp(localname, RP_BOOTSTRAP_POLICY) == 0)
-    {
-        if (rp_match_secpolicy_qname(env, RP_BOOTSTRAP_POLICY, node, element))
+        else if(!axutil_strcmp(localname, RP_BOOTSTRAP_POLICY))
         {
             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
-            (env, RP_MUST_SUPPORT_REF_THUMBPRINT, node, element))
+        else if(!axutil_strcmp(localname, RP_MUST_SUPPORT_REF_THUMBPRINT))
         {
             neethi_assertion_t *assertion = NULL;
             assertion = neethi_assertion_create(env);
-            neethi_assertion_set_value(assertion, env, NULL,
-                                       ASSERTION_TYPE_MUST_SUPPORT_REF_THUMBPRINT);
+            neethi_assertion_set_value(assertion, env, NULL, 
+                ASSERTION_TYPE_MUST_SUPPORT_REF_THUMBPRINT);
             return assertion;
-        }
-        else
-            return NULL;
-    }    
-    else if (axutil_strcmp(localname, RP_MUST_SUPPORT_REF_ENCRYPTED_KEY) == 0)
-    {
-        if (rp_match_secpolicy_qname
-            (env, RP_MUST_SUPPORT_REF_ENCRYPTED_KEY, node, element))
+        }    
+        else if(!axutil_strcmp(localname, RP_MUST_SUPPORT_REF_ENCRYPTED_KEY))
         {
             neethi_assertion_t *assertion = NULL;
             assertion = neethi_assertion_create(env);
             neethi_assertion_set_value(assertion, env, NULL,
-                                       ASSERTION_TYPE_MUST_SUPPORT_REF_ENCRYPTED_KEY);
+                ASSERTION_TYPE_MUST_SUPPORT_REF_ENCRYPTED_KEY);
             return assertion;
         }
-        else
-            return NULL;
-    }
-    else if (axutil_strcmp(localname, RP_REQUIRE_SIGNATURE_CONFIRMATION) == 0)
-    {
-        if (rp_match_secpolicy_qname
-            (env, RP_REQUIRE_SIGNATURE_CONFIRMATION, node, element))
+        else if(!axutil_strcmp(localname, RP_REQUIRE_SIGNATURE_CONFIRMATION))
         {
             neethi_assertion_t *assertion = NULL;
             assertion = neethi_assertion_create(env);
             neethi_assertion_set_value(assertion, env, NULL,
-                                      ASSERTION_TYPE_REQUIRE_SIGNATURE_CONFIRMATION);
+                ASSERTION_TYPE_REQUIRE_SIGNATURE_CONFIRMATION);
             return assertion;
         }
-        else
-            return NULL;
-    }
 
-    else if (axutil_strcmp(localname, RP_MUST_SUPPORT_CLIENT_CHALLENGE) == 0)
-    {
-        if (rp_match_secpolicy_qname
-            (env, RP_MUST_SUPPORT_CLIENT_CHALLENGE, node, element))
+        else if(!axutil_strcmp(localname, RP_MUST_SUPPORT_CLIENT_CHALLENGE))
         {
             neethi_assertion_t *assertion = NULL;
             assertion = neethi_assertion_create(env);
             neethi_assertion_set_value(assertion, env, NULL,
-                                      ASSERTION_TYPE_MUST_SUPPORT_CLIENT_CHALLENGE);
+                ASSERTION_TYPE_MUST_SUPPORT_CLIENT_CHALLENGE);
             return assertion;
         }
-        else
-            return NULL;
-    }
 
-    else if (axutil_strcmp(localname, RP_MUST_SUPPORT_SERVER_CHALLENGE) == 0)
-    {
-        if (rp_match_secpolicy_qname
-            (env, RP_MUST_SUPPORT_SERVER_CHALLENGE, node, element))
+        else if(!axutil_strcmp(localname, RP_MUST_SUPPORT_SERVER_CHALLENGE))
         {
             neethi_assertion_t *assertion = NULL;
             assertion = neethi_assertion_create(env);
             neethi_assertion_set_value(assertion, env, NULL,
-                                      ASSERTION_TYPE_MUST_SUPPORT_SERVER_CHALLENGE);
+                ASSERTION_TYPE_MUST_SUPPORT_SERVER_CHALLENGE);
             return assertion;
-        }
-        else
-            return NULL;
-    }        
+        }        
 
-    else if (axutil_strcmp(localname, RP_REQUIRE_CLIENT_ENTROPY) == 0)
-    {
-        if (rp_match_secpolicy_qname
-            (env, RP_REQUIRE_CLIENT_ENTROPY, node, element))
+        else if(!axutil_strcmp(localname, RP_REQUIRE_CLIENT_ENTROPY))
         {
             neethi_assertion_t *assertion = NULL;
             assertion = neethi_assertion_create(env);
-            neethi_assertion_set_value(assertion, env, NULL,
-                                      ASSERTION_TYPE_REQUIRE_CLIENT_ENTROPY);
+            neethi_assertion_set_value(assertion, env, NULL, ASSERTION_TYPE_REQUIRE_CLIENT_ENTROPY);
             return assertion;
         }
-        else
-            return NULL;
-    }
 
-    else if (axutil_strcmp(localname, RP_REQUIRE_SERVER_ENTROPHY) == 0)
-    {
-        if (rp_match_secpolicy_qname
-            (env, RP_REQUIRE_SERVER_ENTROPHY, node, element))
+        else if(!axutil_strcmp(localname, RP_REQUIRE_SERVER_ENTROPHY))
         {
             neethi_assertion_t *assertion = NULL;
             assertion = neethi_assertion_create(env);
-            neethi_assertion_set_value(assertion, env, NULL,
-                                      ASSERTION_TYPE_REQUIRE_SERVER_ENTROPHY);
+            neethi_assertion_set_value(assertion, env, NULL, ASSERTION_TYPE_REQUIRE_SERVER_ENTROPHY);
             return assertion;
         }
-        else
-            return NULL;
-    }
 
-    else if (axutil_strcmp(localname, RP_MUST_SUPPORT_ISSUED_TOKENS) == 0)
-    {
-        if (rp_match_secpolicy_qname
-            (env, RP_MUST_SUPPORT_ISSUED_TOKENS, node, element))
+        else if(!axutil_strcmp(localname, RP_MUST_SUPPORT_ISSUED_TOKENS))
         {
             neethi_assertion_t *assertion = NULL;
             assertion = neethi_assertion_create(env);
-            neethi_assertion_set_value(assertion, env, NULL,
-                                      ASSERTION_TYPE_MUST_SUPPORT_ISSUED_TOKENS);
+            neethi_assertion_set_value(assertion, env, NULL, 
+                ASSERTION_TYPE_MUST_SUPPORT_ISSUED_TOKENS);
             return assertion;
         }
-        else
-            return NULL;
-    }
 
-    else if (axutil_strcmp(localname, RP_REQUIRE_DERIVED_KEYS) == 0)
-    {
-        if (rp_match_secpolicy_qname
-            (env, RP_REQUIRE_DERIVED_KEYS, node, element))
+        else if(!axutil_strcmp(localname, RP_REQUIRE_DERIVED_KEYS))
         {
             neethi_assertion_t *assertion = NULL;
             assertion = neethi_assertion_create(env);
-            neethi_assertion_set_value(assertion, env, NULL,
-                                       ASSERTION_TYPE_REQUIRE_DERIVED_KEYS);
+            neethi_assertion_set_value(assertion, env, NULL, ASSERTION_TYPE_REQUIRE_DERIVED_KEYS);
             return assertion;
         }
-        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))
+        else if(!axutil_strcmp(localname, RP_REQUIRE_EXTERNAL_URI_REFERENCE))
         {
             neethi_assertion_t *assertion = NULL;
             assertion = neethi_assertion_create(env);
-            neethi_assertion_set_value(assertion, env, NULL,
-                                       ASSERTION_TYPE_REQUIRE_EXTERNAL_URI);
+            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))
+        else if(!axutil_strcmp(localname, RP_SC10_SECURITY_CONTEXT_TOKEN))
         {
             neethi_assertion_t *assertion = NULL;
             assertion = neethi_assertion_create(env);
-            neethi_assertion_set_value(assertion, env, NULL,
-                                       ASSERTION_TYPE_SC10_SECURITY_CONTEXT_TOKEN);
+            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))
+        else if(!axutil_strcmp(localname, RP_ISSUER))
         {
             neethi_assertion_t *assertion = NULL;
             axis2_char_t *issuer = NULL;
@@ -714,134 +394,78 @@
             neethi_assertion_set_value(assertion, env, issuer, ASSERTION_TYPE_ISSUER);
             return assertion;
         }
-        else
-            return NULL;
-    }
-    else if (axutil_strcmp(localname, RP_REQUIRE_EXTERNAL_REFERENCE) == 0)
-    {
-        if (rp_match_secpolicy_qname
-            (env, RP_REQUIRE_EXTERNAL_REFERENCE, node, element))
+        else if(!axutil_strcmp(localname, RP_REQUIRE_EXTERNAL_REFERENCE))
         {
             neethi_assertion_t *assertion = NULL;
             assertion = neethi_assertion_create(env);
-            neethi_assertion_set_value(assertion, env, NULL,
-                                       ASSERTION_TYPE_REQUIRE_EXTERNAL_REFERENCE);
+            neethi_assertion_set_value(assertion, env, NULL, 
+                ASSERTION_TYPE_REQUIRE_EXTERNAL_REFERENCE);
             return assertion;
         }
-        else
-            return NULL;
-    }
-    else if (axutil_strcmp(localname, RP_REQUIRE_INTERNAL_REFERENCE) == 0)
-    {
-        if (rp_match_secpolicy_qname
-            (env, RP_REQUIRE_INTERNAL_REFERENCE, node, element))
+        else if(!axutil_strcmp(localname, RP_REQUIRE_INTERNAL_REFERENCE))
         {
             neethi_assertion_t *assertion = NULL;
             assertion = neethi_assertion_create(env);
             neethi_assertion_set_value(assertion, env, NULL,
-                                       ASSERTION_TYPE_REQUIRE_INTERNAL_REFERENCE);
+                ASSERTION_TYPE_REQUIRE_INTERNAL_REFERENCE);
             return assertion;
         }
-        else
-            return NULL;
-    }
-    else if (axutil_strcmp(localname, RP_ISSUED_TOKEN) == 0)
-    {
-        if (rp_match_secpolicy_qname(env, RP_ISSUED_TOKEN, node, element))
+        else if(!axutil_strcmp(localname, RP_ISSUED_TOKEN))
         {
             return rp_issued_token_builder_build(env, node, element);
         }
-        else
-            return NULL;
-    }
-    else if (axutil_strcmp(localname, RP_SAML_TOKEN) == 0)
-    {
-        if (rp_match_secpolicy_qname(env, RP_SAML_TOKEN, node, element))
+        else if(!axutil_strcmp(localname, RP_SAML_TOKEN))
         {
             return rp_saml_token_builder_build(env, node, element);
         }
-        else
-            return NULL;
-    }
-    else if (axutil_strcmp(localname, RP_WSS_SAML_V10_TOKEN_V10) == 0)
-    {
-        if (rp_match_secpolicy_qname
-            (env, RP_WSS_SAML_V10_TOKEN_V10, node, element))
+        else if(!axutil_strcmp(localname, RP_WSS_SAML_V10_TOKEN_V10))
         {
             neethi_assertion_t *assertion = NULL;
             assertion = neethi_assertion_create(env);
-            neethi_assertion_set_value(assertion, env, NULL,
-                                       ASSERTION_TYPE_WSS_SAML_V10_TOKEN_V10);
+            neethi_assertion_set_value(assertion, env, NULL, ASSERTION_TYPE_WSS_SAML_V10_TOKEN_V10);
             return assertion;
         }
-        else
-            return NULL;
-    }
-    else if (axutil_strcmp(localname, RP_WSS_SAML_V10_TOKEN_V11) == 0)
-    {
-        if (rp_match_secpolicy_qname
-            (env, RP_WSS_SAML_V10_TOKEN_V11, node, element))
+        else if(!axutil_strcmp(localname, RP_WSS_SAML_V10_TOKEN_V11))
         {
             neethi_assertion_t *assertion = NULL;
             assertion = neethi_assertion_create(env);
-            neethi_assertion_set_value(assertion, env, NULL,
-                                       ASSERTION_TYPE_WSS_SAML_V10_TOKEN_V11);
+            neethi_assertion_set_value(assertion, env, NULL, ASSERTION_TYPE_WSS_SAML_V10_TOKEN_V11);
             return assertion;
         }
-        else
-            return NULL;
-    }
-    else if (axutil_strcmp(localname, RP_WSS_SAML_V11_TOKEN_V10) == 0)
-    {
-        if (rp_match_secpolicy_qname
-            (env, RP_WSS_SAML_V11_TOKEN_V10, node, element))
+        else if(!axutil_strcmp(localname, RP_WSS_SAML_V11_TOKEN_V10))
         {
             neethi_assertion_t *assertion = NULL;
             assertion = neethi_assertion_create(env);
-            neethi_assertion_set_value(assertion, env, NULL,
-                                       ASSERTION_TYPE_WSS_SAML_V11_TOKEN_V10);
+            neethi_assertion_set_value(assertion, env, NULL, ASSERTION_TYPE_WSS_SAML_V11_TOKEN_V10);
             return assertion;
         }
-        else
-            return NULL;
-    }
-    else if (axutil_strcmp(localname, RP_WSS_SAML_V11_TOKEN_V11) == 0)
-    {
-        if (rp_match_secpolicy_qname
-            (env, RP_WSS_SAML_V11_TOKEN_V11, node, element))
+        else if(!axutil_strcmp(localname, RP_WSS_SAML_V11_TOKEN_V11))
         {
             neethi_assertion_t *assertion = NULL;
             assertion = neethi_assertion_create(env);
-            neethi_assertion_set_value(assertion, env, NULL,
-                                       ASSERTION_TYPE_WSS_SAML_V11_TOKEN_V11);
+            neethi_assertion_set_value(assertion, env, NULL, ASSERTION_TYPE_WSS_SAML_V11_TOKEN_V11);
             return assertion;
         }
-        else
-            return NULL;
-    }
-    else if (axutil_strcmp(localname, RP_WSS_SAML_V20_TOKEN_V11) == 0)
-    {
-        if (rp_match_secpolicy_qname
-            (env, RP_WSS_SAML_V20_TOKEN_V11, node, element))
+        else if(!axutil_strcmp(localname, RP_WSS_SAML_V20_TOKEN_V11))
         {
             neethi_assertion_t *assertion = NULL;
             assertion = neethi_assertion_create(env);
-            neethi_assertion_set_value(assertion, env, NULL,
-                                       ASSERTION_TYPE_WSS_SAML_V20_TOKEN_V11);
+            neethi_assertion_set_value(assertion, env, NULL, ASSERTION_TYPE_WSS_SAML_V20_TOKEN_V11);
             return assertion;
         }
-        else
-            return NULL;
     }
-    else
+    else if(!axutil_strcmp(ns, RP_RAMPART_NS))
     {
-        AXIS2_ERROR_SET(env->error,
-                        AXIS2_ERROR_NEETHI_UNKNOWN_ASSERTION,
-                        AXIS2_FAILURE);
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Unknown Assertion");
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                        "[neethi] Unknown Assertion %s",
-                        localname);
-        return NULL;
+        /* if namespace is Rampart Namespace */
+        if(!axutil_strcmp(localname, RP_RAMPART_CONFIG))
+        {
+            return rp_rampart_config_builder_build(env, node, element);
+        }
     }
+
+    /* This assertion cannot be processed */
+    AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NEETHI_UNKNOWN_ASSERTION, AXIS2_FAILURE);
+    AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
+        "[neethi] Unknown Assertion %s with namespace %s", localname, ns);
+    return NULL;
 }

Modified: webservices/axis2/trunk/c/neethi/src/secpolicy/builder/issued_token_builder.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/secpolicy/builder/issued_token_builder.c?rev=685799&r1=685798&r2=685799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/neethi/src/secpolicy/builder/issued_token_builder.c (original)
+++ webservices/axis2/trunk/c/neethi/src/secpolicy/builder/issued_token_builder.c Thu Aug 14 01:03:32 2008
@@ -41,7 +41,7 @@
 	neethi_assertion_t *assertion= NULL;
 
 	issued_token = rp_issued_token_create(env);
-	qname = axutil_qname_create(env, RP_INCLUDE_TOKEN, RP_SP_NS, RP_SP_PREFIX);
+	qname = axutil_qname_create(env, RP_INCLUDE_TOKEN, RP_SP_NS_11, RP_SP_PREFIX);
 
 	inclusoin_value = axiom_element_get_attribute_value(element, env, qname);
 
@@ -53,7 +53,7 @@
 		rp_issued_token_set_inclusion(issued_token, env, inclusoin_value);
 	}
 
-	qname = axutil_qname_create(env, RP_ISSUER, RP_SP_NS, RP_SP_PREFIX);
+	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) 
@@ -69,7 +69,7 @@
 	axutil_qname_free(qname, env);
 	qname = NULL;
 
-	qname = axutil_qname_create(env, RP_REQUEST_SEC_TOKEN_TEMPLATE, RP_SP_NS,
+	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);

Modified: webservices/axis2/trunk/c/neethi/src/secpolicy/builder/rampart_config_builder.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/secpolicy/builder/rampart_config_builder.c?rev=685799&r1=685798&r2=685799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/neethi/src/secpolicy/builder/rampart_config_builder.c (original)
+++ webservices/axis2/trunk/c/neethi/src/secpolicy/builder/rampart_config_builder.c Thu Aug 14 01:03:32 2008
@@ -16,7 +16,6 @@
  */
 
 #include <rp_rampart_config_builder.h>
-#include <rp_qname_matcher.h>
 
 /*private functions*/
 
@@ -95,182 +94,114 @@
     axiom_element_t *element,
     axis2_char_t *local_name)
 {
-    if (axutil_strcmp(local_name, RP_USER) == 0)
+    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)
     {
-        if (rp_match_rampart_config_qname(env, RP_USER, node, element))
+        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
-            return AXIS2_FAILURE;
-    }
-    else if (axutil_strcmp(local_name, RP_ENCRYPTION_USER) == 0)
-    {
-        if (rp_match_rampart_config_qname
-            (env, RP_ENCRYPTION_USER, node, element))
+        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);
+            return rp_rampart_config_set_encryption_user(rampart_config, env,encryption_user);
         }
-        else
-            return AXIS2_FAILURE;
-    }
-    else if (axutil_strcmp(local_name, RP_PASSWORD_CALLBACK_CLASS) == 0)
-    {
-        if (rp_match_rampart_config_qname
-            (env, RP_PASSWORD_CALLBACK_CLASS, node, element))
+        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);
+            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
-            return AXIS2_FAILURE;
-    }
-    else if (axutil_strcmp(local_name, RP_AUTHN_MODULE_NAME) == 0)
-    {
-        if (rp_match_rampart_config_qname
-            (env, RP_AUTHN_MODULE_NAME, node, element))
+        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);
+            return rp_rampart_config_set_authenticate_module(
+                rampart_config, env, authenticate_module);
         }
-        else
-            return AXIS2_FAILURE;
-    }
-    else if (axutil_strcmp(local_name, RP_RD_MODULE) == 0)
-    {
-        if (rp_match_rampart_config_qname
-            (env, RP_RD_MODULE, node, element))
+        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);
+            return rp_rampart_config_set_replay_detector(rampart_config, env, replay_detector);
         }
-        else
-            return AXIS2_FAILURE;
-    }
-    else if (axutil_strcmp(local_name, RP_SCT_MODULE) == 0)
-    {
-        if (rp_match_rampart_config_qname
-            (env, RP_SCT_MODULE, node, element))
+        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);
+            return rp_rampart_config_set_sct_provider(rampart_config, env, sct_module);
         }
-        else
-            return AXIS2_FAILURE;
-    }
-    else if (axutil_strcmp(local_name, RP_PASSWORD_TYPE) == 0)
-    {
-        if (rp_match_rampart_config_qname(env, RP_PASSWORD_TYPE, node, element))
+        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);
+            return rp_rampart_config_set_password_type(rampart_config, env, password_type);
         }
-        else
-            return AXIS2_FAILURE;
-    }
-
-    else if (axutil_strcmp(local_name, RP_CERTIFICATE) == 0)
-    {
-        if (rp_match_rampart_config_qname(env, RP_CERTIFICATE, node, element))
+        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);
+            return rp_rampart_config_set_certificate_file(rampart_config, env, certificate_file);
         }
-        else
-            return AXIS2_FAILURE;
-    }
-
-    else if (axutil_strcmp(local_name, RP_RECEIVER_CERTIFICATE) == 0)
-    {
-        if (rp_match_rampart_config_qname
-            (env, RP_RECEIVER_CERTIFICATE, node, element))
+        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);
+            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
-            return AXIS2_FAILURE;
-    }
-
-    else if (axutil_strcmp(local_name, RP_PRIVATE_KEY) == 0)
-    {
-        if (rp_match_rampart_config_qname(env, RP_PRIVATE_KEY, node, element))
+        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);
+            return rp_rampart_config_set_private_key_file(rampart_config, env, private_key_file);
         }
-        else
-            return AXIS2_FAILURE;
-    }
-    else if (axutil_strcmp(local_name, RP_PKCS12_KEY_STORE) == 0)
-    {
-        if (rp_match_rampart_config_qname(env, RP_PKCS12_KEY_STORE, node, element))
+        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);
+            return rp_rampart_config_set_pkcs12_file(rampart_config, env, pkcs12_key_store);
         }
-        else
-            return AXIS2_FAILURE;
-    }
-    else if (axutil_strcmp(local_name, RP_TIME_TO_LIVE) == 0)
-    {
-        if (rp_match_rampart_config_qname(env, RP_TIME_TO_LIVE, node, element))
+        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);
+            return rp_rampart_config_set_time_to_live(rampart_config, env, time_to_live);
         }
-        else
-            return AXIS2_FAILURE;
-    }
-
-    else if (axutil_strcmp(local_name, RP_RD) == 0)
-    {
-        if (rp_match_rampart_config_qname(env, RP_RD, node, element))
+        else if(!axutil_strcmp(local_name, RP_RD))
         {
             axis2_char_t *rd_val = NULL;
             rd_val = axiom_element_get_text(element, env, node);
-            rp_rampart_config_set_rd_val(rampart_config, env, rd_val);
-            return AXIS2_SUCCESS;
-        }
-        else
-        {
-            return AXIS2_FAILURE;
+            return rp_rampart_config_set_rd_val(rampart_config, env, rd_val);
         }
     }
-    else
-        return AXIS2_FAILURE;
+
+    /* 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;
+
+
 }

Modified: webservices/axis2/trunk/c/neethi/src/secpolicy/builder/saml_token_builder.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/secpolicy/builder/saml_token_builder.c?rev=685799&r1=685798&r2=685799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/neethi/src/secpolicy/builder/saml_token_builder.c (original)
+++ webservices/axis2/trunk/c/neethi/src/secpolicy/builder/saml_token_builder.c Thu Aug 14 01:03:32 2008
@@ -41,7 +41,7 @@
     neethi_policy_t *normalized_policy = NULL;
     
     saml_token = rp_saml_token_create(env);
-    qname = axutil_qname_create(env, RP_INCLUDE_TOKEN, RP_SP_NS, RP_SP_PREFIX);
+    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);
 

Modified: 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=685799&r1=685798&r2=685799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/neethi/src/secpolicy/builder/security_context_token_builder.c (original)
+++ webservices/axis2/trunk/c/neethi/src/secpolicy/builder/security_context_token_builder.c Thu Aug 14 01:03:32 2008
@@ -21,7 +21,6 @@
 #include <neethi_exactlyone.h>
 #include <neethi_all.h>
 #include <neethi_engine.h>
-#include <rp_qname_matcher.h>
 
 /*private functions*/
 
@@ -53,7 +52,7 @@
     neethi_policy_t *normalized_policy = NULL;
 
     security_context_token = rp_security_context_token_create(env);
-    qname = axutil_qname_create(env, RP_INCLUDE_TOKEN, RP_SP_NS, RP_SP_PREFIX);
+    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);
 
@@ -87,15 +86,37 @@
                         localname = axiom_element_get_localname(child_element, env);
                         if (axutil_strcmp(localname, RP_ISSUER) == 0)
                         {
-                            if (rp_match_secpolicy_qname(env, RP_ISSUER, child_node, child_element))
+                            axis2_char_t *ns = NULL;
+                            axutil_qname_t *node_qname = NULL;
+
+                            node_qname = axiom_element_get_qname(element, env, node);
+                            if(!node_qname)
                             {
-                                axis2_char_t *issuer = NULL;
+                                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);
+                                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
                         {

Modified: webservices/axis2/trunk/c/neethi/src/secpolicy/builder/signed_encrypted_parts_builder.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/secpolicy/builder/signed_encrypted_parts_builder.c?rev=685799&r1=685798&r2=685799&view=diff
==============================================================================
--- webservices/axis2/trunk/c/neethi/src/secpolicy/builder/signed_encrypted_parts_builder.c (original)
+++ webservices/axis2/trunk/c/neethi/src/secpolicy/builder/signed_encrypted_parts_builder.c Thu Aug 14 01:03:32 2008
@@ -21,58 +21,47 @@
 #include <neethi_exactlyone.h>
 #include <neethi_all.h>
 #include <neethi_engine.h>
-#include <rp_qname_matcher.h>
 
-rp_header_t *AXIS2_CALL rp_signed_encrypted_parts_builder_build_header(
+static rp_header_t *AXIS2_CALL rp_signed_encrypted_parts_builder_build_header(
     axiom_element_t *element,
     const axutil_env_t *env);
 
-axis2_status_t AXIS2_CALL rp_signed_encrypted_parts_builder_set_properties(
+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)
+    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_char_t *ele_name = NULL;
     axis2_status_t status = AXIS2_SUCCESS;
 
-    AXIS2_ENV_CHECK(env, NULL);
-
     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;
     }
 
-    ele_name = axiom_element_get_localname(parts_ele, env);
-    if (ele_name)
-    {
-        if ((axutil_strcmp(ele_name, RP_SIGNED_PARTS) == 0))
-        {
-            rp_signed_encrypted_parts_set_signedparts(signed_encrypted_parts,
-                                                      env, AXIS2_TRUE);
-        }
-        else if (axutil_strcmp(ele_name, RP_ENCRYPTED_PARTS) == 0)
-        {
-            rp_signed_encrypted_parts_set_signedparts(signed_encrypted_parts,
-                                                      env, AXIS2_FALSE);
-        }
-        else
-            return NULL;
-    }
-    else
-        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)
@@ -87,23 +76,22 @@
             {
                 if (axiom_node_get_node_type(node, env) == AXIOM_ELEMENT)
                 {
-                    ele =
-                        (axiom_element_t *) axiom_node_get_data_element(node,
-                                                                        env);
+                    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);
+                            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);
+                                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;
                             }
                         }
                     }
@@ -111,15 +99,13 @@
             }
         }
     }
-    assertion =
-        neethi_assertion_create_with_args(env,
-                                          (AXIS2_FREE_VOID_ARG)rp_signed_encrypted_parts_free,
-                                          signed_encrypted_parts,
-                                          ASSERTION_TYPE_SIGNED_ENCRYPTED_PARTS);
+    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;
 }
 
-axis2_status_t AXIS2_CALL
+static axis2_status_t AXIS2_CALL
 rp_signed_encrypted_parts_builder_set_properties(
     axiom_node_t *node,
     axiom_element_t *element,
@@ -127,46 +113,66 @@
     rp_signed_encrypted_parts_t * signed_encrypted_parts,
     const axutil_env_t *env)
 {
-    if (strcmp(local_name, RP_BODY) == 0)
+    axis2_char_t *ns = NULL;
+    axutil_qname_t *node_qname = NULL;
+
+    node_qname = axiom_element_get_qname(element, env, node);
+    if(!node_qname)
     {
-        if (rp_match_secpolicy_qname(env, RP_BODY, node, element))
+        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);
+            rp_signed_encrypted_parts_set_body(signed_encrypted_parts, env, AXIS2_TRUE);
             return AXIS2_SUCCESS;
         }
-        else
-        {
-            return AXIS2_FAILURE;
-        }
-    }
-    else if (strcmp(local_name, RP_HEADER) == 0)
-    {
-        if (rp_match_secpolicy_qname(env, RP_HEADER, node, element))
+        else if(!strcmp(local_name, RP_HEADER))
         {
             rp_header_t *header = NULL;
-            header =
-                rp_signed_encrypted_parts_builder_build_header(element, env);
-            if (!header)
+            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);
-        }
-        else
-        {
-            return AXIS2_FAILURE;
+            return rp_signed_encrypted_parts_add_header(signed_encrypted_parts, env, header);
         }
     }
-    else
+
+    /* process assertions specific to WS-SecPolicy 1.2 */
+    if(!axutil_strcmp(ns, RP_SP_NS_12))
     {
-        return AXIS2_FAILURE;
+        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;
 }
 
-rp_header_t *AXIS2_CALL
+static rp_header_t *AXIS2_CALL
 rp_signed_encrypted_parts_builder_build_header(
     axiom_element_t *element,
     const axutil_env_t *env)
@@ -175,25 +181,28 @@
     axis2_char_t *name = NULL;
     axis2_char_t *nspace = NULL;
 
-    header = rp_header_create(env);
-    if (!header)
-        return 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);
+    nspace = axiom_element_get_attribute_value_by_name(element, env, RP_NAMESPACE);
     if (!nspace)
     {
-        rp_header_free(header, env);
-        header = NULL;
+        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;
 }



Mime
View raw message