You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rampart-dev@ws.apache.org by mi...@apache.org on 2007/10/05 15:04:58 UTC

svn commit: r582243 - in /webservices/rampart/scratch/c/trust: include/trust_constants.h include/trust_data.h src/data.c

Author: milinda
Date: Fri Oct  5 06:04:57 2007
New Revision: 582243

URL: http://svn.apache.org/viewvc?rev=582243&view=rev
Log:
Process functions for claims.

Modified:
    webservices/rampart/scratch/c/trust/include/trust_constants.h
    webservices/rampart/scratch/c/trust/include/trust_data.h
    webservices/rampart/scratch/c/trust/src/data.c

Modified: webservices/rampart/scratch/c/trust/include/trust_constants.h
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/include/trust_constants.h?rev=582243&r1=582242&r2=582243&view=diff
==============================================================================
--- webservices/rampart/scratch/c/trust/include/trust_constants.h (original)
+++ webservices/rampart/scratch/c/trust/include/trust_constants.h Fri Oct  5 06:04:57 2007
@@ -37,6 +37,8 @@
 #define TRUST_ENTROPY			"Entropy"
 #define TRSUT_KEY_TYPE			"KeyType"
 #define TRUST_KEY_SIZE			"KeySize"
+#define TRUST_CLAIMS			"Claims"
+#define TRUST_CLAIMS_DIALECT	"Dialect"
 
 #define TRUST_LIFE_TIME			"LifeTime"
 #define TRUST_TIMESTAMP_CREATED	"Created"

Modified: webservices/rampart/scratch/c/trust/include/trust_data.h
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/include/trust_data.h?rev=582243&r1=582242&r2=582243&view=diff
==============================================================================
--- webservices/rampart/scratch/c/trust/include/trust_data.h (original)
+++ webservices/rampart/scratch/c/trust/include/trust_data.h Fri Oct  5 06:04:57 2007
@@ -59,15 +59,19 @@
 		trust_data_t *trust_data, 
 		const axutil_env_t *env);
 
-	AXIS2_EXPORT void AXIS2_CALL trust_data_process_applies_to(
+	AXIS2_EXPORT axis2_status_t AXIS2_CALL trust_data_process_applies_to(
 		trust_data_t *trust_data, 
 		const axutil_env_t *env);
 
-	AXIS2_EXPORT void AXIS2_CALL trust_data_process_life_time(
+	AXIS2_EXPORT axis2_status_t AXIS2_CALL trust_data_process_life_time(
 		trust_data_t *trust_data, 
 		const axutil_env_t *env);
 
-	AXIS2_EXPORT void AXIS2_CALL trust_data_process_entorpy(
+	AXIS2_EXPORT axis2_status_t AXIS2_CALL trust_data_process_claims(
+		trust_data_t *trust_data,
+		axutil_env_t *env);
+
+	AXIS2_EXPORT axis2_status_t AXIS2_CALL trust_data_process_entorpy(
 		trust_data_t *trust_data, 
 		const axutil_env_t *env);
 

Modified: webservices/rampart/scratch/c/trust/src/data.c
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/src/data.c?rev=582243&r1=582242&r2=582243&view=diff
==============================================================================
--- webservices/rampart/scratch/c/trust/src/data.c (original)
+++ webservices/rampart/scratch/c/trust/src/data.c Fri Oct  5 06:04:57 2007
@@ -47,12 +47,12 @@
 	axis2_char_t *key_type;					
 
 	/*optional element for specific set of requested claims*/
-    axiom_node_t *claim_node;
+    axiom_node_t *claims_node;
 
 	/**wst:RequestSecurityToken/wst:Claims@Dialect
 	  *Attribute specifies a URI to indicate the syntax of the claims
 	  */
-	axis2_char_t *claim_dialect;
+	axis2_char_t *claims_dialect;
 
 	/* SOAP Namespace */
 	axis2_char_t *soap_namespace;	
@@ -100,7 +100,7 @@
 	trust_data_process_token_type(trust_data, env);
 
 	/* TODO: Process other fields */	
-
+	/* TODO: Addressing namespace processing */
 	return trust_data;
 }
 
@@ -242,5 +242,46 @@
 	trust_data->token_type = axiom_element_get_text( token_type_ele, env, token_type_node);
 
 	return AXIS2_SUCCESS;
+}
+
+AXIS2_EXPORT axis2_status_t AXIS2_CALL trust_data_process_claims(
+    trust_data_t *trust_data,
+    axutil_env_t *env)
+{
+	axiom_node_t* claims_node = NULL;
+    axiom_element_t * claims_ele = NULL;
+    axiom_element_t * rst_ele = NULL;
+    axutil_qname_t* claims_qname = NULL;
+    axutil_qname_t *attr_dialect_qname = NULL;
+    axis2_char_t *dialect = NULL;
+
+	AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    rst_ele = (axiom_element_t *)(axiom_node_get_data_element(trust_data->rst_node, env));
+
+    claims_qname = axutil_qname_create(env, TRUST_CLAIMS, trust_data->wst_namespace, TRUST_WST);
+
+    claims_ele = axiom_element_get_first_child_with_qname(rst_ele, env, claims_qname,
+        trust_data->rst_node, &claims_node);
+    if(!claims_ele)
+        return AXIS2_FAILURE;
+
+    trust_data->claims_node = claims_node;
+
+    attr_dialect_qname = axutil_qname_create(env, TRUST_CLAIMS_DIALECT, trust_data->wst_namespace, TRUST_WST);
+    if(!attr_dialect_qname)
+	{
+        return AXIS2_FAILURE;
+	}
+
+    dialect = axiom_element_get_attribute_value(claims_ele, env, attr_dialect_qname);
+
+    if(!dialect)
+    {
+        return AXIS2_FAILURE;
+    }
+	trust_data->claims_dialect = dialect;
+
+    return AXIS2_SUCCESS;
 }