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 su...@apache.org on 2008/03/31 08:25:19 UTC

svn commit: r642897 [1/2] - in /webservices/rampart/scratch/c/fed/c: include/ src/fed/

Author: supun
Date: Sun Mar 30 23:25:17 2008
New Revision: 642897

URL: http://svn.apache.org/viewvc?rev=642897&view=rev
Log: (empty)

Added:
    webservices/rampart/scratch/c/fed/c/include/fed.h
    webservices/rampart/scratch/c/fed/c/include/fed_auth_additional_context.h
    webservices/rampart/scratch/c/fed/c/include/fed_auth_claim.h
    webservices/rampart/scratch/c/fed/c/include/fed_auth_common_claim_dialect.h
    webservices/rampart/scratch/c/fed/c/include/fed_authorization_context.h
    webservices/rampart/scratch/c/fed/c/include/fed_constants.h
    webservices/rampart/scratch/c/fed/c/include/fed_context_item.h
    webservices/rampart/scratch/c/fed/c/include/fed_federation_metadata.h
    webservices/rampart/scratch/c/fed/c/include/fed_metadata_om.h
    webservices/rampart/scratch/c/fed/c/src/fed/
    webservices/rampart/scratch/c/fed/c/src/fed/auth_additional_context.c
    webservices/rampart/scratch/c/fed/c/src/fed/auth_claim.c
    webservices/rampart/scratch/c/fed/c/src/fed/authorization_context.c
    webservices/rampart/scratch/c/fed/c/src/fed/common_claim_dialect.c
    webservices/rampart/scratch/c/fed/c/src/fed/context_item.c
    webservices/rampart/scratch/c/fed/c/src/fed/fed.c
    webservices/rampart/scratch/c/fed/c/src/fed/fed_federation_metadata.c
    webservices/rampart/scratch/c/fed/c/src/fed/fed_metadata_om.c
    webservices/rampart/scratch/c/fed/c/src/fed/test_main.c

Added: webservices/rampart/scratch/c/fed/c/include/fed.h
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/fed/c/include/fed.h?rev=642897&view=auto
==============================================================================
--- webservices/rampart/scratch/c/fed/c/include/fed.h (added)
+++ webservices/rampart/scratch/c/fed/c/include/fed.h Sun Mar 30 23:25:17 2008
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ * 
+ */
+
+#ifndef FED_H
+#define FED_H
+
+#include <fed_federation_metadata.h>
+#include <axiom.h>
+
+typedef struct fed_s fed_t;
+
+
+
+#endif

Added: webservices/rampart/scratch/c/fed/c/include/fed_auth_additional_context.h
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/fed/c/include/fed_auth_additional_context.h?rev=642897&view=auto
==============================================================================
--- webservices/rampart/scratch/c/fed/c/include/fed_auth_additional_context.h (added)
+++ webservices/rampart/scratch/c/fed/c/include/fed_auth_additional_context.h Sun Mar 30 23:25:17 2008
@@ -0,0 +1,81 @@
+/*
+ * 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.
+ * 
+*/
+
+#ifndef FED_AUTH_ADDITIONAL_CONTEXT_H
+#define	FED_AUTH_ADDITIONAL_CONTEXT_H
+
+#include <stdio.h>
+#include <axiom.h>
+#include <axutil_utils.h>
+#include <axutil_hash.h>
+
+#include <fed_context_item.h>
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+    
+    typedef struct fed_auth_additional_context fed_auth_additional_context_t;
+    
+    AXIS2_EXTERN fed_auth_additional_context_t * AXIS2_CALL
+    fed_auth_additional_context_create(
+        const axutil_env_t * env);
+    
+    AXIS2_EXTERN void AXIS2_CALL
+    fed_auth_additional_context_free(
+        fed_auth_additional_context_t *fed_auth_additional_context,
+        const axutil_env_t * env);
+    
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    fed_auth_additional_context_add_ctx_item(
+        fed_auth_additional_context_t * fed_auth_additional_context,
+        const axutil_env_t * env,
+        fed_auth_context_item_t* ctx_item);
+    
+    
+    
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    fed_auth_additional_context_create_ctx_item(
+        fed_auth_additional_context_t * fed_auth_additional_context,
+        const axutil_env_t * env,
+        axis2_char_t *ctx_item_name,
+        axis2_char_t *ctx_item_value,
+        axis2_char_t *ctx_item_scope);
+    
+    
+
+    AXIS2_EXTERN fed_auth_context_item_t * AXIS2_CALL
+    fed_auth_additional_context_get_ctx_item(
+        fed_auth_additional_context_t * fed_auth_additional_context,
+        const axutil_env_t * env,
+        axis2_char_t *ctx_item_name);
+
+    
+    AXIS2_EXTERN axutil_hash_t * AXIS2_CALL
+    fed_auth_additional_context_get_ctx_item_hash_table(
+        fed_auth_additional_context_t * fed_auth_additional_context,
+        const axutil_env_t * env);
+    
+    
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* FED_AUTH_ADDITIONAL_CONTEXT_H */
+

Added: webservices/rampart/scratch/c/fed/c/include/fed_auth_claim.h
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/fed/c/include/fed_auth_claim.h?rev=642897&view=auto
==============================================================================
--- webservices/rampart/scratch/c/fed/c/include/fed_auth_claim.h (added)
+++ webservices/rampart/scratch/c/fed/c/include/fed_auth_claim.h Sun Mar 30 23:25:17 2008
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ * 	http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+*/
+
+#ifndef FED_AUTH_CLAIM_H
+#define	FED_AUTH_CLAIM_H
+
+#include <stdio.h>
+#include <axiom.h>
+#include <axutil_utils.h>
+#include <axutil_hash.h>
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+typedef struct fed_auth_claim fed_auth_claim_t;
+
+AXIS2_EXTERN fed_auth_claim_t * AXIS2_CALL
+fed_auth_claim_create(
+    const axutil_env_t * env);
+
+AXIS2_EXTERN void AXIS2_CALL
+fed_auth_claim_free(
+    fed_auth_claim_t *fed_auth_claim,
+    const axutil_env_t * env);
+
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+fed_auth_claim_get_claim_type_uri(
+    fed_auth_claim_t *fed_auth_claim,
+    const axutil_env_t *env);
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+fed_auth_claim_set_claim_type_uri(
+    fed_auth_claim_t *fed_auth_claim,                    
+    const axutil_env_t *env, 
+    axis2_char_t * claim_type_uri);
+
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+fed_auth_claim_get_claim_value(
+    fed_auth_claim_t *fed_auth_claim,
+    const axutil_env_t *env);
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+fed_auth_claim_set_claim_value(
+    fed_auth_claim_t *fed_auth_claim,                    
+    const axutil_env_t *env, 
+    axis2_char_t * claim_value);
+
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+fed_auth_claim_get_claim_optional_flag(
+    fed_auth_claim_t *fed_auth_claim,
+    const axutil_env_t *env);
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+fed_auth_claim_set_claim_optional_falg(
+    fed_auth_claim_t *fed_auth_claim,                    
+    const axutil_env_t *env, 
+    axis2_char_t * claim_optional_flag);
+
+
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* FED_AUTH_CLAIM_H */
+

Added: webservices/rampart/scratch/c/fed/c/include/fed_auth_common_claim_dialect.h
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/fed/c/include/fed_auth_common_claim_dialect.h?rev=642897&view=auto
==============================================================================
--- webservices/rampart/scratch/c/fed/c/include/fed_auth_common_claim_dialect.h (added)
+++ webservices/rampart/scratch/c/fed/c/include/fed_auth_common_claim_dialect.h Sun Mar 30 23:25:17 2008
@@ -0,0 +1,90 @@
+/*
+ * 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.
+ * 
+*/
+
+#ifndef FED_AUTH_COMMON_CLAIM_DIALECT_H
+#define	FED_AUTH_COMMON_CLAIM_DIALECT_H
+
+#include <stdio.h>
+#include <axiom.h>
+#include <axutil_utils.h>
+#include <axutil_hash.h>
+
+#include <fed_auth_claim.h>
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+typedef struct fed_auth_common_claim_dialect fed_auth_common_claim_dialect_t;
+
+AXIS2_EXTERN fed_auth_common_claim_dialect_t * AXIS2_CALL
+fed_auth_common_claim_dialect_create(
+    const axutil_env_t * env);
+
+AXIS2_EXTERN void AXIS2_CALL
+fed_auth_common_claim_dialect_free(
+    fed_auth_common_claim_dialect_t *fed_auth_common_claim_dialect,
+    const axutil_env_t * env);
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+fed_auth_common_claim_dialect_add_auth_claim(
+    fed_auth_common_claim_dialect_t * fed_auth_common_claim_dialect,
+    const axutil_env_t * env,
+    fed_auth_claim_t * auth_claim);
+
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+fed_auth_common_claim_dialect_create_auth_claim(
+    fed_auth_common_claim_dialect_t * fed_auth_common_claim_dialect,
+    const axutil_env_t * env,
+    axis2_char_t *claim_type_uri,
+    axis2_char_t *claim_type_value,
+    axis2_char_t *claim_type_optional);
+
+
+AXIS2_EXTERN fed_auth_claim_t * AXIS2_CALL
+fed_auth_common_claim_dialect_get_ctx_item(
+    fed_auth_common_claim_dialect_t * fed_auth_common_claim_dialect,
+    const axutil_env_t * env,
+    axis2_char_t *auth_claim_uri);
+
+
+AXIS2_EXTERN axutil_hash_t * AXIS2_CALL
+fed_auth_common_claim_dialect_get_auth_claim_hash_table(
+    fed_auth_common_claim_dialect_t * fed_auth_common_claim_dialect,
+    const axutil_env_t * env);
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+fed_auth_common_claim_dialect_set_dialect_uri(
+    fed_auth_common_claim_dialect_t * fed_auth_common_claim_dialect,
+    const axutil_env_t * env,
+    axis2_char_t * dialect_uri);
+
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+fed_auth_common_claim_dialect_get_dialect_uri(
+    fed_auth_common_claim_dialect_t * fed_auth_common_claim_dialect,
+    const axutil_env_t * env);
+
+
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* FED_AUTH_COMMON_CLAIM_DIALECT_H */
+

