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/12/04 05:19:03 UTC
svn commit: r600787 [1/2] - in /webservices/rampart/scratch/c/trust/c:
include/ src/trust/
Author: milinda
Date: Mon Dec 3 20:19:02 2007
New Revision: 600787
URL: http://svn.apache.org/viewvc?rev=600787&view=rev
Log:
Added modifications to trust.
Added:
webservices/rampart/scratch/c/trust/c/include/trust_claims.h
webservices/rampart/scratch/c/trust/c/include/trust_entropy.h
webservices/rampart/scratch/c/trust/c/include/trust_life_time.h
webservices/rampart/scratch/c/trust/c/include/trust_rst.h
webservices/rampart/scratch/c/trust/c/include/trust_rstr.h
webservices/rampart/scratch/c/trust/c/src/trust/claims.c
webservices/rampart/scratch/c/trust/c/src/trust/entropy.c
webservices/rampart/scratch/c/trust/c/src/trust/life_time.c
webservices/rampart/scratch/c/trust/c/src/trust/rst.c (with props)
webservices/rampart/scratch/c/trust/c/src/trust/rstr.c
Modified:
webservices/rampart/scratch/c/trust/c/include/trust_util.h
webservices/rampart/scratch/c/trust/c/src/trust/token.c
webservices/rampart/scratch/c/trust/c/src/trust/util.c
Added: webservices/rampart/scratch/c/trust/c/include/trust_claims.h
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/c/include/trust_claims.h?rev=600787&view=auto
==============================================================================
--- webservices/rampart/scratch/c/trust/c/include/trust_claims.h (added)
+++ webservices/rampart/scratch/c/trust/c/include/trust_claims.h Mon Dec 3 20:19:02 2007
@@ -0,0 +1,93 @@
+/*
+* 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 TRUST_CLAIMS_H
+#define TRUST_CLAIMS_H
+
+#include <axutil_utils.h>
+#include <axiom.h>
+#include <trust_constants.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ typedef struct trust_claims trust_claims_t;
+
+ AXIS2_EXTERN trust_claims_t * AXIS2_CALL
+ trust_claims_create(
+ const axutil_env_t *env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ trust_claims_free(
+ trust_claims_t *claims,
+ const axutil_env_t *env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ trust_claims_deserialize(
+ trust_claims_t *claims,
+ const axutil_env_t *env,
+ axiom_node_t *claims_node);
+
+ AXIS2_EXTERN axiom_node_t * AXIS2_CALL
+ trust_claims_serialize(
+ trust_claims_t *claims,
+ const axutil_env_t *env,
+ axiom_node_t *parent);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ trust_claims_set_children(
+ trust_claims_t *claims,
+ const axutil_env_t *env,
+ axiom_children_iterator_t *children);
+
+ AXIS2_EXTERN axiom_children_iterator_t * AXIS2_CALL
+ trust_claims_get_children(
+ trust_claims_t *claims,
+ const axutil_env_t *env);
+
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ trust_claims_set_attr_dialect(
+ trust_claims_t *claims,
+ const axutil_env_t *env,
+ axis2_char_t *dialect_attr);
+
+ AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+ trust_claims_get_attr_dialect(
+ trust_claims_t *claims,
+ const axutil_env_t *env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ trust_claims_set_wst_ns_uri(
+ trust_claims_t *claims,
+ const axutil_env_t *env,
+ axis2_char_t *wst_ns_uri);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ trust_claims_get_wst_ns_uri(
+ trust_claims_t *claims,
+ const axutil_env_t *env);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*TRUST_CLAIMS_H*/
Added: webservices/rampart/scratch/c/trust/c/include/trust_entropy.h
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/c/include/trust_entropy.h?rev=600787&view=auto
==============================================================================
--- webservices/rampart/scratch/c/trust/c/include/trust_entropy.h (added)
+++ webservices/rampart/scratch/c/trust/c/include/trust_entropy.h Mon Dec 3 20:19:02 2007
@@ -0,0 +1,115 @@
+/*
+* 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 TRUST_ENTROPY_H
+#define TRUST_ENTROPY_H
+
+#include <axutil_utils.h>
+#include <axiom.h>
+#include <trust_constants.h>
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ #define BIN_SEC_ASSYM "http://schemas.xmlsoap.org/ws/2005/02/trust/AsymmetricKey"
+ #define BIN_SEC_SYM "http://schemas.xmlsoap.org/ws/2005/02/trust/SymmetricKey"
+ #define BIN_SEC_NONCE "http://schemas.xmlsoap.org/ws/2005/02/trust/Nonce"
+
+ typedef enum
+ {
+ BIN_SEC_TYPE_ERROR = -1,
+ ASYMMETRIC ,
+ SYMMETRIC,
+ NONCE
+ }trust_bin_sec_type_t;
+
+ typedef struct trust_entropy trust_entropy_t;
+
+ #define TRUST_BIN_SEC_TYPE_ATTR "Type"
+
+ AXIS2_EXTERN trust_entropy_t * AXIS2_CALL
+ trust_entropy_create(
+ const axutil_env_t *env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ trust_entropy_free(
+ trust_entropy_t *entropy,
+ const axutil_env_t *env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ trust_entropy_deserialize(
+ trust_entropy_t *entropy,
+ const axutil_env_t *env,
+ axiom_node_t *entropy_node);
+
+ AXIS2_EXTERN axiom_node_t * AXIS2_CALL
+ trust_entropy_serialize(
+ trust_entropy_t *entropy,
+ const axutil_env_t *env,
+ axiom_node_t *parent);
+
+ AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+ trust_entropy_get_binary_secret(
+ trust_entropy_t *entropy,
+ const axutil_env_t *env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ trust_entropy_set_binary_secret(
+ trust_entropy_t *entropy,
+ const axutil_env_t *env,
+ axis2_char_t *bin_sec);
+
+ AXIS2_EXTERN axiom_node_t * AXIS2_CALL
+ trust_entropy_get_other(
+ trust_entropy_t *entropy,
+ const axutil_env_t *env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ trust_entropy_set_other(
+ trust_entropy_t *entropy,
+ const axutil_env_t *env,
+ axiom_node_t *other_node);
+
+ AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+ trust_entropy_get_ns_uri(
+ trust_entropy_t *entropy,
+ const axutil_env_t *env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ trust_entropy_set_ns_uri(
+ trust_entropy_t *entropy,
+ const axutil_env_t *env,
+ axis2_char_t *ns_uri);
+
+ axis2_char_t * AXIS2_CALL
+ trust_entropy_get_str_for_bin_sec_type(
+ trust_bin_sec_type_t type,
+ const axutil_env_t *env);
+
+ trust_bin_sec_type_t AXIS2_CALL
+ trust_entropy_get_bin_sec_type_from_str(
+ axis2_char_t *str,
+ const axutil_env_t *env);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _TRUST_ENTROPY_H */
Added: webservices/rampart/scratch/c/trust/c/include/trust_life_time.h
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/c/include/trust_life_time.h?rev=600787&view=auto
==============================================================================
--- webservices/rampart/scratch/c/trust/c/include/trust_life_time.h (added)
+++ webservices/rampart/scratch/c/trust/c/include/trust_life_time.h Mon Dec 3 20:19:02 2007
@@ -0,0 +1,111 @@
+/*
+ * 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 TRUST_LIFE_TIME_H
+#define TRUST_LIFE_TIME_H
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <axutil_utils.h>
+#include <axutil_string.h>
+#include <axutil_base64.h>
+#include <axiom_soap.h>
+#include <axiom.h>
+#include <axis2_msg_ctx.h>
+#include <axis2_addr.h>
+#include <trust_constants.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ typedef struct trust_life_time trust_life_time_t;
+
+ AXIS2_EXTERN trust_life_time_t * AXIS2_CALL
+ trust_life_time_create(
+ const axutil_env_t *env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ trust_life_time_free(
+ trust_life_time_t *life_time,
+ const axutil_env_t *env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ trust_life_time_deserialize(
+ trust_life_time_t *life_time,
+ const axutil_env_t *env,
+ axiom_node_t *life_time_node);
+
+ AXIS2_EXTERN axiom_node_t *AXIS2_CALL
+ trust_life_time_serialize(
+ trust_life_time_t *life_time,
+ const axutil_env_t *env,
+ axiom_node_t *parent);
+
+ AXIS2_EXTERN int AXIS2_CALL
+ trust_life_time_get_ttl(
+ trust_life_time_t *life_time,
+ const axutil_env_t *env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ trust_life_time_set_ttl(
+ trust_life_time_t *life_time,
+ const axutil_env_t *env,
+ int ttl);
+
+ AXIS2_EXTERN axutil_date_time_t * AXIS2_CALL
+ trust_life_time_get_created(
+ trust_life_time_t *life_time,
+ const axutil_env_t *env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ trust_life_time_set_created(
+ trust_life_time_t *life_time,
+ const axutil_env_t *env,
+ axutil_date_time_t *created);
+
+ AXIS2_EXTERN axutil_date_time_t * AXIS2_CALL
+ trust_life_time_get_expires(
+ trust_life_time_t *life_time,
+ const axutil_env_t *env);
+
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ trust_life_time_set_expires(
+ trust_life_time_t *life_time,
+ const axutil_env_t *env,
+ axutil_date_time_t *expires);
+
+
+ AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+ trust_life_time_get_ns_uri(
+ trust_life_time_t *life_time,
+ const axutil_env_t *env);
+
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ trust_life_time_set_ns_uri(
+ trust_life_time_t *life_time,
+ const axutil_env_t *env,
+ axis2_char_t *ns_uri);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
Added: webservices/rampart/scratch/c/trust/c/include/trust_rst.h
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/c/include/trust_rst.h?rev=600787&view=auto
==============================================================================
--- webservices/rampart/scratch/c/trust/c/include/trust_rst.h (added)
+++ webservices/rampart/scratch/c/trust/c/include/trust_rst.h Mon Dec 3 20:19:02 2007
@@ -0,0 +1,144 @@
+/*
+ * 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 TRUST_RST_H
+#define TRUST_RST_H
+
+#include <axiom.h>
+#include <trust_constants.h>
+#include <trust_claims.h>
+#include <trust_entropy.h>
+#include <trust_life_time.h>
+#include <trust_util.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ typedef struct trust_rst trust_rst_t;
+
+ AXIS2_EXTERN trust_rst_t * AXIS2_CALL
+trust_rst_create(
+ const axutil_env_t *env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_rst_desiarialize(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ axiom_node_t *rst_node);
+
+ AXIS2_EXTERN axiom_node_t * AXIS2_CALL
+trust_rst_serialize(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ axiom_node_t *parent);
+
+ AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+trust_rst_get_attr_context(
+ trust_rst_t *rst,
+ const axutil_env_t *env);
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_rst_set_attr_context(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ axis2_char_t *attr_context);
+
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+trust_rst_get_token_type(
+ trust_rst_t *rst,
+ const axutil_env_t *env);
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_rst_set_token_type(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ axis2_char_t *token_type);
+
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+trust_rst_get_request_type(
+ trust_rst_t *rst,
+ const axutil_env_t *env);
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_rst_set_request_type(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ axis2_char_t *request_type);
+
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+trust_rst_get_applies_to_addr(
+ trust_rst_t *rst,
+ const axutil_env_t *env);
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_rst_set_appliesto(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ axis2_char_t *applies_to_addr);
+
+AXIS2_EXTERN trust_claims_t * AXIS2_CALL
+trust_rst_get_claims(
+ trust_rst_t *rst,
+ const axutil_env_t *env);
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_rst_set_claims(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ trust_claims_t *claims);
+
+AXIS2_EXTERN trust_entropy_t * AXIS2_CALL
+trust_rst_get_entropy(
+ trust_rst_t *rst,
+ const axutil_env_t *env);
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_rst_set_entropy(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ trust_entropy_t *entropy);
+
+AXIS2_EXTERN trust_life_time_t * AXIS2_CALL
+trust_rst_get_life_time(
+ trust_rst_t *rst,
+ const axutil_env_t *env);
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_rst_set_life_time(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ trust_life_time_t *life_time);
+
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+trust_rst_get_wst_ns_uri(
+ trust_rst_t *rst,
+ const axutil_env_t *env);
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_rst_set_wst_ns_uri(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ axis2_char_t *wst_ns_uri);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
Added: webservices/rampart/scratch/c/trust/c/include/trust_rstr.h
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/c/include/trust_rstr.h?rev=600787&view=auto
==============================================================================
--- webservices/rampart/scratch/c/trust/c/include/trust_rstr.h (added)
+++ webservices/rampart/scratch/c/trust/c/include/trust_rstr.h Mon Dec 3 20:19:02 2007
@@ -0,0 +1,43 @@
+
+/*
+ * 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 TRUST_RSTR_H
+#define TRUST_RSTR_H
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <axutil_utils.h>
+#include <axutil_string.h>
+#include <axutil_base64.h>
+#include <axiom_soap.h>
+#include <axiom.h>
+#include <trust_constants.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ typedef struct trust_rstr trust_rstr_t;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
\ No newline at end of file
Modified: webservices/rampart/scratch/c/trust/c/include/trust_util.h
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/c/include/trust_util.h?rev=600787&r1=600786&r2=600787&view=diff
==============================================================================
--- webservices/rampart/scratch/c/trust/c/include/trust_util.h (original)
+++ webservices/rampart/scratch/c/trust/c/include/trust_util.h Mon Dec 3 20:19:02 2007
@@ -63,7 +63,8 @@
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_create_rst_element(
const axutil_env_t * env,
- int wst_version,
+ axis2_char_t *wst_ns_uri,
+ axiom_node_t *parent,
axis2_char_t * context);
/**
@@ -80,7 +81,7 @@
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_create_rstr_element(
const axutil_env_t * env,
- int wst_version,
+ axis2_char_t *wst_ns_uri,
axis2_char_t * context);
/**
@@ -96,7 +97,7 @@
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_create_rstr_collection_element(
const axutil_env_t * env,
- int wst_version);
+ axis2_char_t *wst_ns_uri);
/**
* Create the RequestType Element for Issuance binding.
@@ -110,7 +111,7 @@
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_create_request_type_element(
const axutil_env_t * env,
- int wst_version,
+ axis2_char_t *wst_ns_uri,
axiom_node_t * parent_node,
axis2_char_t * request_type);
@@ -124,11 +125,11 @@
* @returns TokenType axiom node, NULL if error ocurred.
*/
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
- trust_util_create_token_type_element(
- const axutil_env_t * env,
- int wst_version,
- axiom_node_t * parent_node,
- axis2_char_t * token_type);
+trust_util_create_token_type_element(
+ const axutil_env_t * env,
+ axis2_char_t *wst_ns_uri,
+ axiom_node_t * parent_node,
+ axis2_char_t * token_type);
/**
* Create the AppliesTo Element for Issuance binding.
@@ -161,7 +162,7 @@
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_create_claims_element(
const axutil_env_t * env,
- int wst_version,
+ axis2_char_t *wst_ns_uri,
axiom_node_t * parent_node,
axiom_node_t * claims_content,
axis2_char_t * dialect_uri);
@@ -177,7 +178,7 @@
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_create_requested_security_token_element(
const axutil_env_t * env,
- int wst_version,
+ axis2_char_t *wst_ns_uri,
axiom_node_t * parent_node);
/**
@@ -191,7 +192,7 @@
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_create_requsted_proof_token_element(
const axutil_env_t * env,
- int wst_version,
+ axis2_char_t *wst_ns_uri,
axiom_node_t * parent_node);
/**
@@ -207,7 +208,7 @@
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_create_entropy_element(
const axutil_env_t * env,
- int wst_version,
+ axis2_char_t *wst_ns_uri,
axiom_node_t * parent_node);
/**
@@ -222,7 +223,7 @@
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_computed_key_element(
const axutil_env_t * env,
- int wst_version,
+ axis2_char_t *wst_ns_uri,
axiom_node_t * parent_node);
/**
@@ -238,7 +239,7 @@
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_create_binary_secret_element(
const axutil_env_t * env,
- int wst_version,
+ axis2_char_t *wst_ns_uri,
axiom_node_t * parent_node,
axis2_char_t * enc_secret,
axis2_char_t * bin_sec_type);
@@ -254,7 +255,7 @@
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_create_computed_key_algo_element(
const axutil_env_t * env,
- int wst_version,
+ axis2_char_t *wst_ns_uri,
axiom_node_t * parent_node,
axis2_char_t * algo_id);
@@ -269,7 +270,7 @@
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_create_key_size_element(
const axutil_env_t * env,
- int wst_version,
+ axis2_char_t *wst_ns_uri,
axiom_node_t * parent_node,
axis2_char_t * key_size);
@@ -284,7 +285,7 @@
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_create_key_type_element(
const axutil_env_t * env,
- int wst_version,
+ axis2_char_t *wst_ns_uri,
axiom_node_t * parent_node,
axis2_char_t * key_type);
@@ -300,7 +301,7 @@
trust_util_create_life_time_element(
const axutil_env_t * env,
axiom_node_t * parent_node,
- int wst_version,
+ axis2_char_t *wst_ns_uri,
int ttl);
/**
@@ -313,7 +314,7 @@
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_create_req_attached_reference_element(
const axutil_env_t * env,
- int wst_version,
+ axis2_char_t *wst_ns_uri,
axiom_node_t * parent_node);
/**
@@ -326,7 +327,7 @@
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_create_req_unattached_reference_element(
const axutil_env_t * env,
- const int version,
+ axis2_char_t *wst_ns_uri,
axiom_node_t * parent_node);
/**
@@ -340,7 +341,7 @@
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_create_encrypted_data_element(
const axutil_env_t * env,
- int wst_version,
+ axis2_char_t *wst_ns_uri,
axiom_node_t * parent_node,
axis2_char_t * enc_data);
@@ -355,7 +356,7 @@
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_create_renew_traget_element(
const axutil_env_t * env,
- int wst_version,
+ axis2_char_t *wst_ns_uri,
axiom_node_t * parent_node,
axiom_node_t * token_renew_pending_node);
@@ -369,7 +370,7 @@
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_create_allow_postdating_element(
const axutil_env_t * env,
- int wst_version,
+ axis2_char_t *wst_ns_uri,
axiom_node_t * parent_node);
/**
@@ -384,7 +385,7 @@
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_create_renewing_element(
const axutil_env_t * env,
- int wst_version,
+ axis2_char_t *wst_ns_uri,
axiom_node_t * parent_node,
trust_allow_t allow_flag,
trust_ok_t ok_flag);
@@ -400,7 +401,7 @@
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_create_cancel_target_element(
const axutil_env_t * env,
- int wst_version,
+ axis2_char_t *wst_ns_uri,
axiom_node_t * parent_node,
axiom_node_t * token_cancel_pending_node);
@@ -416,7 +417,7 @@
trust_util_create_validation_response_element(
const axutil_env_t * env,
axiom_node_t * parent_node,
- int wst_version,
+ axis2_char_t *wst_ns_uri,
axis2_char_t * code,
axis2_char_t * reason);
Added: webservices/rampart/scratch/c/trust/c/src/trust/claims.c
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/c/src/trust/claims.c?rev=600787&view=auto
==============================================================================
--- webservices/rampart/scratch/c/trust/c/src/trust/claims.c (added)
+++ webservices/rampart/scratch/c/trust/c/src/trust/claims.c Mon Dec 3 20:19:02 2007
@@ -0,0 +1,189 @@
+/*
+ * 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 <trust_claims.h>
+
+struct trust_claims
+{
+ axiom_children_iterator_t *children;
+
+ axis2_char_t *attr_dialect;
+
+ axis2_char_t *wst_ns_uri;
+};
+
+AXIS2_EXTERN trust_claims_t * AXIS2_CALL
+trust_claims_create(
+ const axutil_env_t *env)
+{
+ trust_claims_t *claims = NULL;
+
+ claims = (trust_claims_t*)AXIS2_MALLOC(env->allocator, sizeof(trust_claims_t));
+
+ claims->children = NULL;
+ claims->attr_dialect = NULL;
+ claims->wst_ns_uri = NULL;
+
+ return claims;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_claims_free(
+ trust_claims_t *claims,
+ const axutil_env_t *env)
+{
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_claims_deserialize(
+ trust_claims_t *claims,
+ const axutil_env_t *env,
+ axiom_node_t *claims_node)
+{
+ axiom_element_t *claims_ele = NULL;
+ axiom_children_iterator_t *children = NULL;
+ axis2_status_t status = AXIS2_FAILURE;
+ axis2_char_t *dialect_attr = NULL;
+
+ claims_ele = axiom_node_get_data_element(claims_node, env);
+
+ if(claims_ele)
+ {
+ children = axiom_element_get_children(claims_ele, env, claims_node);
+ if(children)
+ {
+ if(trust_claims_set_children(claims, env, children))
+ status = AXIS2_SUCCESS;
+ }
+
+ dialect_attr = axiom_element_get_attribute_value_by_name(claims_ele, env, TRUST_CLAIMS_DIALECT);
+ if(dialect_attr)
+ {
+ if(status && stattrust_claims_set_attr_dialect(claims, env, dialect_attr))
+ {
+ return AXIS2_SUCCESS;
+ }
+ }
+ }
+
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN axiom_node_t * AXIS2_CALL
+trust_claims_serialize(
+ trust_claims_t *claims,
+ const axutil_env_t *env,
+ axiom_node_t *parent)
+{
+ axiom_node_t *claims_node = NULL;
+ axiom_node_t *child = NULL;
+
+ claims_node = (axiom_node_t *)trust_util_create_claims_element(env, claims->wst_ns_uri, parent, claims->attr_dialect);
+ if(!claims_node)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] Claims Element creation failed!");
+ return NULL;
+ }
+
+ while(axiom_children_iterator_has_next(claims->children, env))
+ {
+ child = axiom_children_iterator_next(claims->children, env);
+ if(child)
+ {
+ if(!axiom_node_add_child(claims_node, env, child))
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] Claims node adding child failed!");
+ return NULL;
+ }
+ }
+
+ }
+
+ return claims_node;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_claims_set_children(
+ trust_claims_t *claims,
+ const axutil_env_t *env,
+ axiom_children_iterator_t *children)
+{
+ if(children)
+ {
+ claims->children = children;
+ return AXIS2_SUCCESS;
+ }
+
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN axiom_children_iterator_t * AXIS2_CALL
+trust_claims_get_children(
+ trust_claims_t *claims,
+ const axutil_env_t *env)
+{
+ return claims->children;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_claims_set_attr_dialect(
+ trust_claims_t *claims,
+ const axutil_env_t *env,
+ axis2_char_t *dialect_attr)
+{
+ if(dialect_attr)
+ {
+ claims->attr_dialect = dialect_attr;
+
+ return AXIS2_SUCCESS;
+ }
+
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+trust_claims_get_attr_dialect(
+ trust_claims_t *claims,
+ const axutil_env_t *env)
+{
+ return claims->attr_dialect;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_claims_set_wst_ns_uri(
+ trust_claims_t *claims,
+ const axutil_env_t *env,
+ axis2_char_t *wst_ns_uri)
+{
+ if(wst_ns_uri)
+ {
+ claims->wst_ns_uri = wst_ns_uri;
+
+ return AXIS2_SUCCESS;
+ }
+
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+trust_claims_get_wst_ns_uri(
+ trust_claims_t *claims,
+ const axutil_env_t *env)
+{
+ return claims->wst_ns_uri;
+}
Added: webservices/rampart/scratch/c/trust/c/src/trust/entropy.c
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/c/src/trust/entropy.c?rev=600787&view=auto
==============================================================================
--- webservices/rampart/scratch/c/trust/c/src/trust/entropy.c (added)
+++ webservices/rampart/scratch/c/trust/c/src/trust/entropy.c Mon Dec 3 20:19:02 2007
@@ -0,0 +1,281 @@
+/*
+ * 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 <trust_entropy.h>
+
+struct trust_entropy
+{
+ /* Boolean to specify the type of the entropy. Entropy can be either binary secret
+ * or encrypted key
+ */
+ axis2_bool_t bin_sec;
+
+ axis2_char_t *binary_secret;
+
+ trust_bin_sec_type_t binsec_type;
+
+ axiom_node_t *other;
+
+ axis2_char_t *ns_uri;
+
+};
+
+AXIS2_EXTERN trust_entropy_t * AXIS2_CALL
+trust_entropy_create(
+ const axutil_env_t *env)
+{
+ trust_entropy_t *entropy = NULL;
+
+ entropy = (trust_entropy_t*)AXIS2_MALLOC(env->allocator, sizeof(trust_entropy_t));
+
+ entropy->bin_sec = AXIS2_TRUE;
+ entropy->binary_secret = NULL;
+ entropy->binsec_type = SYMMETRIC;
+ entropy->other = NULL;
+ entropy->ns_uri = NULL;
+
+ return entropy;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_entropy_free(
+ trust_entropy_t *entropy,
+ const axutil_env_t *env)
+{
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_entropy_deserialize(
+ trust_entropy_t *entropy,
+ const axutil_env_t *env,
+ axiom_node_t *entropy_node)
+{
+ axutil_qname_t *bin_sec_qname = NULL;
+ axiom_element_t *entropy_ele = NULL;
+ axiom_node_t *bin_sec_node = NULL;
+ axiom_element_t *bin_sec_ele = NULL;
+ axis2_char_t *bin_sec = NULL;
+ axis2_char_t *binsec_type = NULL;
+ axiom_node_t *other_node = NULL;
+ axiom_element_t *other_ele = NULL;
+ axis2_status_t status = AXIS2_FAILURE;
+
+ entropy_ele = axiom_node_get_data_element(entropy_node, env);
+
+ if(entropy_ele)
+ {
+ bin_sec_qname = axutil_qname_create(env, TRUST_BINARY_SECRET, entropy->ns_uri, TRUST_WST);
+ if(!bin_sec_qname)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] BinarySecret Qname creation failed.");
+ return AXIS2_FAILURE;
+ }
+
+ bin_sec_ele = axiom_element_get_first_child_with_qname(entropy_ele, env, bin_sec_qname, entropy_node, &bin_sec_node);
+ if(bin_sec_ele)
+ {
+ bin_sec = axiom_element_get_text(bin_sec_ele, env, bin_sec_node);
+ status = trust_entropy_set_binary_secret(entropy, env, bin_sec);
+
+ binsec_type = axiom_element_get_attribute_value_by_name(bin_sec_ele, env, TRUST_BIN_SEC_TYPE_ATTR);
+ if(binsec_type)
+ {
+ entropy->binsec_type = trust_entropy_get_bin_sec_type_from_str(binsec_type, env); /* TODO*/
+ if(status == AXIS2_SUCCESS)
+ {
+ return AXIS2_SUCCESS;
+ }
+ }
+ }
+ else
+ {
+ other_ele = axiom_element_get_first_element(entropy_ele, env, entropy_node, &other_node);
+ if(other_ele)
+ {
+ entropy->bin_sec = AXIS2_FALSE;
+ entropy->other = other_node;
+
+ return AXIS2_SUCCESS;
+ }
+ }
+
+ }
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN axiom_node_t * AXIS2_CALL
+trust_entropy_serialize(
+ trust_entropy_t *entropy,
+ const axutil_env_t *env,
+ axiom_node_t *parent)
+{
+ axiom_node_t *entropy_node = NULL;
+ axiom_node_t *bin_sec_node = NULL;
+ axis2_char_t *bin_sec_type = NULL;
+
+ entropy_node = (axiom_node_t *)trust_util_create_entropy_element(env, entropy->ns_uri, parent);
+
+ if(entropy_node)
+ {
+ if(entropy->bin_sec == AXIS2_TRUE)
+ {
+ bin_sec_type = (axis2_char_t *)trust_entropy_get_str_for_bin_sec_type(entropy->binsec_type, env);
+ bin_sec_node = (axiom_node_t *)trust_util_create_binary_secret_element(env, entropy->ns_uri, entropy_node, entropy->binary_secret, bin_sec_type);
+ if(bin_sec_node)
+ {
+ return entropy_node;
+ }
+ }
+ else
+ {
+ if(AXIS2_SUCCESS == axiom_node_add_child(entropy_node, env, entropy->other))
+ {
+ return entropy_node;
+ }
+ }
+ }
+
+ return NULL;
+}
+
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+trust_entropy_get_binary_secret(
+ trust_entropy_t *entropy,
+ const axutil_env_t *env)
+{
+ if(entropy->bin_sec == AXIS2_TRUE)
+ {
+ return entropy->binary_secret;
+ }
+
+ return NULL;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_entropy_set_binary_secret(
+ trust_entropy_t *entropy,
+ const axutil_env_t *env,
+ axis2_char_t *bin_sec)
+{
+ if(bin_sec)
+ {
+ entropy->binary_secret = bin_sec;
+ entropy->bin_sec = AXIS2_TRUE;
+
+ return AXIS2_SUCCESS;
+ }
+
+ return AXIS2_FALSE;
+}
+
+AXIS2_EXTERN axiom_node_t * AXIS2_CALL
+trust_entropy_get_other(
+ trust_entropy_t *entropy,
+ const axutil_env_t *env)
+{
+ if(entropy->bin_sec == AXIS2_FALSE)
+ {
+ return entropy->other;
+ }
+
+ return NULL;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_entropy_set_other(
+ trust_entropy_t *entropy,
+ const axutil_env_t *env,
+ axiom_node_t *other_node)
+{
+ if(other_node)
+ {
+ entropy->bin_sec = AXIS2_FALSE;
+ entropy->other = other_node;
+
+ return AXIS2_SUCCESS;
+ }
+
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+trust_entropy_get_ns_uri(
+ trust_entropy_t *entropy,
+ const axutil_env_t *env)
+{
+ return entropy->ns_uri;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_entropy_set_ns_uri(
+ trust_entropy_t *entropy,
+ const axutil_env_t *env,
+ axis2_char_t *ns_uri)
+{
+ if(ns_uri)
+ {
+ entropy->ns_uri = ns_uri;
+
+ return AXIS2_SUCCESS;
+ }
+
+ return AXIS2_FAILURE;
+}
+
+trust_bin_sec_type_t AXIS2_CALL
+trust_entropy_get_bin_sec_type_from_str(
+ axis2_char_t *str,
+ const axutil_env_t *env)
+{
+ if(!axutil_strcmp(str, BIN_SEC_ASSYM))
+ {
+ return ASYMMETRIC;
+ }
+ else if(!axutil_strcmp(str, BIN_SEC_SYM))
+ {
+ return SYMMETRIC;
+ }
+ else if(!axutil_strcmp(str, BIN_SEC_NONCE))
+ {
+ return NONCE;
+ }
+
+ return BIN_SEC_TYPE_ERROR;
+}
+
+axis2_char_t * AXIS2_CALL
+trust_entropy_get_str_for_bin_sec_type(
+ trust_bin_sec_type_t type,
+ const axutil_env_t *env)
+{
+ if(type == ASYMMETRIC)
+ {
+ return axutil_strdup(env, BIN_SEC_ASSYM);
+ }
+ else if (type == SYMMETRIC)
+ {
+ return axutil_strdup(env, BIN_SEC_SYM);
+ }
+ else if (type == NONCE)
+ {
+ return axutil_strdup(env, BIN_SEC_NONCE);
+ }
+
+ return NULL;
+}
Added: webservices/rampart/scratch/c/trust/c/src/trust/life_time.c
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/c/src/trust/life_time.c?rev=600787&view=auto
==============================================================================
--- webservices/rampart/scratch/c/trust/c/src/trust/life_time.c (added)
+++ webservices/rampart/scratch/c/trust/c/src/trust/life_time.c Mon Dec 3 20:19:02 2007
@@ -0,0 +1,316 @@
+/*
+ * 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 <trust_life_time.h>
+
+struct trust_life_time
+{
+ int ttl;
+
+ axutil_date_time_t *created;
+
+ axutil_date_time_t *expires;
+
+ axis2_char_t *wst_ns_uri;
+};
+
+AXIS2_EXTERN trust_life_time_t * AXIS2_CALL
+trust_life_time_create(
+ const axutil_env_t *env)
+{
+ trust_life_time_t *life_time = NULL;
+
+ life_time = (trust_life_time_t*)AXIS2_MALLOC(env->allocator, sizeof(trust_life_time_t));
+
+ life_time->ttl = -1;
+ life_time->created = NULL;
+ life_time->expires = NULL;
+ life_time->wst_ns_uri = NULL;
+
+ return life_time;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_life_time_free(
+ trust_life_time_t *life_time,
+ const axutil_env_t *env)
+{
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_life_time_deserialize(
+ trust_life_time_t *life_time,
+ const axutil_env_t *env,
+ axiom_node_t *life_time_node)
+{
+ axiom_element_t *life_time_ele = NULL;
+ axutil_qname_t *created_qname = NULL;
+ axutil_qname_t *expires_qname = NULL;
+ axiom_element_t *created_ele = NULL;
+ axiom_element_t *expires_ele = NULL;
+ axiom_node_t *created_node = NULL;
+ axiom_node_t *expires_node = NULL;
+ axis2_char_t *created_str = NULL;
+ axis2_char_t *expires_str = NULL;
+ axutil_date_time_t *created = NULL;
+ axutil_date_time_t *expires = NULL;
+ axis2_status_t status = AXIS2_FAILURE;
+
+ life_time_ele = axiom_node_get_data_element(life_time_node, env);
+
+ if(life_time_ele)
+ {
+ created_qname = axutil_qname_create(env, TRUST_LIFE_TIME_CREATED, TRUST_WSU_XMLNS, TRUST_WSU);
+ if(created_qname)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] Created Qname creation failed.");
+ return AXIS2_FAILURE;
+ }
+
+ created_ele = axiom_element_get_first_child_with_qname(life_time_ele, env, created_qname, life_time_node, &created_node);
+ if(created_ele)
+ {
+ created_str = axiom_element_get_text(created_ele, env, created_node);
+ if(created_str)
+ {
+ created = axutil_date_time_create(env);
+ if(AXIS2_SUCCESS == axutil_date_time_deserialize_date_time(created, env, created_str))
+ {
+ life_time->created = created;
+ status = AXIS2_SUCCESS;
+ }
+ else
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] Deserializing created time failed.");
+ return AXIS2_FAILURE;
+ }
+ }
+ }
+
+ expires_qname = axutil_qname_create(env, TRUST_LIFE_TIME_EXPIRES, TRUST_WSU_XMLNS, TRUST_WSU);
+ if(created_qname)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] Expires Qname creation failed.");
+ return AXIS2_FAILURE;
+ }
+
+ expires_ele = axiom_element_get_first_child_with_qname(life_time_ele, env, expires_qname, life_time_node, &expires_node);
+ if(expires_ele)
+ {
+ expires_str = axiom_element_get_text(expires_ele, env, expires_node);
+ if(created_str)
+ {
+ expires = axutil_date_time_create(env);
+ if(AXIS2_SUCCESS == axutil_date_time_deserialize_date_time(expires, env, expires_str))
+ {
+ life_time->expires = expires;
+ status = AXIS2_SUCCESS;
+ }
+ else
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] Deserializing created time failed.");
+ return AXIS2_FAILURE;
+ }
+ }
+ }
+
+ if(status == AXIS2_SUCCESS)
+ return AXIS2_SUCCESS;
+ }
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN axiom_node_t *AXIS2_CALL
+trust_life_time_serialize(
+ trust_life_time_t *life_time,
+ const axutil_env_t *env,
+ axiom_node_t *parent)
+{
+ axiom_node_t *life_time_node = NULL;
+ axiom_node_t *created_node = NULL;
+ axiom_node_t *expires_node = NULL;
+ axiom_element_t *life_time_ele = NULL;
+ axiom_element_t *created_ele = NULL;
+ axiom_element_t *expires_ele = NULL;
+ axiom_namespace_t *wsu_ns = NULL;
+ axiom_namespace_t *wst_ns = NULL;
+ axis2_status_t status = AXIS2_SUCCESS;
+ axis2_char_t *created_str = NULL;
+ axis2_char_t *expires_str = NULL;
+
+ if(life_time->ttl != -1 && life_time->ttl>0)
+ {
+ life_time_node = (axiom_node_t *)trust_util_create_life_time_element(env, parent, life_time->wst_ns_uri, life_time->ttl);
+ if(!life_time_node)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] Life time element creation failed for ttl.");
+ return NULL;
+ }
+
+ return life_time_node;
+ }
+ else
+ {
+ if(life_time->created || life_time->expires)
+ {
+ wsu_ns = axiom_namespace_create(env, TRUST_WSU_XMLNS, TRUST_WSU);
+ wst_ns = axiom_namespace_create(env, life_time->wst_ns_uri, TRUST_WST);
+ life_time_ele = axiom_element_create(env, parent, TRUST_LIFE_TIME, wst_ns, &life_time_node);
+ if(life_time_ele)
+ {
+ if(life_time->created)
+ {
+ created_ele = axiom_element_create(env, life_time_node, TRUST_LIFE_TIME_CREATED, wsu_ns, &created_node);
+ if(created_ele)
+ {
+ created_str = axutil_date_time_serialize_date_time(life_time->created, env);
+ status = axiom_element_set_text(created_ele, env, created_str, created_node);
+ if (status == AXIS2_FAILURE)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[trust] Created Element's setting text failed.");
+ return NULL;
+ }
+
+ AXIS2_FREE(env->allocator, created_str);
+ }
+ }
+
+ if(life_time->expires)
+ {
+ expires_ele = axiom_element_create(env, life_time_node, TRUST_LIFE_TIME_EXPIRES, wsu_ns, &expires_node);
+ if(expires_ele)
+ {
+ expires_str = axutil_date_time_serialize_date_time(life_time->expires, env);
+ status = axiom_element_set_text(expires_ele, env, expires_str, expires_node);
+ if (status == AXIS2_FAILURE)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[trust] Expires Element's setting text failed.");
+ return NULL;
+ }
+
+ AXIS2_FREE(env->allocator, expires_str);
+ }
+ }
+
+ return life_time_node;
+ }
+ else
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] LifeTime element creation failed.");
+ return NULL;
+ }
+ }
+ }
+
+ return NULL;
+}
+
+AXIS2_EXTERN int AXIS2_CALL
+trust_life_time_get_ttl(
+ trust_life_time_t *life_time,
+ const axutil_env_t *env)
+{
+ return life_time->ttl;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_life_time_set_ttl(
+ trust_life_time_t *life_time,
+ const axutil_env_t *env,
+ int ttl)
+{
+ if(ttl>0)
+ {
+ life_time->ttl = ttl;
+ return AXIS2_SUCCESS;
+ }
+
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN axutil_date_time_t * AXIS2_CALL
+trust_life_time_get_created(
+ trust_life_time_t *life_time,
+ const axutil_env_t *env)
+{
+ return life_time->created;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_life_time_set_created(
+ trust_life_time_t *life_time,
+ const axutil_env_t *env,
+ axutil_date_time_t *created)
+{
+ if(created)
+ {
+ life_time->created = created;
+ return AXIS2_SUCCESS;
+ }
+
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN axutil_date_time_t * AXIS2_CALL
+trust_life_time_get_expires(
+ trust_life_time_t *life_time,
+ const axutil_env_t *env)
+{
+ return life_time->expires;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_life_time_set_expires(
+ trust_life_time_t *life_time,
+ const axutil_env_t *env,
+ axutil_date_time_t *expires)
+{
+ if(expires)
+ {
+ life_time->expires = expires;
+ return AXIS2_SUCCESS;
+ }
+
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+trust_life_time_get_ns_uri(
+ trust_life_time_t *life_time,
+ const axutil_env_t *env)
+{
+ return life_time->wst_ns_uri;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_life_time_set_ns_uri(
+ trust_life_time_t *life_time,
+ const axutil_env_t *env,
+ axis2_char_t *ns_uri)
+{
+ if(ns_uri)
+ {
+ life_time->wst_ns_uri = ns_uri;
+
+ return AXIS2_SUCCESS;
+ }
+
+ return AXIS2_FAILURE;
+}
Added: webservices/rampart/scratch/c/trust/c/src/trust/rst.c
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/c/src/trust/rst.c?rev=600787&view=auto
==============================================================================
--- webservices/rampart/scratch/c/trust/c/src/trust/rst.c (added)
+++ webservices/rampart/scratch/c/trust/c/src/trust/rst.c Mon Dec 3 20:19:02 2007
@@ -0,0 +1,601 @@
+/*
+ * 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 <trust_rst.h>
+
+struct trust_rst
+{
+ axis2_char_t *attr_context;
+
+ axis2_char_t *token_type;
+
+ axis2_char_t *request_type;
+
+ axis2_char_t *applies_to_addr;
+
+ trust_claims_t *claims;
+
+ trust_entropy_t *entropy;
+
+ trust_life_time_t *life_time;
+
+ axis2_char_t *key_type;
+
+ unsigned int key_size;
+
+ axis2_bool_t allow_postdating;
+
+ axis2_bool_t renewing;
+
+ axis2_bool_t attr_allow;
+
+ axis2_bool_t attr_ok;
+
+ axiom_node_t *renew_target;
+
+ axiom_node_t *cancel_target;
+
+ axis2_char_t *wst_ns_uri;
+
+ axis2_char_t *wsa_ns_uri;
+
+};
+
+AXIS2_EXTERN trust_rst_t * AXIS2_CALL
+trust_rst_create(
+ const axutil_env_t *env)
+{
+ trust_rst_t *rst = NULL;
+
+ rst = (trust_rst_t*)AXIS2_MALLOC(env->allocator, sizeof(trust_rst_t));
+
+ rst->attr_context = NULL;
+ rst->token_type = NULL;
+ rst->request_type = NULL;
+ rst->applies_to_addr = NULL;
+ rst->claims = NULL;
+ rst->entropy = NULL;
+ rst->life_time = NULL;
+ rst->key_type = NULL;
+ rst->key_size = -1;
+ rst->allow_postdating = AXIS2_FALSE;
+ rst->renewing = AXIS2_FALSE;
+ rst->attr_allow = AXIS2_FALSE;
+ rst->attr_ok = AXIS2_FALSE;
+ rst->renew_target = NULL;
+ rst->cancel_target = NULL;
+ rst->wst_ns_uri = NULL;
+ rst->wsa_ns_uri = NULL;
+
+
+ return rst;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_rst_desiarialize(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ axiom_node_t *rst_node)
+{
+ axiom_element_t *rst_ele = NULL;
+ axutil_qname_t *attr_ctx_qname = NULL;
+ axis2_char_t *attr_ctx = NULL;
+
+ axiom_node_t *token_type_node = NULL;
+ axiom_element_t *token_type_ele = NULL;
+ axutil_qname_t *token_type_qname = NULL;
+ axis2_char_t *token_type = NULL;
+
+ axiom_element_t *req_type_ele = NULL;
+ axiom_node_t *req_type_node = NULL;
+ axutil_qname_t *req_type_qname = NULL;
+ axis2_char_t *req_type = NULL;
+
+ axutil_qname_t *applies_to_qname = NULL;
+ axiom_node_t *appliesto_node = NULL;
+ axiom_element_t *appliesto_ele = NULL;
+ axiom_node_t *first_node = NULL;
+ axiom_element_t *first_ele = NULL;
+ axutil_qname_t *epr_addr_qname = NULL;
+
+ trust_claims_t *claims = NULL;
+ axiom_node_t *claims_node = NULL;
+ axiom_element_t *claims_ele = NULL;
+ axutil_qname_t *claims_qname = NULL;
+
+ trust_entropy_t *entropy = NULL;
+ axiom_node_t *entropy_node = NULL;
+ axiom_element_t *entropy_ele = NULL;
+ axutil_qname_t *entropy_qname = NULL;
+
+ trust_life_time_t *life_time = NULL;
+ axiom_node_t *lifetime_node = NULL;
+ axiom_element_t *lifetime_ele = NULL;
+ axutil_qname_t *lifetime_qname = NULL;
+
+ axiom_node_t *key_type_node = NULL;
+ axiom_element_t *key_type_ele = NULL;
+ axutil_qname_t *key_type_qname = NULL;
+ axis2_char_t *key_type = NULL;
+
+ axiom_node_t *key_size_node = NULL;
+ axiom_element_t *key_size_ele = NULL;
+ axutil_qname_t *key_size_qname = NULL;
+ axis2_char_t *key_size = NULL;
+
+ axiom_namespace_t *addressing_ns = NULL;
+
+ rst_ele = (axiom_element_t*)axiom_node_get_data_element(rst_node, env);
+
+ attr_ctx_qname = axutil_qname_create(env, TRUST_RST_CONTEXT, rst->wst_ns_uri, TRUST_WST);
+ if (!attr_ctx_qname)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] Context Attribute Qname creation failed.");
+ return AXIS2_FAILURE;
+ }
+
+ attr_ctx = axiom_element_get_attribute_value(rst_ele, env, attr_ctx_qname);
+
+ if (attr_ctx)
+ {
+ rst->attr_context = attr_ctx;
+ }
+
+ token_type_qname = axutil_qname_create(env, TRUST_TOKEN_TYPE, rst->wst_ns_uri, TRUST_WST);
+ if (!token_type_qname)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] TokenType Qname creation failed.");
+ return AXIS2_FAILURE;
+ }
+
+ token_type_ele = axiom_element_get_first_child_with_qname(rst_ele, env, token_type_qname, rst_node, &token_type_node);
+ if (token_type_ele)
+ {
+ token_type = axiom_element_get_text(token_type_ele, env, token_type_node);
+ if(token_type)
+ {
+ rst->token_type = token_type;
+ }
+ }
+
+ req_type_qname = axutil_qname_create(env, TRUST_REQUEST_TYPE, rst->wst_ns_uri, TRUST_WST);
+ if (!req_type_qname)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] RequestType Qname creation failed.");
+ return AXIS2_FAILURE;
+ }
+
+ req_type_ele = axiom_element_get_first_child_with_qname(rst_ele, env, req_type_qname, rst_node, &req_type_node);
+ if(req_type_ele)
+ {
+ req_type = axiom_element_get_text(req_type_ele, env, req_type_node);
+ if(req_type)
+ {
+ rst->request_type = req_type;
+ }
+ }
+
+ applies_to_qname = axutil_qname_create(env, TRUST_APPLIES_TO, TRUST_WSP_XMLNS, TRUST_WSP);
+ if (!applies_to_qname)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] Appliesto Qname creation failed.");
+ return AXIS2_FAILURE;
+ }
+
+ appliesto_ele = axiom_element_get_first_child_with_qname(rst_ele, env, applies_to_qname, rst_node, &appliesto_node);
+ if(appliesto_ele)
+ {
+ first_ele = axiom_element_get_first_element(appliesto_ele, env, appliesto_node, &first_node);
+
+ if (!rst->wsa_ns_uri)
+ {
+ addressing_ns = axiom_element_find_namespace(first_ele, env, first_node, "http://schemas.xmlsoap.org/ws/2004/08/addressing", NULL);
+ if(!addressing_ns)
+ {
+ addressing_ns = axiom_element_find_namespace(first_ele, env, first_node, "http://www.w3.org/2005/08/addressing", NULL);
+ }
+ if(addressing_ns)
+ {
+ rst->wsa_ns_uri = axiom_namespace_get_uri(addressing_ns, env);
+ }
+ }
+
+ if(first_ele && addressing_ns)
+ {
+ axiom_element_t *epr_ele = NULL;
+ axiom_node_t *epr_node = NULL;
+
+ epr_addr_qname = axutil_qname_create(env, EPR_ADDRESS, rst->wsa_ns_uri, NULL);
+ epr_ele = axiom_element_get_first_child_with_qname(first_ele, env, epr_addr_qname, first_node, &epr_node);
+
+ if (epr_ele && axiom_element_get_text(epr_ele, env, epr_node))
+ {
+ rst->applies_to_addr = axiom_element_get_text(epr_ele, env, epr_node);
+ }
+ }
+ }
+
+ claims_qname = axutil_qname_create(env, TRUST_CLAIMS, rst->wst_ns_uri, TRUST_WST);
+ if (!claims_qname)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] Claims Qname creation failed.");
+ return AXIS2_FAILURE;
+ }
+
+ claims_ele = axiom_element_get_first_child_with_qname(rst_ele, env, claims_qname, rst_node, &claims_node);
+ if (claims_ele)
+ {
+ if(AXIS2_SUCCESS == trust_claims_desiarialize(claims, env, claims_node))
+ {
+ rst->claims = claims;
+ }
+ }
+
+ entropy_qname = axutil_qname_create(env, TRUST_ENTROPY, rst->wst_ns_uri, TRUST_WST);
+ if (!entropy_qname)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] Entropy Qname creation failed.");
+ return AXIS2_FAILURE;
+ }
+
+ entropy_ele = axiom_element_get_first_child_with_qname(rst_ele, env, entropy_qname, rst_node, &entropy_node);
+ if(entropy_ele)
+ {
+ if(AXIS2_SUCCESS == trust_entropy_desiarialize(entropy, env, entropy_node))
+ {
+ rst->entropy = entropy;
+ }
+ }
+
+ lifetime_qname = axutil_qname_create(env, TRUST_LIFE_TIME, rst->wst_ns_uri, TRUST_WST);
+ if(!lifetime_qname)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] LifeTime Qname creation failed.");
+ return AXIS2_FAILURE;
+ }
+
+ lifetime_ele = axiom_element_get_first_child_with_qname(rst_ele, env, lifetime_qname, rst_node, &lifetime_node);
+ if(lifetime_ele)
+ {
+ if(AXIS2_SUCCESS == trust_lifetime_desiarialize(life_time, env, lifetime_node))
+ {
+ rst->life_time = life_time;
+ }
+ }
+
+ key_type_qname = axutil_qname_create(env, TRUST_KEY_TYPE, rst->wst_ns_uri, TRUST_WST);
+ if(!key_type_qname)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] KeyType Qname creation failed.");
+ return AXIS2_FAILURE;
+ }
+
+ key_type_ele = axiom_element_get_first_child_with_qname(rst_ele, env, key_type_qname, rst_node, &key_type_node);
+ if(key_type_ele)
+ {
+ key_type = axiom_element_get_text(key_type_ele, env, key_type_node);
+ if(key_type)
+ {
+ rst->key_type = key_type;
+ }
+ }
+
+ key_size_qname = axutil_qname_create(env, TRUST_KEY_SIZE, rst->wst_ns_uri, TRUST_WST);
+
+ key_size_ele = axiom_element_get_first_child_with_qname(rst_ele, env, key_size_qname, rst_node, &key_size_node);
+ if(key_size_ele)
+ {
+ key_size = axiom_element_get_text(key_size_ele, env, key_size_node);
+ if(key_size)
+ {
+ rst->key_size = atoi(key_size);
+ }
+ }
+
+ AXIS2_FREE(env->allocator, key_size_qname);
+ AXIS2_FREE(env->allocator, key_type_qname);
+ AXIS2_FREE(env->allocator, lifetime_qname);
+ AXIS2_FREE(env->allocator, entropy_qname);
+ AXIS2_FREE(env->allocator, claims_qname);
+ AXIS2_FREE(env->allocator, applies_to_qname);
+ AXIS2_FREE(env->allocator, req_type_qname);
+ AXIS2_FREE(env->allocator, token_type_qname);
+ AXIS2_FREE(env->allocator, attr_ctx_qname);
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axiom_node_t * AXIS2_CALL
+trust_rst_serialize(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ axiom_node_t *parent)
+{
+ axiom_node_t *rst_node = NULL;
+ axis2_char_t *key_size = NULL;
+
+ rst_node = trust_util_create_rst_element(env, rst->wst_ns_uri, parent, rst->attr_context);
+
+ if(rst_node)
+ {
+ if(rst->token_type || rst->applies_to_addr)
+ {
+ if(rst->token_type)
+ {
+ if(NULL == trust_util_create_token_type_element(env, rst->wst_ns_uri, rst_node, rst->token_type))
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] TokenType element creation failed.");
+ return NULL;
+ }
+ }
+
+ if(rst->applies_to_addr)
+ {
+ if(NULL == trust_util_create_applies_to_element(env, rst_node, rst->applies_to_addr, rst->wsa_ns_uri))
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] AppliesTo element creation failed.");
+ return NULL;
+ }
+ }
+ }
+ else
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] You must atleast give token type or applies to address.");
+ return NULL;
+ }
+
+ if(rst->request_type)
+ {
+ if(NULL == trust_util_create_request_type_element(env, rst->wst_ns_uri, rst_node, rst->request_type))
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] RequestType element creation failed.");
+ return NULL;
+ }
+ }
+
+ if(rst->claims)
+ {
+ if(NULL == trust_claims_serialize(rst->claims, env, rst_node))
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] Claims element creation failed.");
+ return NULL;
+ }
+ }
+
+ if(rst->entropy)
+ {
+ if(NULL == trust_entropy_serialize(rst->entropy, env, rst_node))
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] Entropy element creation failed.");
+ return NULL;
+ }
+ }
+
+ if(rst->life_time)
+ {
+ if(NULL == trust_life_time_serialize(rst->life_time, env, rst_node))
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] LifeTime element creation failed.");
+ return NULL;
+ }
+ }
+
+ if(rst->key_type)
+ {
+ if(NULL == trust_util_create_key_type_element(env, rst->wst_ns_uri, rst_node, rst->key_type))
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] KeyType element creation failed.");
+ return NULL;
+ }
+ }
+
+ if(rst->key_size != -1)
+ {
+ sprintf(key_size, "%d", rst->key_size);
+ if(NULL == trust_util_create_key_size_element(env, rst->wst_ns_uri, rst_node, key_size))
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] KeySize element creation failed.");
+ return NULL;
+ }
+ }
+ return rst_node;
+ }
+ return NULL;
+}
+
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+trust_rst_get_attr_context(
+ trust_rst_t *rst,
+ const axutil_env_t *env)
+{
+ return rst->attr_context;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_rst_set_attr_context(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ axis2_char_t *attr_context)
+{
+ if(attr_context)
+ {
+ rst->attr_context = attr_context;
+ return AXIS2_SUCCESS;
+ }
+
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+trust_rst_get_token_type(
+ trust_rst_t *rst,
+ const axutil_env_t *env)
+{
+ return rst->token_type;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_rst_set_token_type(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ axis2_char_t *token_type)
+{
+ if(token_type)
+ {
+ rst->token_type = token_type;
+ return AXIS2_SUCCESS;
+ }
+
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+trust_rst_get_request_type(
+ trust_rst_t *rst,
+ const axutil_env_t *env)
+{
+ return rst->request_type;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_rst_set_request_type(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ axis2_char_t *request_type)
+{
+ if(request_type)
+ {
+ rst->request_type = request_type;
+ return AXIS2_SUCCESS;
+ }
+
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+trust_rst_get_applies_to_addr(
+ trust_rst_t *rst,
+ const axutil_env_t *env)
+{
+ return rst->applies_to_addr;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_rst_set_appliesto(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ axis2_char_t *applies_to_addr)
+{
+ if(applies_to_addr)
+ {
+ rst->applies_to_addr = applies_to_addr;
+ return AXIS2_SUCCESS;
+ }
+
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN trust_claims_t * AXIS2_CALL
+trust_rst_get_claims(
+ trust_rst_t *rst,
+ const axutil_env_t *env)
+{
+ return rst->claims;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_rst_set_claims(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ trust_claims_t *claims)
+{
+ if(claims)
+ {
+ rst->claims = claims;
+ return AXIS2_SUCCESS;
+ }
+
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN trust_entropy_t * AXIS2_CALL
+trust_rst_get_entropy(
+ trust_rst_t *rst,
+ const axutil_env_t *env)
+{
+ return rst->entropy;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_rst_set_entropy(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ trust_entropy_t *entropy)
+{
+ if(entropy)
+ {
+ rst->entropy = entropy;
+ return AXIS2_SUCCESS;
+ }
+
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN trust_life_time_t * AXIS2_CALL
+trust_rst_get_life_time(
+ trust_rst_t *rst,
+ const axutil_env_t *env)
+{
+ return rst->life_time;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_rst_set_life_time(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ trust_life_time_t *life_time)
+{
+ if(life_time)
+ {
+ rst->life_time = life_time;
+ return AXIS2_SUCCESS;
+ }
+
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+trust_rst_get_wst_ns_uri(
+ trust_rst_t *rst,
+ const axutil_env_t *env)
+{
+ return rst->wst_ns_uri;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_rst_set_wst_ns_uri(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ axis2_char_t *wst_ns_uri)
+{
+ if(wst_ns_uri)
+ {
+ rst->wst_ns_uri = wst_ns_uri;
+ return AXIS2_SUCCESS;
+ }
+
+ return AXIS2_FAILURE;
+}
Propchange: webservices/rampart/scratch/c/trust/c/src/trust/rst.c
------------------------------------------------------------------------------
svn:executable = *
Added: webservices/rampart/scratch/c/trust/c/src/trust/rstr.c
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/c/src/trust/rstr.c?rev=600787&view=auto
==============================================================================
--- webservices/rampart/scratch/c/trust/c/src/trust/rstr.c (added)
+++ webservices/rampart/scratch/c/trust/c/src/trust/rstr.c Mon Dec 3 20:19:02 2007
@@ -0,0 +1,319 @@
+/*
+ * 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 <trust_rstr.h>
+
+struct trust_rstr{
+ axis2_char_t *token_type;
+
+ axis2_char_t *request_type;
+
+ axiom_node_t *requested_sec_token;
+
+ axis2_char_t *applies_to;
+
+ axiom_node_t *requested_attached_ref;
+
+ axiom_node_t *requested_unattached_ref;
+
+ axiom_node_t *requested_proof_token;
+
+ trust_entropy_t *entropy;
+
+ trust_life_time_t *life_time;
+
+ /*Use state whether response is going inside soap header or soap body*/
+ axis2_bool_t in_header;
+};
+
+AXIS2_EXTERN trust_rstr_t * AXIS2_CALL
+trust_rstr_create(
+ const axutil_env_t *env)
+{
+ trust_rstr_t *rstr = NULL;
+
+ rstr = (trust_rstr_t*)AXIS2_MALLOC(env->allocator, sizeof(trust_rstr_t));
+
+ rstr->token_type = NULL;
+ rstr->request_type = NULL;
+ rstr->requested_sec_token = NULL;
+ rstr->applies_to = NULL;
+ rstr->requested_attached_ref = NULL;
+ rstr->requested_unattached_ref = NULL;
+ rstr->requested_proof_token = NULL;
+ rstr->entropy = NULL;
+ rstr->life_time = NULL;
+
+ return rstr;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_rstr_free(
+ trust_rstr_t *rstr,
+ const axutil_env_t *env)
+{
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_rstr_deserialize(
+ trust_rstr_t *rstr,
+ const axutil_env_t *env,
+ axiom_node_t *rstr_node)
+{
+
+}
+
+AXIS2_EXTERN axiom_node_t * AXIS2_CALL
+trust_rstr_serialize(
+ trust_rstr_t *rstr,
+ const axutil_env_t *env,
+ axiom_node_t *parent)
+{
+
+
+}
+
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+trust_rstr_get_token_type(
+ trust_rstr_t *rstr,
+ const axutil_env_t *env)
+{
+ return rstr->token_type;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_rstr_set_token_type(
+ trust_rstr_t *rstr,
+ const axutil_env_t *env,
+ axis2_char_t *token_type)
+{
+ if(token_type)
+ {
+ rstr->token_type = token_type;
+
+ return AXIS2_SUCCESS;
+ }
+
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+trust_rstr_get_request_type(
+ trust_rstr_t *rstr,
+ const axutil_env_t *env)
+{
+ return rstr->request_type;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_rstr_set_request_type(
+ trust_rstr_t *rstr,
+ const axutil_env_t *env,
+ axis2_char_t *request_type)
+{
+ if(request_type)
+ {
+ rstr->request_type = request_type;
+ return AXIS2_SUCCESS;
+ }
+
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN axiom_node_t * AXIS2_CALL
+trust_rstr_get_requested_security_token(
+ trust_rstr_t *rstr,
+ const axutil_env_t *env)
+{
+ return rstr->requested_sec_token;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_rstr_set_requested_security_token(
+ trust_rstr_t *rstr,
+ const axutil_env_t *env,
+ axiom_node_t *security_token)
+{
+ if (security_token)
+ {
+ rstr->requested_sec_token = security_token;
+ return AXIS2_SUCCESS;
+ }
+
+ return AXIS2_FAILURE;
+
+}
+
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+trust_rstr_get_applies_to(
+ trust_rstr_t *rstr,
+ const axutil_env_t *env)
+{
+ return rstr->applies_to;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_rstr_set_applies_to(
+ trust_rstr_t *rstr,
+ const axutil_env_t *env,
+ axis2_char_t *applies_to)
+{
+ if (applies_to)
+ {
+ rstr->applies_to = applies_to;
+ return AXIS2_SUCCESS;
+ }
+
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN axiom_node_t * AXIS2_CALL
+trust_rstr_get_requested_attached_reference(
+ trust_rstr_t *rstr,
+ const axutil_env_t *env)
+{
+ return rstr->requested_attached_ref;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_rstr_set_requested_attached_reference(
+ trust_rstr_t *rstr,
+ const axutil_env_t *env,
+ axiom_node_t *ref_node)
+{
+ if (ref_node)
+ {
+ rstr->requested_attached_ref = ref_node;
+ return AXIS2_SUCCESS;
+ }
+
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN axiom_node_t * AXIS2_CALL
+trust_rstr_get_requested_unattached_reference(
+ trust_rstr_t *rstr,
+ const axutil_env_t *env)
+{
+ return rstr->requested_unattached_ref;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_rstr_set_requested_unattached_reference(
+ trust_rstr_t *rstr,
+ const axutil_env_t *env,
+ axiom_node_t *ref_node)
+{
+ if (ref_node)
+ {
+ rstr->requested_unattached_ref = ref_node;
+ return AXIS2_SUCCESS;
+ }
+
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN axiom_node_t * AXIS2_CALL
+trust_rstr_get_requested_proof_token(
+ trust_rstr_t *rstr,
+ const axutil_env_t *env)
+{
+ return rstr->requested_proof_token;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_rstr_set_requested_proof_token(
+ trust_rstr_t *rstr,
+ const axutil_env_t *env,
+ axiom_node_t *proof_token)
+{
+ if (proof_token)
+ {
+ rstr->requested_proof_token = proof_token;
+ return AXIS2_SUCCESS;
+ }
+
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN trust_entropy_t * AXIS2_CALL
+trust_rstr_get_entropy(
+ trust_rstr_t *rstr,
+ const axutil_env_t *env)
+{
+ return rstr->entropy;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_rstr_set_entropy(
+ trust_rstr_t *rstr,
+ const axutil_env_t *env,
+ trust_entropy_t *entropy)
+{
+ if (entropy)
+ {
+ rstr->entropy = entropy;
+ return AXIS2_SUCCESS;
+ }
+
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN trust_life_time_t AXIS2_CALL
+trust_rstr_get_life_time(
+ trust_rstr_t *rstr,
+ const axutil_env_t *env)
+{
+ return rstr->life_time;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_rstr_set_life_time(
+ trust_rstr_t *rstr,
+ const axutil_env_t *env,
+ trust_life_time_t *life_time)
+{
+ if (life_time)
+ {
+ rstr->life_time = life_time;
+ return AXIS2_SUCCESS;
+ }
+
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+trust_rstr_get_in_header(
+ trust_rstr_t *rstr,
+ const axutil_env_t *env)
+{
+ return rstr->in_header;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_rstr_set_in_header(
+ trust_rstr_t *rstr,
+ const axutil_env_t *env,
+ axis2_bool_t in_header)
+{
+ rstr->in_header = in_header;
+
+ return AXIS2_SUCCESS;
+}
+
+
Modified: webservices/rampart/scratch/c/trust/c/src/trust/token.c
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/c/src/trust/token.c?rev=600787&r1=600786&r2=600787&view=diff
==============================================================================
--- webservices/rampart/scratch/c/trust/c/src/trust/token.c (original)
+++ webservices/rampart/scratch/c/trust/c/src/trust/token.c Mon Dec 3 20:19:02 2007
@@ -124,11 +124,14 @@
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] Lifetime element processing failed.");
}
- } else
+ }
+/*
+ else
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] Cannot create trust token with null life element!");
return NULL;
}
+*/
return token;