Added: webservices/rampart/scratch/c/fed/c/include/fed_authorization_context.h
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/fed/c/include/fed_authorization_context.h?rev=642897&view=auto
==============================================================================
--- webservices/rampart/scratch/c/fed/c/include/fed_authorization_context.h (added)
+++ webservices/rampart/scratch/c/fed/c/include/fed_authorization_context.h Sun Mar 30 23:25:17 2008
@@ -0,0 +1,101 @@
+/*
+ * 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.
+ * 
+*/
+
+#ifndef FED_AUTHORIZATION_CONTEXT_H
+#define	FED_AUTHORIZATION_CONTEXT_H
+
+#include <stdio.h>
+#include <axiom.h>
+#include <axutil_utils.h>
+#include <axutil_hash.h>
+
+#include <trust_rst.h>
+#include <trust_constants.h>
+
+#include <fed_constants.h>
+#include <fed_auth_additional_context.h> 
+#include <fed_auth_common_claim_dialect.h>
+
+
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+    typedef struct fed_authorization_context fed_authorization_context_t;
+
+    AXIS2_EXTERN fed_authorization_context_t * AXIS2_CALL
+    fed_authorization_context_create(
+        const axutil_env_t * env);
+    
+    AXIS2_EXTERN void AXIS2_CALL
+    fed_authorization_context_free(
+        fed_authorization_context_t *fed_authorization_context,
+        const axutil_env_t * env);
+    
+    AXIS2_EXTERN void AXIS2_CALL
+    fed_authorization_context_set_wst_ns(
+        fed_authorization_context_t * fed_authorization_context,
+        const axutil_env_t * env,
+        axis2_char_t * wst_ns_uri);
+    
+    AXIS2_EXTERN void AXIS2_CALL
+    fed_authorization_context_set_auth_ns(
+        fed_authorization_context_t * fed_authorization_context,
+        const axutil_env_t * env,
+        axis2_char_t * auth_ns_uri);
+    
+    /*Populate AdditinalContext from RST-Node*/
+    AXIS2_EXTERN fed_auth_additional_context_t * AXIS2_CALL
+    fed_authorization_context_populate_additional_context(
+        fed_authorization_context_t *fed_authorization_context,
+        const axutil_env_t * env,
+        axiom_node_t *rst_node);
+    
+    /*Add Created AdditionalContext to the given RST Node*/
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    fed_authorization_context_add_additional_context_to_rst(
+        fed_authorization_context_t *fed_authorization_context,
+        const axutil_env_t * env,
+        fed_auth_additional_context_t * additional_context,
+        axiom_node_t *rst_node);
+
+    /*Populate CommonClaimDialect from RST-Node*/
+    AXIS2_EXTERN fed_auth_common_claim_dialect_t * AXIS2_CALL
+    fed_authorization_context_populate_common_claim_dialect(
+        fed_authorization_context_t *fed_authorization_context,
+        const axutil_env_t * env,
+        axiom_node_t *rst_node);
+    
+    /*Add Created ComnonClaimDialect to the given RST Node*/
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    fed_authorization_context_add_common_claim_dialect_to_rst(
+        fed_authorization_context_t *fed_authorization_context,
+        const axutil_env_t * env,
+        fed_auth_common_claim_dialect_t * common_claim_dialect,
+        axiom_node_t *rst_node);
+    
+    
+            
+            
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* FED_AUTHORIZATION_CONTEXT_H */
+

Added: webservices/rampart/scratch/c/fed/c/include/fed_constants.h
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/fed/c/include/fed_constants.h?rev=642897&view=auto
==============================================================================
--- webservices/rampart/scratch/c/fed/c/include/fed_constants.h (added)
+++ webservices/rampart/scratch/c/fed/c/include/fed_constants.h Sun Mar 30 23:25:17 2008
@@ -0,0 +1,131 @@
+/*
+ * 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.
+ * 
+*/
+
+#ifndef FED_CONSTANTS_H
+#define FED_CONSTANTS_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+	/* Federation Namespaces and Prefixes*/
+	#define FED_WSF				"fed"
+	#define FED_FED_XML_NS 		"http://schemas.xmlsoap.org/ws/2006/12/federation"
+
+	#define FED_AUTH			"auth"
+	#define FED_AUTH_XML_NS 	"http://schemas.xmlsoap.org/ws/2006/12/authorization"
+
+	#define FED_WSA        		"wsa"
+	#define FED_WSA_XMLNS  		"http://schemas.xmlsoap.org/ws/2004/08/addressing"
+
+	#define FED_DS         "ds"
+	#define FED_DS_XMLNS   "http://www.w3.org/2000/09/xmldsig#"
+
+
+	/* Federation Local Names*/
+	#define FED_FEDERATION					"Federation"
+	#define FED_FEDERATION_METADATA				"FederationMetadata"
+	#define FED_TOKEN_SIGNING_KEY_INFO			"TokenSigningKeyInfo"
+	#define FED_TOKEN_KEY_TRANSFER_KEY_INFO         	"TokenKeyTransferKeyInfo"
+	#define FED_ISSER_NAMES_OFFERED				"IssuerNamesOffered"
+	#define FED_ISSER_NAMES_OFFERED_ISSUER_NAME		"IssuerNamesOffered"
+	#define FED_TOKEN_ISSUER_NAME				"TokenIssuerName"
+	#define FED_TOKEN_ISSUER_END_POINT			"TokenIssuerEndpoint"
+	#define FED_PSEUDONYM_SERVICE_END_POINT			"PseudonymServiceEndpoint"
+	#define FED_ATTRIBUTE_SERVICE_END_POINT			"AttributeServiceEndpoint"
+	#define FED_SINGLE_SIGNOUT_SUBSCRIPTION_END_POINT	"SingleSignOutSubscripionEndpoint"
+	#define FED_SINGLE_SIGNOUT_NOTIFICATION_END_POINT	"SingleSignOutNotificationEndpoint"
+	#define FED_TOKEN_TYPES_OFFERED				"TokenTypesOffered"
+	#define FED_TOKEN_TYPE					"TokenType"
+	#define FED_URI_NAMED_CLAIM_TYPES_OFFERED		"UriNamedClaimTypesOffered"
+	#define FED_URI_NAMED_CLAIM_TYPE			"ClaimType"
+	#define FED_URI_NAMED_CLAIM_TYPE_DISPLAY_NAME		"DisplayName"
+	#define FED_URI_NAMED_CLAIM_TYPE_DESCRIPTION		"Description"
+	#define FED_WSA_ADDRESS					"Address"
+                
+        #define FED_ADDITIONAL_CONTEXT                          "AdditionalContext"
+        #define FED_CONTEXT_ITEM                                "ContextItem"
+        #define FED_CONTEXT_ITEM_VALUE                          "Value"
+        #define FED_CONTEXT_ITEM_NAME                           "Name"
+        #define FED_CONTEXT_ITEM_SCOPE                          "Scope"        
+
+                
+        #define FED_CCD_CLAIMS                                  "Claims"     /*CCD :Common Claim Dialect - Claim*/
+        #define FED_CCD_CLAIM_TYPE                              "ClaimType"
+        #define FED_CCD_VALUE                                   "Value"
+                
+                
+	/* Federation Attribute Names */
+	#define FED_ATTR_FED_ID				"FederationID"
+	#define FED_ATTR_TOKEN_TYPE_URI			"Uri"
+	#define FED_ATTR_METADATA_WSU_ID		"Id"
+	#define FED_ATTR_URI				"Uri"
+        #define FED_ATTR_OPTIONAL_FLAG                  "Optional"
+
+
+
+
+
+
+
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* FED_CONSTANTS_H */
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

Added: webservices/rampart/scratch/c/fed/c/include/fed_context_item.h
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/fed/c/include/fed_context_item.h?rev=642897&view=auto
==============================================================================
--- webservices/rampart/scratch/c/fed/c/include/fed_context_item.h (added)
+++ webservices/rampart/scratch/c/fed/c/include/fed_context_item.h Sun Mar 30 23:25:17 2008
@@ -0,0 +1,84 @@
+/*
+ * 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.
+ * 
+*/
+#ifndef FED_AUTH_CONTEXT_ITEM_H
+#define	FED_AUTH_CONTEXT_ITEM_H
+
+#include <stdio.h>
+#include <axiom.h>
+#include <axutil_utils.h>
+#include <axutil_hash.h>
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+    typedef struct fed_auth_context_item fed_auth_context_item_t;
+    
+    AXIS2_EXTERN fed_auth_context_item_t * AXIS2_CALL
+    fed_auth_context_item_create(
+        const axutil_env_t * env);
+    
+    AXIS2_EXTERN void AXIS2_CALL
+    fed_auth_context_item_free(
+        fed_auth_context_item_t *fed_auth_context_item,
+        const axutil_env_t * env);
+
+    /*ContextItem - @Name*/
+    AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+    fed_auth_context_item_get_ctx_item_name(
+        fed_auth_context_item_t *fed_auth_context_item,
+        const axutil_env_t *env);
+    
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    fed_auth_context_item_set_ctx_item_name(
+                    fed_auth_context_item_t *fed_auth_context_item,                    
+                    const axutil_env_t *env, 
+                    axis2_char_t * ctx_item_name);
+    
+    /*ContextItem - Value*/
+    AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+    fed_auth_context_item_get_ctx_item_value(
+        fed_auth_context_item_t *fed_auth_context_item,
+        const axutil_env_t *env);
+    
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    fed_auth_context_item_set_ctx_item_value(
+                    fed_auth_context_item_t *fed_auth_context_item,
+                    const axutil_env_t *env,
+                    axis2_char_t * ctx_item_value);
+    
+
+    /*ContextItem - @Scope*/
+    AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+    fed_auth_context_item_get_ctx_item_scope(
+        fed_auth_context_item_t *fed_auth_context_item,
+        const axutil_env_t *env);
+    
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    fed_auth_context_item_set_ctx_item_scope(
+                    fed_auth_context_item_t *fed_auth_context_item,
+                    const axutil_env_t *env,
+                    axis2_char_t * ctx_item_scope);
+    
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* fed_auth_context_item_H */
+

Added: webservices/rampart/scratch/c/fed/c/include/fed_federation_metadata.h
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/fed/c/include/fed_federation_metadata.h?rev=642897&view=auto
==============================================================================
--- webservices/rampart/scratch/c/fed/c/include/fed_federation_metadata.h (added)
+++ webservices/rampart/scratch/c/fed/c/include/fed_federation_metadata.h Sun Mar 30 23:25:17 2008
@@ -0,0 +1,119 @@
+/*
+ * 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.
+ * 
+*/
+
+#ifndef FED_FEDERATION_METADATA_H
+#define FED_FEDERATION_METADATA_H
+
+#include <axiom.h>
+#include <axutil_utils.h>
+#include <axutil_hash.h>
+
+#include <fed_metadata_om.h>
+#include <fed_constants.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+	typedef struct fed_federation_metadata fed_federation_metadata_t;
+
+	AXIS2_EXTERN fed_federation_metadata_t* AXIS2_CALL
+		fed_federation_metadata_create(
+				const axutil_env_t * env);
+
+	AXIS2_EXTERN void AXIS2_CALL
+		fed_federation_metadata_free(
+				fed_federation_metadata_t *federation_metadata,
+				const axutil_env_t * env);
+
+	/**
+	 * Load the whole metadata document of a metadata provider : This can be a single or a multiple federation 
+	 * This operation only load a fed_metadata_om/s based on the Federation ID.(But the fed_metadata_om/s are not populated)
+	 * The user has to specifically set the required function pointers for each federation and then call the fed_federation_metadata_populate_all
+	 * method.
+	*/
+	AXIS2_EXTERN axis2_status_t AXIS2_CALL
+		fed_federation_metadata_load_metadata(
+                    fed_federation_metadata_t *federation_metadata,
+                    const axutil_env_t * env, 
+                    axiom_node_t *metadata_node);
+
+	/* Poupulate all the metadata (from MEX or metadata doc) and form metadta_om whcih consists of metadata_oms */
+	AXIS2_EXTERN axis2_status_t AXIS2_CALL
+		fed_federation_metadata_populate_all(
+			fed_federation_metadata_t *federation_metadata,
+			const axutil_env_t * env);
+
+	AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+		fed_federation_metadata_build_all(
+				fed_federation_metadata_t *federation_metadata,
+				const axutil_env_t *env);
+
+
+	AXIS2_EXTERN fed_metadata_om_t* AXIS2_CALL
+		fed_federation_metadata_get_fed_metadata_om(
+				fed_federation_metadata_t *federation_metadata,				
+				const axutil_env_t * env, 
+                                axis2_char_t *federation_id);
+
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* FED_FEDERATION_METADATA_H */
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

Added: webservices/rampart/scratch/c/fed/c/include/fed_metadata_om.h
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/fed/c/include/fed_metadata_om.h?rev=642897&view=auto
==============================================================================
--- webservices/rampart/scratch/c/fed/c/include/fed_metadata_om.h (added)
+++ webservices/rampart/scratch/c/fed/c/include/fed_metadata_om.h Sun Mar 30 23:25:17 2008
@@ -0,0 +1,187 @@
+/*
+ * 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.
+ * 
+*/
+
+#ifndef FED_METADATA_OM_H
+#define FED_METADATA_OM_H
+
+#include <axiom.h>
+#include <axutil_utils.h>
+#include <axutil_hash.h>
+#include <axutil_array_list.h>
+
+#include <fed_constants.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+	typedef struct fed_metadata_om fed_metadata_om_t;
+
+	typedef struct fed_metadata_claim_type 
+	{
+		axis2_char_t *claim_type_uri_attr;
+		axis2_char_t *display_name;
+		axis2_char_t *description;
+	}fed_metadata_claim_type_t;
+	
+	AXIS2_EXTERN fed_metadata_om_t* AXIS2_CALL
+	fed_metadata_om_create(
+			axiom_node_t *metadata_node,
+			const axutil_env_t * env);
+
+	AXIS2_EXTERN void AXIS2_CALL
+	fed_metadata_om_free(
+			fed_metadata_om_t *metadata_om,
+			const axutil_env_t * env);
+
+	/** 
+	 * Populate the Federation Metadata context from federation metadata node. (of a given federation)
+	 * @param fed_metadata_om object . cannot be NULL
+	 * @param metadata axiom node. cannot be NULL
+	 * @return status
+	 */
+	AXIS2_EXTERN axis2_status_t AXIS2_CALL
+		fed_metadata_om_populate_metadata(
+				fed_metadata_om_t *metadata_om,
+				const axutil_env_t * env);
+
+
+	/**
+	 * Generate the axiom node of the populated metadata context (for a given federation)
+	 * @param fed_metadata_om . cannot be NULL
+	 */
+	AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+		fed_metadata_om_build_metadata_om(
+				fed_metadata_om_t *metadata_om,
+				const axutil_env_t *env);
+
+
+	/* Getters*/
+	AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+		fed_metadata_om_get_token_signing_key(
+				fed_metadata_om_t *metadata_om,
+				const axutil_env_t *env);
+
+
+	AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+		fed_metadata_om_get_federation_id(
+				fed_metadata_om_t *metadata_om,
+				const axutil_env_t *env);
+
+	AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+		fed_metadata_om_get_token_issuer_name(
+				fed_metadata_om_t *metadata_om,
+				const axutil_env_t *env);
+
+
+	AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+		fed_metadata_om_get_metadata_node(
+				fed_metadata_om_t *metadata_om,
+				const axutil_env_t *env);
+
+	AXIS2_EXTERN axutil_array_list_t* AXIS2_CALL
+		fed_metadata_om_get_token_types_offered_list(
+				fed_metadata_om_t *metadata_om,
+				const axutil_env_t *env);
+
+	AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+		fed_metadata_om_get_token_signing_info_node(
+				fed_metadata_om_t *metadata_om,
+				const axutil_env_t *env);
+
+	AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+		fed_metadata_om_get_token_key_transfer_key_info_node(
+				fed_metadata_om_t *metadata_om,
+				const axutil_env_t *env);
+
+	/*Setters*/
+	AXIS2_EXTERN void AXIS2_CALL
+		fed_metadata_om_set_token_signing_key(
+				fed_metadata_om_t *metadata_om,				
+				const axutil_env_t *env, 
+                                axis2_char_t *signing_key);
+
+		/* Set function pointers */
+	AXIS2_EXTERN void AXIS2_CALL
+		fed_metadata_om_set_process_token_key_signing_info_fp(
+				fed_metadata_om_t *metadata_om,				
+				const axutil_env_t *env, 
+                                void *processing_logic_fp);
+	
+	AXIS2_EXTERN void AXIS2_CALL
+		fed_metadata_om_set_build_token_key_signing_info_fp(
+				fed_metadata_om_t *metadata_om,				
+				const axutil_env_t *env, 
+                                void *build_logic_fp);
+
+	AXIS2_EXTERN void AXIS2_CALL
+		fed_metadata_om_set_process_token_key_transfer_key_info_fp(
+				fed_metadata_om_t *metadata_om,				
+				const axutil_env_t *env, 
+                                void *processing_logic_fp);
+
+	AXIS2_EXTERN void AXIS2_CALL
+		fed_metadata_om_set_build_token_key_transfer_key_info_fp(
+				fed_metadata_om_t *metadata_om,				
+				const axutil_env_t *env, 
+                                void *build_logic_fp);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* FED_METADATA_OM_H */
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

Added: webservices/rampart/scratch/c/fed/c/src/fed/auth_additional_context.c
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/fed/c/src/fed/auth_additional_context.c?rev=642897&view=auto
==============================================================================
--- webservices/rampart/scratch/c/fed/c/src/fed/auth_additional_context.c (added)
+++ webservices/rampart/scratch/c/fed/c/src/fed/auth_additional_context.c Sun Mar 30 23:25:17 2008
@@ -0,0 +1,169 @@
+/*
+ * 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 <fed_auth_additional_context.h>
+
+struct fed_auth_additional_context
+{
+    axutil_hash_t * context_item_hash_table;
+    axiom_node_t * auth_additional_context_node;
+
+};
+
+
+AXIS2_EXTERN fed_auth_additional_context_t * AXIS2_CALL
+fed_auth_additional_context_create(
+    const axutil_env_t * env)
+{
+    fed_auth_additional_context_t * additional_context = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    additional_context = (fed_auth_additional_context_t * ) AXIS2_MALLOC(env->allocator, sizeof(fed_auth_additional_context_t));
+    
+    if(NULL == additional_context)
+    {
+        return NULL;
+    }
+    
+    additional_context->context_item_hash_table = axutil_hash_make(env);	/* Create hash table */
+    additional_context->auth_additional_context_node = NULL;
+    
+    return additional_context;
+}
+
+
+AXIS2_EXTERN void AXIS2_CALL
+fed_auth_additional_context_free(
+    fed_auth_additional_context_t *fed_auth_additional_context,
+    const axutil_env_t * env)
+{
+    if(NULL == fed_auth_additional_context)
+        return;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    if(fed_auth_additional_context->context_item_hash_table)
+    {
+        axutil_hash_free(fed_auth_additional_context->context_item_hash_table, env);       
+    }
+    
+    AXIS2_FREE(env->allocator, fed_auth_additional_context);
+    
+    return;
+}
+    
+    
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+fed_auth_additional_context_add_ctx_item(
+    fed_auth_additional_context_t * fed_auth_additional_context,
+    const axutil_env_t * env,
+    fed_auth_context_item_t * ctx_item)
+{
+    if(ctx_item)
+    {
+        axutil_hash_set(fed_auth_additional_context->context_item_hash_table, 
+                fed_auth_context_item_get_ctx_item_name(ctx_item, env),
+                AXIS2_HASH_KEY_STRING,
+                ctx_item);
+        return AXIS2_SUCCESS;
+    }
+    
+    return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+fed_auth_additional_context_create_ctx_item(
+    fed_auth_additional_context_t * fed_auth_additional_context,
+    const axutil_env_t * env,
+    axis2_char_t *ctx_item_name,
+    axis2_char_t *ctx_item_value,
+    axis2_char_t *ctx_item_scope)
+{
+    fed_auth_context_item_t * ctx_item = NULL;
+    
+    if(fed_auth_additional_context)
+    {
+        ctx_item = fed_auth_context_item_create(env);
+        fed_auth_context_item_set_ctx_item_name(ctx_item, env, ctx_item_name);
+        fed_auth_context_item_set_ctx_item_value(ctx_item, env, ctx_item_value);
+        fed_auth_context_item_set_ctx_item_scope(ctx_item, env, ctx_item_scope);
+        
+        if(ctx_item)
+        {
+            axutil_hash_set(fed_auth_additional_context->context_item_hash_table, 
+                fed_auth_context_item_get_ctx_item_name(ctx_item, env),
+                AXIS2_HASH_KEY_STRING,
+                ctx_item);
+            return AXIS2_SUCCESS;            
+        }
+        
+    }
+    return AXIS2_FAILURE;
+}
+    
+
+AXIS2_EXTERN fed_auth_context_item_t * AXIS2_CALL
+fed_auth_additional_context_get_ctx_item(
+    fed_auth_additional_context_t * fed_auth_additional_context,
+    const axutil_env_t * env,
+    axis2_char_t *ctx_item_name)
+{
+    fed_auth_context_item_t * ctx_item = NULL;
+
+    if(ctx_item_name)
+    {
+        if(fed_auth_additional_context->context_item_hash_table)
+            ctx_item = (fed_auth_context_item_t *)axutil_hash_get(fed_auth_additional_context->context_item_hash_table, ctx_item_name, AXIS2_HASH_KEY_STRING);
+    }
+    
+    if(ctx_item)
+        return ctx_item;
+    
+    return NULL;        
+}
+
+
+
+AXIS2_EXTERN axutil_hash_t * AXIS2_CALL
+fed_auth_additional_context_get_ctx_item_hash_table(
+    fed_auth_additional_context_t * fed_auth_additional_context,
+    const axutil_env_t * env)
+{
+    return fed_auth_additional_context->context_item_hash_table;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

Added: webservices/rampart/scratch/c/fed/c/src/fed/auth_claim.c
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/fed/c/src/fed/auth_claim.c?rev=642897&view=auto
==============================================================================
--- webservices/rampart/scratch/c/fed/c/src/fed/auth_claim.c (added)
+++ webservices/rampart/scratch/c/fed/c/src/fed/auth_claim.c Sun Mar 30 23:25:17 2008
@@ -0,0 +1,134 @@
+/*
+ * 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 <fed_auth_claim.h>
+
+struct fed_auth_claim
+{
+    axis2_char_t * claim_type_uri;
+    axis2_char_t * claim_value;           /*Not frequently used*/
+    axis2_char_t * claim_optional_flag;    
+};
+
+
+AXIS2_EXTERN fed_auth_claim_t * AXIS2_CALL
+fed_auth_claim_create(
+    const axutil_env_t * env)
+{
+    fed_auth_claim_t * auth_claim = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    auth_claim = (fed_auth_claim_t *) AXIS2_MALLOC(env->allocator, sizeof(fed_auth_claim_t));
+    auth_claim->claim_type_uri = NULL;
+    auth_claim->claim_value = NULL;
+    auth_claim->claim_optional_flag = NULL;
+    
+    
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+fed_auth_claim_free(
+    fed_auth_claim_t *fed_auth_claim,
+    const axutil_env_t * env)
+{
+    if(NULL == fed_auth_claim)
+        return;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    AXIS2_FREE(env->allocator, fed_auth_claim);
+    return;
+}
+
+
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+fed_auth_claim_get_claim_type_uri(
+    fed_auth_claim_t *fed_auth_claim,
+    const axutil_env_t *env)
+{
+    if(fed_auth_claim)
+        return fed_auth_claim->claim_type_uri;
+    return NULL;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+fed_auth_claim_set_claim_type_uri(
+    fed_auth_claim_t *fed_auth_claim,                    
+    const axutil_env_t *env, 
+    axis2_char_t * claim_type_uri)
+{
+    if(fed_auth_claim)
+    {
+        if(claim_type_uri)
+        {
+            fed_auth_claim->claim_type_uri = claim_type_uri;
+        }        
+    }
+}
+
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+fed_auth_claim_get_claim_value(
+    fed_auth_claim_t *fed_auth_claim,
+    const axutil_env_t *env)
+{
+    if(fed_auth_claim)
+        return fed_auth_claim->claim_value;
+    return NULL;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+fed_auth_claim_set_claim_value(
+    fed_auth_claim_t *fed_auth_claim,                    
+    const axutil_env_t *env, 
+    axis2_char_t * claim_value)
+{
+    if(fed_auth_claim)
+    {
+        if(claim_value)
+        {
+            fed_auth_claim->claim_value = claim_value;
+        }        
+    }
+}
+
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+fed_auth_claim_get_claim_optional_flag(
+    fed_auth_claim_t *fed_auth_claim,
+    const axutil_env_t *env)
+{    
+    if(fed_auth_claim)
+        return fed_auth_claim->claim_optional_flag;
+    return NULL;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+fed_auth_claim_set_claim_optional_falg(
+    fed_auth_claim_t *fed_auth_claim,                    
+    const axutil_env_t *env, 
+    axis2_char_t * claim_optional_flag)
+{
+    if(fed_auth_claim)
+    {
+        if(claim_optional_flag)
+        {
+            fed_auth_claim->claim_optional_flag = claim_optional_flag;
+        }        
+    }
+}
+

Added: webservices/rampart/scratch/c/fed/c/src/fed/authorization_context.c
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/fed/c/src/fed/authorization_context.c?rev=642897&view=auto
==============================================================================
--- webservices/rampart/scratch/c/fed/c/src/fed/authorization_context.c (added)
+++ webservices/rampart/scratch/c/fed/c/src/fed/authorization_context.c Sun Mar 30 23:25:17 2008
@@ -0,0 +1,435 @@
+/*
+ * 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 <fed_authorization_context.h>
+#include <fed_auth_common_claim_dialect.h>
+
+
+struct fed_authorization_context
+{
+    /*Required Name Spaces*/
+    axis2_char_t * auth_ns;
+    axis2_char_t * wst_ns;
+    
+    /*Additinal Context or/and Common Claim Dialect can be presented in RST*/
+    
+    /*Additional Context*/
+    fed_auth_additional_context_t * additional_context;    
+        
+    /*Common Claim Dialect*/    
+    fed_auth_common_claim_dialect_t * common_claim_dialect;
+};
+
+
+AXIS2_EXTERN fed_authorization_context_t * AXIS2_CALL
+fed_authorization_context_create(
+    const axutil_env_t * env)
+{
+    fed_authorization_context_t * authorization_context = NULL;
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    authorization_context = (fed_authorization_context_t * ) AXIS2_MALLOC(env->allocator, sizeof(fed_authorization_context_t));
+    
+    if(!authorization_context)
+    {
+        return NULL;
+    }
+        
+    authorization_context->additional_context = NULL;
+    authorization_context->common_claim_dialect = NULL;
+    authorization_context->auth_ns = FED_AUTH_XML_NS;
+    authorization_context->wst_ns = TRUST_WST_XMLNS_05_02;
+    
+    return authorization_context;
+    
+}
+
+
+AXIS2_EXTERN void AXIS2_CALL
+fed_authorization_context_free(
+    fed_authorization_context_t *fed_authorization_context,
+    const axutil_env_t * env)
+{
+    AXIS2_ENV_CHECK(env, void);
+    if(fed_authorization_context)
+    {
+        AXIS2_FREE(env->allocator, fed_authorization_context);
+    }
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+fed_authorization_context_set_wst_ns(
+    fed_authorization_context_t * fed_authorization_context,
+    const axutil_env_t * env,
+    axis2_char_t * wst_ns_uri)
+{
+    AXIS2_ENV_CHECK(env, void);
+    if(wst_ns_uri)
+    {
+        fed_authorization_context->wst_ns = wst_ns_uri;
+        return;
+    }
+}
+    
+AXIS2_EXTERN void AXIS2_CALL
+fed_authorization_context_set_auth_ns(
+    fed_authorization_context_t * fed_authorization_context,
+    const axutil_env_t * env,
+    axis2_char_t * auth_ns_uri)
+{
+    AXIS2_ENV_CHECK(env, void);
+    if(auth_ns_uri)
+    {
+        fed_authorization_context->auth_ns = auth_ns_uri;
+        return;
+    }    
+}
+
+
+AXIS2_EXTERN fed_auth_additional_context_t * AXIS2_CALL
+fed_authorization_context_populate_additional_context(
+    fed_authorization_context_t *fed_authorization_context,
+    const axutil_env_t * env,
+    axiom_node_t *rst_node)
+{    
+    axiom_element_t * rst_ele = NULL;
+    
+    axiom_node_t * additional_context_node = NULL;
+    axiom_element_t * additional_context_ele = NULL;
+    axutil_qname_t * additional_context_qname = NULL;
+    
+    axiom_node_t * context_item_node = NULL;
+    axiom_element_t * context_item_ele = NULL;
+    axutil_qname_t * context_item_qname = NULL;
+    
+    axiom_node_t * value_node = NULL;
+    axiom_element_t * value_ele = NULL;
+    axutil_qname_t * value_qname = NULL;
+    
+    axiom_children_iterator_t *children_iter = NULL;
+    axiom_children_qname_iterator_t * children_qname_iter = NULL; 
+    
+    axis2_char_t * context_item_name = NULL;
+    axis2_char_t * context_item_value = NULL;
+    axis2_char_t * context_item_scope = NULL;
+    
+    fed_auth_context_item_t * context_item = NULL;
+    
+    if(NULL == rst_node)
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[fed] rst node NULL");
+        return NULL;
+    }
+    
+    rst_ele = axiom_node_get_data_element(rst_node, env);
+    fed_authorization_context->additional_context = fed_auth_additional_context_create(env);
+    
+    additional_context_qname = axutil_qname_create(env, FED_ADDITIONAL_CONTEXT, fed_authorization_context->auth_ns, FED_AUTH);
+    context_item_qname = axutil_qname_create(env, FED_CONTEXT_ITEM, fed_authorization_context->auth_ns, FED_AUTH);
+    
+    additional_context_ele = axiom_element_get_first_child_with_qname(rst_ele, env, additional_context_qname, rst_node, &additional_context_node);
+    
+    if(additional_context_ele)
+    {        
+        
+        
+        children_qname_iter = axiom_element_get_children_with_qname(additional_context_ele, env, context_item_qname, additional_context_node);
+        //printf("Additional Ctx :%s\n", axiom_node_to_string(additional_context_node, env));
+        if(NULL != children_qname_iter)
+        {
+            
+            while (axiom_children_qname_iterator_has_next(children_qname_iter, env))
+            {
+                context_item_node = axiom_children_qname_iterator_next(children_qname_iter, env);
+                
+                context_item_ele = axiom_node_get_data_element(context_item_node, env);
+                //printf("iterating...\n");
+                
+                if(context_item_node)
+                {
+                    context_item_name = axiom_element_get_attribute_value_by_name(context_item_ele, env, FED_CONTEXT_ITEM_NAME);
+                    context_item_scope = axiom_element_get_attribute_value_by_name(context_item_ele, env, FED_CONTEXT_ITEM_SCOPE);
+                    value_ele = axiom_element_get_first_element(context_item_ele, env, context_item_node, &value_node);
+                    
+                    context_item_value = axiom_element_get_text(value_ele, env, value_node);
+                    
+                    //printf("Value :%s\n", context_item_name);
+                    fed_auth_additional_context_create_ctx_item(fed_authorization_context->additional_context, env, context_item_name, context_item_value, context_item_scope);
+                    
+                }
+            }
+
+            return fed_authorization_context->additional_context;
+        }
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[fed] RST - Authorization Processing Failed");
+    }
+    
+    return NULL;
+}
+
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+fed_authorization_context_add_additional_context_to_rst(
+    fed_authorization_context_t *fed_authorization_context,
+    const axutil_env_t * env,
+    fed_auth_additional_context_t * additional_context,
+    axiom_node_t *rst_node)
+{
+    axutil_hash_index_t *hi = NULL;
+    void * val = NULL;
+    
+    axiom_namespace_t * wst_ns = NULL;
+    axiom_namespace_t * auth_ns = NULL;
+    
+    axiom_node_t * additional_context_node = NULL;
+    axiom_element_t * additional_context_ele = NULL;
+    
+    axiom_node_t * context_item_node = NULL;
+    axiom_element_t * context_item_ele = NULL;
+    axiom_attribute_t * ctx_item_name_attr = NULL;
+    axiom_node_t * value_node = NULL;
+    axiom_element_t * value_ele = NULL;
+    
+    fed_auth_context_item_t * context_item = NULL;
+    
+    
+    wst_ns = axiom_namespace_create(env, TRUST_WST_XMLNS_05_02, TRUST_WST);
+    auth_ns = axiom_namespace_create(env, FED_AUTH_XML_NS, FED_AUTH);
+    
+    fed_authorization_context->additional_context = additional_context;
+    additional_context_ele = axiom_element_create(env, rst_node, FED_ADDITIONAL_CONTEXT, auth_ns, &additional_context_node);
+    
+    for (hi = axutil_hash_first(fed_auth_additional_context_get_ctx_item_hash_table(fed_authorization_context->additional_context, env), env); 
+        hi; hi = axutil_hash_next(env, hi))
+    {
+         axutil_hash_this(hi, NULL, NULL, &val);
+         if(val)
+         {
+             context_item = (fed_auth_context_item_t*)val;
+             
+             if(context_item)
+             {  
+                 context_item_ele = axiom_element_create(env, additional_context_node, FED_CONTEXT_ITEM, auth_ns, &context_item_node);
+             
+                 ctx_item_name_attr = axiom_attribute_create(env, FED_CONTEXT_ITEM_NAME, 
+                     fed_auth_context_item_get_ctx_item_name(context_item, env), NULL);
+                 axiom_element_add_attribute(context_item_ele, env, ctx_item_name_attr, context_item_node);
+
+                 value_ele = axiom_element_create(env, context_item_node, FED_CONTEXT_ITEM_VALUE, auth_ns, &value_node);
+                 axiom_element_set_text(value_ele, env, fed_auth_context_item_get_ctx_item_value(context_item, env), value_node);
+             }
+
+         }
+    }
+    
+    if(additional_context_ele)
+        return AXIS2_SUCCESS;
+ 
+    return AXIS2_FAILURE;    
+}
+
+
+/*Populate CommonClaimDialect from RST-Node*/
+AXIS2_EXTERN fed_auth_common_claim_dialect_t * AXIS2_CALL
+fed_authorization_context_populate_common_claim_dialect(
+    fed_authorization_context_t *fed_authorization_context,
+    const axutil_env_t * env,
+    axiom_node_t *rst_node);
+
+/*Add Created ComnonClaimDialect to the given RST Node*/
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+fed_authorization_context_add_common_claim_dialect_to_rst(
+    fed_authorization_context_t *fed_authorization_context,
+    const axutil_env_t * env,
+    fed_auth_common_claim_dialect_t * common_claim_dialect,
+    axiom_node_t *rst_node)
+{
+    axutil_hash_index_t *hi = NULL;
+    void * val = NULL;
+    
+    axiom_namespace_t * wst_ns = NULL;
+    axiom_namespace_t * auth_ns = NULL;
+    
+    axiom_node_t * common_claim_dialect_node = NULL;
+    axiom_element_t * common_claim_dialect_ele = NULL;
+    
+    axiom_node_t * claim_type_node = NULL;
+    axiom_element_t * claim_type_ele = NULL;
+    axiom_attribute_t * claim_type_uri_attr = NULL;
+    axiom_node_t * value_node = NULL;
+    axiom_element_t * value_ele = NULL;
+    
+    fed_auth_claim_t * auth_claim = NULL;
+    
+    
+    wst_ns = axiom_namespace_create(env, TRUST_WST_XMLNS_05_02, TRUST_WST);
+    auth_ns = axiom_namespace_create(env, FED_AUTH_XML_NS, FED_AUTH);
+    
+    fed_authorization_context->common_claim_dialect = common_claim_dialect;
+    common_claim_dialect_ele = axiom_element_create(env, rst_node, FED_CCD_CLAIMS, auth_ns, &common_claim_dialect_node);
+    
+    for (hi = axutil_hash_first(fed_auth_common_claim_dialect_get_auth_claim_hash_table(fed_authorization_context->common_claim_dialect, env), env); 
+        hi; hi = axutil_hash_next(env, hi))
+    {
+         axutil_hash_this(hi, NULL, NULL, &val);
+         if(val)
+         {
+             auth_claim = (fed_auth_claim_t*)val;
+             
+             if(auth_claim)
+             {  
+                 claim_type_ele = axiom_element_create(env, common_claim_dialect_node, FED_CCD_CLAIM_TYPE, auth_ns, &claim_type_node);
+             
+                 claim_type_uri_attr = axiom_attribute_create(env, FED_ATTR_URI, 
+                     fed_auth_claim_get_claim_type_uri(auth_claim, env), NULL);
+                 axiom_element_add_attribute(claim_type_ele, env, claim_type_uri_attr, claim_type_node);
+
+                 value_ele = axiom_element_create(env, claim_type_node, FED_CONTEXT_ITEM_VALUE, auth_ns, &value_node);
+                 axiom_element_set_text(value_ele, env, fed_auth_claim_get_claim_value(auth_claim, env), value_node);
+             }
+
+         }
+    }
+    
+    if(common_claim_dialect_ele)
+        return AXIS2_SUCCESS;
+ 
+    return AXIS2_FAILURE;    
+}
+
+
+/*Populate CommonClaimDialect from RST-Node*/
+AXIS2_EXTERN fed_auth_common_claim_dialect_t * AXIS2_CALL
+fed_authorization_context_populate_common_claim_dialect(
+    fed_authorization_context_t *fed_authorization_context,
+    const axutil_env_t * env,
+    axiom_node_t *rst_node)
+{
+    axiom_element_t * rst_ele = NULL;
+    
+    axiom_node_t * common_claim_dialect_node = NULL;
+    axiom_element_t * common_claim_dialect_ele = NULL;
+    axutil_qname_t * common_claim_dialect_qname = NULL;
+    
+    axiom_node_t * claim_type_node = NULL;
+    axiom_element_t * claim_type_ele = NULL;
+    axutil_qname_t * claim_type_qname = NULL;
+    
+    axiom_node_t * value_node = NULL;
+    axiom_element_t * value_ele = NULL;
+    axutil_qname_t * value_qname = NULL;
+    
+    axiom_children_iterator_t *children_iter = NULL;
+    axiom_children_qname_iterator_t * children_qname_iter = NULL; 
+    
+    axis2_char_t * claim_type_uri = NULL;
+    axis2_char_t * claim_type_value = NULL;
+    axis2_char_t * claim_type_optional_flag = NULL;
+    
+    /*fed_auth_claim_t * auth_claim = NULL;*/
+    
+    if(NULL == rst_node)
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[fed] rst node NULL");
+        return NULL;
+    }
+    
+    rst_ele = axiom_node_get_data_element(rst_node, env);
+    fed_authorization_context->common_claim_dialect = fed_auth_common_claim_dialect_create(env);
+    
+    common_claim_dialect_qname = axutil_qname_create(env, FED_CCD_CLAIMS, fed_authorization_context->wst_ns, TRUST_WST_XMLNS_05_02);
+    claim_type_qname = axutil_qname_create(env, FED_CCD_CLAIM_TYPE, fed_authorization_context->auth_ns, FED_AUTH);
+    
+    common_claim_dialect_ele = axiom_element_get_first_child_with_qname(rst_ele, env, common_claim_dialect_qname, rst_node, &common_claim_dialect_node);
+    
+    if(common_claim_dialect_ele)
+    {        
+        
+        
+        children_qname_iter = axiom_element_get_children_with_qname(common_claim_dialect_ele, env, claim_type_qname, common_claim_dialect_node);
+        
+        if(NULL != children_qname_iter)
+        {
+            
+            while (axiom_children_qname_iterator_has_next(children_qname_iter, env))
+            {
+                claim_type_node = axiom_children_qname_iterator_next(children_qname_iter, env);
+                
+                claim_type_ele = axiom_node_get_data_element(claim_type_node, env);
+                //printf("iterating...\n");
+                
+                if(claim_type_node)
+                {
+                    claim_type_uri = axiom_element_get_attribute_value_by_name(claim_type_ele, env, FED_ATTR_URI);
+                    claim_type_optional_flag = axiom_element_get_attribute_value_by_name(claim_type_ele, env, FED_ATTR_OPTIONAL_FLAG);
+                    value_ele = axiom_element_get_first_element(claim_type_ele, env, claim_type_node, &value_node);
+                    
+                    claim_type_value = axiom_element_get_text(value_ele, env, value_node);
+                    
+                    //printf("Value :%s\n", context_item_name);
+                    fed_auth_common_claim_dialect_create_auth_claim(fed_authorization_context->common_claim_dialect, 
+                            env, claim_type_uri, claim_type_value, claim_type_optional_flag);
+                    
+                }
+            }
+
+            return fed_authorization_context->common_claim_dialect;
+        }
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[fed] RST - Authorization Processing Failed");
+    }
+    
+    return NULL;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

Added: webservices/rampart/scratch/c/fed/c/src/fed/common_claim_dialect.c
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/fed/c/src/fed/common_claim_dialect.c?rev=642897&view=auto
==============================================================================
--- webservices/rampart/scratch/c/fed/c/src/fed/common_claim_dialect.c (added)
+++ webservices/rampart/scratch/c/fed/c/src/fed/common_claim_dialect.c Sun Mar 30 23:25:17 2008
@@ -0,0 +1,204 @@
+/*
+ * 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 <fed_auth_common_claim_dialect.h>
+
+struct fed_auth_common_claim_dialect
+{
+    axutil_hash_t * auth_claims_hash_table;
+    axiom_node_t * common_claim_dialect_node;
+    axis2_char_t * dialect_uri;
+};
+
+
+AXIS2_EXTERN fed_auth_common_claim_dialect_t * AXIS2_CALL
+fed_auth_common_claim_dialect_create(
+    const axutil_env_t * env)
+{
+    fed_auth_common_claim_dialect_t * common_claim_dialect = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    common_claim_dialect = (fed_auth_common_claim_dialect_t *)  AXIS2_MALLOC(env->allocator, sizeof(fed_auth_common_claim_dialect_t));
+    if(NULL == common_claim_dialect)
+    {
+        return NULL;
+    }
+    
+    common_claim_dialect->auth_claims_hash_table = axutil_hash_make(env);
+    common_claim_dialect->common_claim_dialect_node = NULL;
+    common_claim_dialect->dialect_uri = NULL;
+    
+    return common_claim_dialect;
+}
+
+
+AXIS2_EXTERN void AXIS2_CALL
+fed_auth_common_claim_dialect_free(
+    fed_auth_common_claim_dialect_t *fed_auth_common_claim_dialect,
+    const axutil_env_t * env)
+{
+    if(NULL == fed_auth_common_claim_dialect)
+    {
+        return;
+    }
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    if(fed_auth_common_claim_dialect->auth_claims_hash_table)
+    {
+        axutil_hash_free(fed_auth_common_claim_dialect->auth_claims_hash_table, env);
+    }
+    
+    AXIS2_FREE(env->allocator, fed_auth_common_claim_dialect);
+    return;    
+}
+
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+fed_auth_common_claim_dialect_add_auth_claim(
+    fed_auth_common_claim_dialect_t * fed_auth_common_claim_dialect,
+    const axutil_env_t * env,
+    fed_auth_claim_t * auth_claim)
+{
+    if(auth_claim)
+    {
+        axutil_hash_set(fed_auth_common_claim_dialect->auth_claims_hash_table, 
+                fed_auth_claim_get_claim_type_uri(auth_claim, env),
+                AXIS2_HASH_KEY_STRING,
+                auth_claim);
+        return AXIS2_SUCCESS;
+    }
+    
+    return AXIS2_FAILURE;
+}
+
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+fed_auth_common_claim_dialect_create_auth_claim(
+    fed_auth_common_claim_dialect_t * fed_auth_common_claim_dialect,
+    const axutil_env_t * env,
+    axis2_char_t *claim_type_uri,
+    axis2_char_t *claim_type_value,
+    axis2_char_t *claim_type_optional)
+{
+    fed_auth_claim_t * auth_claim = NULL;
+    
+    if(fed_auth_common_claim_dialect)
+    {
+        auth_claim = fed_auth_claim_create(env);
+        fed_auth_claim_set_claim_optional_falg(auth_claim, env, claim_type_optional);
+        fed_auth_claim_set_claim_type_uri(auth_claim, env, claim_type_uri);
+        fed_auth_claim_set_claim_value(auth_claim, env, claim_type_value);
+                
+        if(auth_claim)
+        {
+            axutil_hash_set(fed_auth_common_claim_dialect->auth_claims_hash_table,
+                fed_auth_claim_get_claim_type_uri(auth_claim, env),
+                AXIS2_HASH_KEY_STRING,
+                auth_claim);
+            return AXIS2_SUCCESS;            
+        }
+        
+    }
+    return AXIS2_FAILURE;
+}
+
+
+AXIS2_EXTERN fed_auth_claim_t * AXIS2_CALL
+fed_auth_common_claim_dialect_get_ctx_item(
+    fed_auth_common_claim_dialect_t * fed_auth_common_claim_dialect,
+    const axutil_env_t * env,
+    axis2_char_t *auth_claim_uri)
+{
+    fed_auth_claim_t * auth_claim = NULL;
+
+    if(fed_auth_common_claim_dialect)
+    {
+        if(fed_auth_common_claim_dialect->auth_claims_hash_table)
+            auth_claim = (fed_auth_claim_t *)axutil_hash_get(fed_auth_common_claim_dialect->auth_claims_hash_table, auth_claim_uri, AXIS2_HASH_KEY_STRING);
+    }
+    
+    if(auth_claim)
+        return auth_claim;
+    
+    return NULL;
+}
+
+
+AXIS2_EXTERN axutil_hash_t * AXIS2_CALL
+fed_auth_common_claim_dialect_get_auth_claim_hash_table(
+    fed_auth_common_claim_dialect_t * fed_auth_common_claim_dialect,
+    const axutil_env_t * env)
+{
+    return fed_auth_common_claim_dialect->auth_claims_hash_table;
+}    
+    
+
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+fed_auth_common_claim_dialect_set_dialect_uri(
+    fed_auth_common_claim_dialect_t * fed_auth_common_claim_dialect,
+    const axutil_env_t * env,
+    axis2_char_t * dialect_uri)
+{
+    if(fed_auth_common_claim_dialect)
+    {
+        if(dialect_uri)
+        {
+            fed_auth_common_claim_dialect->dialect_uri = dialect_uri;
+            return AXIS2_SUCCESS;
+        }
+        return AXIS2_FAILURE;
+    }
+    
+    return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+fed_auth_common_claim_dialect_get_dialect_uri(
+    fed_auth_common_claim_dialect_t * fed_auth_common_claim_dialect,
+    const axutil_env_t * env)
+{
+    if (fed_auth_common_claim_dialect)
+    {
+        return fed_auth_common_claim_dialect->dialect_uri;
+    }
+    return NULL;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

Added: webservices/rampart/scratch/c/fed/c/src/fed/context_item.c
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/fed/c/src/fed/context_item.c?rev=642897&view=auto
==============================================================================
--- webservices/rampart/scratch/c/fed/c/src/fed/context_item.c (added)
+++ webservices/rampart/scratch/c/fed/c/src/fed/context_item.c Sun Mar 30 23:25:17 2008
@@ -0,0 +1,173 @@
+/*
+ * 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 <fed_context_item.h>
+
+struct fed_auth_context_item
+{
+    axis2_char_t * ctx_item_name;
+    axis2_char_t * ctx_item_scope;           /*Not frequently used*/
+    axis2_char_t * ctx_item_value;    
+};
+
+
+AXIS2_EXTERN fed_auth_context_item_t * AXIS2_CALL
+fed_auth_context_item_create(
+        const axutil_env_t * env)
+{
+    fed_auth_context_item_t * ctx_item = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    ctx_item = (fed_auth_context_item_t * ) AXIS2_MALLOC(env->allocator, sizeof(fed_auth_context_item_t));
+    
+    ctx_item->ctx_item_name = NULL;
+    ctx_item->ctx_item_scope = NULL;
+    ctx_item->ctx_item_value = NULL;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+fed_auth_context_item_free(
+    fed_auth_context_item_t *fed_auth_context_item,
+    const axutil_env_t * env)
+{
+    if(NULL == fed_auth_context_item)
+        return;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    AXIS2_FREE(env->allocator, fed_auth_context_item);
+    return;
+}
+
+
+/*ContextItem - @Name*/
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+fed_auth_context_item_get_ctx_item_name(
+    fed_auth_context_item_t *fed_auth_context_item,
+    const axutil_env_t *env)
+{
+    if(fed_auth_context_item)
+        return fed_auth_context_item->ctx_item_name;
+    return NULL;
+}
+
+
+
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+fed_auth_context_item_set_ctx_item_name(
+    fed_auth_context_item_t *fed_auth_context_item,                    
+    const axutil_env_t *env, 
+    axis2_char_t * ctx_item_name)
+{
+    if(fed_auth_context_item)
+    {
+        if(ctx_item_name)
+        {
+            fed_auth_context_item->ctx_item_name = ctx_item_name;
+            return AXIS2_SUCCESS;
+        }
+        return AXIS2_FAILURE;
+    }
+    return AXIS2_FAILURE;
+    
+}
+
+
+/*ContextItem - Value*/
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+fed_auth_context_item_get_ctx_item_value(
+    fed_auth_context_item_t *fed_auth_context_item,
+    const axutil_env_t *env)
+{
+     if(fed_auth_context_item)
+        return fed_auth_context_item->ctx_item_value;
+    return NULL;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+fed_auth_context_item_set_ctx_item_value(
+    fed_auth_context_item_t *fed_auth_context_item,
+    const axutil_env_t *env,
+    axis2_char_t * ctx_item_value)
+{
+    if(fed_auth_context_item)
+    {
+        if(ctx_item_value)
+        {
+            fed_auth_context_item->ctx_item_value = ctx_item_value;
+            return AXIS2_SUCCESS;
+        }
+        return AXIS2_FAILURE;
+    }
+    return AXIS2_FAILURE;
+}
+
+
+/*ContextItem - @Scope*/
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+fed_auth_context_item_get_ctx_item_scope(
+    fed_auth_context_item_t *fed_auth_context_item,
+    const axutil_env_t *env)
+{
+    if(fed_auth_context_item)
+        return fed_auth_context_item->ctx_item_scope;
+    return NULL;   
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+fed_auth_context_item_set_ctx_item_scope(
+    fed_auth_context_item_t *fed_auth_context_item,
+    const axutil_env_t *env,
+    axis2_char_t * ctx_item_scope)
+{
+    if(fed_auth_context_item)
+    {
+        if(ctx_item_scope)
+        {
+            fed_auth_context_item->ctx_item_scope = ctx_item_scope;
+            return AXIS2_SUCCESS;
+        }
+        return AXIS2_FAILURE;
+    }
+    return AXIS2_FAILURE;
+
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

Added: webservices/rampart/scratch/c/fed/c/src/fed/fed.c
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/fed/c/src/fed/fed.c?rev=642897&view=auto
==============================================================================
--- webservices/rampart/scratch/c/fed/c/src/fed/fed.c (added)
+++ webservices/rampart/scratch/c/fed/c/src/fed/fed.c Sun Mar 30 23:25:17 2008
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ * 	http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ */
+
+#include <fed.h>
+
+struct fed_s
+{
+    fed_federation_metadata_t *metadata;  
+
+    axis2_char_t *id;
+};
+
+AXIS2_EXTERN fed_t * AXIS2_CALL
+fed_create_with_met_file(axutil_env_t *env, axis2_char_t *file_name)
+{
+    fed_t *f = NULL;
+    axiom_document_t *document = NULL;
+    axiom_stax_builder_t *builder = NULL;
+    axiom_xml_reader_t *reader = NULL;
+    axiom_node_t *met_node = NULL;
+    fed_federation_metadata_t *metadata = fed_federation_metadata_create(env);
+    if (!metadata)
+        return NULL;
+
+    reader = axiom_xml_reader_create_for_file(env, file_name);
+    if (!reader)
+    {
+        fed_federation_metadata_free(metadata, env);        
+        return NULL;        
+    }
+    builder = axiom_stax_builder_create(env, reader);
+    if (!builder)
+    {
+        fed_federation_metadata_free(metadata, env);        
+        axiom_xml_reader_free(reader, env);
+        return NULL;        
+    }    
+    document = axiom_stax_builder_get_document(builder, env);
+    fed_node = axiom_document_build_all(document, env);    
+    if (!fed_node)
+    {
+        fed_federation_metadata_free(metadata, env);        
+        axiom_stax_builder_free(builder, env);
+        return NULL;
+    }        
+    return fed_create_with_xml_node(env, fed_node);
+}
+
+
+AXIS2_EXTERN fed_t * AXIS2_CALL
+fed_create_with_xml_node(axutil_env_t *env, axiom_node_t *node)
+{
+    axis2_status_t status = AXIS2_FAILURE;
+    fed_federation_metadata_t *metadata = NULL;
+    metadata = fed_federation_metadata_create(env); 
+    if (!metadata)
+        return NULL;
+
+    status = fed_federation_metadata_load_metadata(metadata, env, node);
+    if (status == AXIS2_FAILURE)
+        return NULL;
+
+    return fed_create_with_met(env, metadata);
+}
+
+AXIS2_EXTERN fed_t * AXIS2_CALL
+fed_create_with_met(axutil_env_t *env, fed_federation_metadata_t *metadata)
+{
+    fed_t *f = NULL;
+
+    f = AXIS2_MALLOC(env->allocator, sizeof(fed_t));
+    if (!f)
+        return NULL;
+
+    f->metadata = metadata;
+    return f;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+fed_free(fed_t *f, axutil_env_t *env)
+{
+    if (f->metadata)
+        fed_federation_metadata_free(f->metadata, env);
+
+    AXIS2_FREE(env->allocator, f);
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+fed_set_id(fed_t *f, axutil_env_t *env, axis2_char_t *id)
+{
+    if (!f)
+        return AXIS2_FAILURE;
+
+    if (f->id)
+        AXIS2_FREE(env->allocator, f->id);
+
+    f->id = axutil_strdup(env, id);
+    return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+fed_get_id(fed_t *f, axutil_env_t *env)
+{
+    if (!f)
+        return NULL;    
+    return f->id;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+fed_populate_svc_client(fed_t *f, 
+                        axutil_env_t *env, 
+                        axis2_svc_client_t *svc_client)
+{
+    fed_metadata_om_t *metadata = NULL;
+    axis2_endpoint_ref_t *endpoint_ref = NULL;
+    axis2_char_t *address = NULL;
+    axis2_options_t *options = NULL;
+
+    if (!f->metadata)
+        return AXIS2_FAILURE;
+
+    metadata = fed_federation_metadata_get_fed_metadata_om(f->metadata, env, f->id); 
+    if (!metadata)
+        return AXIS2_FAILURE;
+
+    options = axis2_options_create(env);
+    address = fed_metadata_om_get_token_issuer_epr(metadata, env);
+    if (address)
+    {        
+        endpoint_ref = axis2_endpoint_ref_create(env, address);                                    
+        axis2_options_set_to(options, env, endpoint_ref);        
+    }                            
+    return AXIS2_SUCCESS;
+}
+

Added: webservices/rampart/scratch/c/fed/c/src/fed/fed_federation_metadata.c
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/fed/c/src/fed/fed_federation_metadata.c?rev=642897&view=auto
==============================================================================
--- webservices/rampart/scratch/c/fed/c/src/fed/fed_federation_metadata.c (added)
+++ webservices/rampart/scratch/c/fed/c/src/fed/fed_federation_metadata.c Sun Mar 30 23:25:17 2008
@@ -0,0 +1,250 @@
+/*
+ * 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 <fed_federation_metadata.h>
+
+struct fed_federation_metadata
+{
+	axutil_hash_t *fed_om_hash_table;
+	axiom_node_t *metadata_node;
+
+};
+
+
+AXIS2_EXTERN fed_federation_metadata_t* AXIS2_CALL
+fed_federation_metadata_create(
+		const axutil_env_t * env)
+{
+	fed_federation_metadata_t *federation_metadata = NULL;
+
+	AXIS2_ENV_CHECK(env, NULL);
+
+	federation_metadata = (fed_federation_metadata_t*) AXIS2_MALLOC(env->allocator, sizeof(fed_federation_metadata_t));
+
+	if(!federation_metadata)
+	{
+		return NULL;
+	}
+
+	federation_metadata->metadata_node = NULL;
+	federation_metadata->fed_om_hash_table = axutil_hash_make(env);	/* Create hash table */
+
+	return federation_metadata;
+
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+fed_federation_metadata_free(
+		fed_federation_metadata_t *federation_metadata,
+		const axutil_env_t * env)
+{
+	if (!federation_metadata)
+		return;
+
+	AXIS2_ENV_CHECK(env, NULL);
+	
+	if(federation_metadata->fed_om_hash_table)
+	{
+		axutil_hash_free(federation_metadata->fed_om_hash_table, env);
+	}
+	
+	AXIS2_FREE(env->allocator, federation_metadata);
+	return;
+}
+
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+fed_federation_metadata_load_metadata(
+		fed_federation_metadata_t *federation_metadata,		
+		const axutil_env_t * env, 
+                axiom_node_t *metadata_node)
+{
+	axiom_node_t *local_child_node = NULL;
+
+	axiom_element_t *metadata_element = NULL;
+	axiom_children_iterator_t *children_iter = NULL;
+	
+	AXIS2_ENV_CHECK(env, NULL);
+
+	if(federation_metadata && metadata_node)
+	{
+		federation_metadata->metadata_node = metadata_node;
+	}
+
+	if(NULL == federation_metadata->metadata_node)
+	{
+		/* Return failure if metadata is NULL*/
+		return AXIS2_FAILURE;
+	}
+
+	/*Otherwise process the node*/
+	metadata_element = axiom_node_get_data_element(federation_metadata->metadata_node, env);	
+	children_iter = axiom_element_get_children(metadata_element, env, federation_metadata->metadata_node);
+
+	if(NULL != children_iter )
+	{
+		while(axiom_children_iterator_has_next(children_iter, env))
+		{
+			axiom_node_t *node = NULL;
+			axiom_element_t *ele = NULL;
+			fed_metadata_om_t *metadata_om = NULL;
+			
+			node = axiom_children_iterator_next(children_iter, env);
+
+			if(NULL != node)
+			{
+				ele = axiom_node_get_data_element(node, env);
+				if(axiom_node_get_node_type(node, env) == AXIOM_ELEMENT)
+				{
+					if(0 == axutil_strcmp(FED_FEDERATION, axiom_element_get_localname(ele, env)))
+					{
+						/* Extracting and creation of Federations Context/s for federation/s */
+						metadata_om = fed_metadata_om_create(node, env);
+						axutil_hash_set(federation_metadata->fed_om_hash_table, 
+								axiom_element_get_attribute_value_by_name(ele, env, FED_ATTR_FED_ID), 
+								AXIS2_HASH_KEY_STRING, 
+								metadata_om);
+					}
+
+				}
+			}
+
+		}
+	}
+
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+fed_federation_metadata_populate_all(
+		fed_federation_metadata_t *federation_metadata,
+		const axutil_env_t * env)
+{
+	axutil_hash_index_t *hi = NULL;
+	fed_metadata_om_t *metadata_om = NULL;
+	void* val;	
+	
+	for (hi = axutil_hash_first(federation_metadata->fed_om_hash_table, env); hi; hi = axutil_hash_next(env, hi))
+	{
+		axutil_hash_this(hi, NULL, NULL, &val);
+		if(val)
+		{
+			/* Populating each Metadata Context in the hash table */
+			metadata_om = (fed_metadata_om_t*)val;
+			fed_metadata_om_populate_metadata(metadata_om, env); /*Check Status*/
+		}
+
+	}
+
+
+}
+
+
+AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+fed_federation_metadata_build_all(
+		fed_federation_metadata_t *federation_metadata,
+		const axutil_env_t *env)
+{
+	axutil_hash_index_t *hi = NULL;
+	fed_metadata_om_t *metadata_om = NULL;
+	axiom_node_t *metadata_root_node = NULL;
+	axiom_element_t *metadata_root_element = NULL;
+	axiom_namespace_t *wsf_ns = NULL;
+	axiom_namespace_t *mex_ns = NULL;
+	axiom_namespace_t *wsa_ns = NULL;
+	axiom_namespace_t *wsse_ns = NULL;
+	axiom_namespace_t *ds_ns = NULL;
+
+	void* val;
+
+	if(federation_metadata)
+	{
+		wsf_ns = axiom_namespace_create(env, FED_FED_XML_NS, FED_WSF);
+		wsa_ns = axiom_namespace_create(env, FED_WSA_XMLNS, FED_WSA);
+		metadata_root_element =  axiom_element_create(env, NULL, FED_FEDERATION_METADATA, wsf_ns, &metadata_root_node);
+
+		axiom_element_declare_namespace(metadata_root_element, env, metadata_root_node, wsa_ns);
+
+		for (hi = axutil_hash_first(federation_metadata->fed_om_hash_table, env); hi; hi = axutil_hash_next(env, hi))
+		{
+			 axutil_hash_this(hi, NULL, NULL, &val);
+			 if(val)
+			 {
+				 metadata_om = (fed_metadata_om_t*)val;
+				 axiom_node_add_child(metadata_root_node, env,
+						 fed_metadata_om_build_metadata_om(metadata_om, env));
+
+			 }
+		}
+
+		return metadata_root_node;
+	}
+}
+
+
+AXIS2_EXTERN fed_metadata_om_t* AXIS2_CALL
+fed_federation_metadata_get_fed_metadata_om(
+		fed_federation_metadata_t *federation_metadata,
+                const axutil_env_t * env,
+                axis2_char_t *federation_id)
+{
+	fed_metadata_om_t *metadata_om = NULL;
+
+	AXIS2_ENV_CHECK(env, NULL);
+
+	metadata_om = (fed_metadata_om_t*) axutil_hash_get(federation_metadata->fed_om_hash_table, federation_id, AXIS2_HASH_KEY_STRING);
+
+	if(metadata_om)
+		return metadata_om;
+
+	return NULL;
+
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+