You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rampart-dev@ws.apache.org by mi...@apache.org on 2007/10/15 08:30:34 UTC
svn commit: r584691 - in /webservices/rampart/scratch/c/trust: ./ include/
src/ src/sts_client/
Author: milinda
Date: Sun Oct 14 23:30:28 2007
New Revision: 584691
URL: http://svn.apache.org/viewvc?rev=584691&view=rev
Log:
WS Trust Implementation new stuff with utility functions.
Added:
webservices/rampart/scratch/c/trust/include/trust_sts_client.h (with props)
webservices/rampart/scratch/c/trust/include/trust_util.h (with props)
webservices/rampart/scratch/c/trust/src/sts_client/
webservices/rampart/scratch/c/trust/src/sts_client/client.c (with props)
webservices/rampart/scratch/c/trust/src/sts_client/sts_client.c (with props)
webservices/rampart/scratch/c/trust/src/util.c (with props)
Modified:
webservices/rampart/scratch/c/trust/compile_impls.sh
webservices/rampart/scratch/c/trust/include/trust_constants.h
webservices/rampart/scratch/c/trust/include/trust_data.h
webservices/rampart/scratch/c/trust/src/data.c
webservices/rampart/scratch/c/trust/src/sts.c
Modified: webservices/rampart/scratch/c/trust/compile_impls.sh
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/compile_impls.sh?rev=584691&r1=584690&r2=584691&view=diff
==============================================================================
--- webservices/rampart/scratch/c/trust/compile_impls.sh (original)
+++ webservices/rampart/scratch/c/trust/compile_impls.sh Sun Oct 14 23:30:28 2007
@@ -1,6 +1,6 @@
#!/bin/sh
-#create the service lib
+#create the customer issuer, validator, renewer, and canceler libs
gcc -g -I$AXIS2C_HOME/include/axis2-1.1 -I./include -shared ./src/issuer/*.c -o issuer.a -fPIC -DPIC -shared -lpthread -ldl -Wl,-soname -Wl,issuer.so -o issuer.so
gcc -g -I$AXIS2C_HOME/include/axis2-1.1 -I./include -shared ./src/validator/*.c -o validator.a -fPIC -DPIC -shared -lpthread -ldl -Wl,-soname -Wl,validator.so -o validator.so
Modified: webservices/rampart/scratch/c/trust/include/trust_constants.h
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/include/trust_constants.h?rev=584691&r1=584690&r2=584691&view=diff
==============================================================================
--- webservices/rampart/scratch/c/trust/include/trust_constants.h (original)
+++ webservices/rampart/scratch/c/trust/include/trust_constants.h Sun Oct 14 23:30:28 2007
@@ -48,20 +48,27 @@
#define TRUST_TIMESTAMP_CREATED "Created"
#define TRUST_TIMESTAMP_EXPIRES "Expires"
-#define TRUST_REQUEST_SECURITY_TOKEN "RequestSecurityToken"
-#define TRUST_REQUESTED_SECURITY_TOKEN "RequestedSecurityToken"
-#define TRUST_REQUEST_SECURITY_TOKEN_RESPONSE "RequestSecurityTokenResponse"
-#define TRUST_REQUESTED_ATTACH_REFERENCE "RequestedAttachedReference"
-#define TRUST_REQUESTED_PROOF_TOKEN "RequestedProofToken"
+#define TRUST_REQUEST_SECURITY_TOKEN "RequestSecurityToken"
+#define TRUST_REQUESTED_SECURITY_TOKEN "RequestedSecurityToken"
+#define TRUST_REQUEST_SECURITY_TOKEN_RESPONSE "RequestSecurityTokenResponse"
+#define TRUST_REQUESTED_ATTACH_REFERENCE "RequestedAttachedReference"
+#define TRUST_REQUESTED_PROOF_TOKEN "RequestedProofToken"
#define TRUST_REQUEST_SECURITY_TOKEN_RESPONSE_COLLECTION "RequestSecurityTokenResponseCollection"
-#define TRUST_REQUESTED_TOKEN_CANCELED "RequestedTokenCancelled"
-#define TRUST_COMPUTED_KEY_ALGO "ComputedKeyAlgorithm"
-#define TRUST_COMPUTED_KEY "ComputedKey"
-#define TRUST_REQUESTED_ATTACHED_REFERENCE "RequestedAttachedReference"
-#define TRUST_REQUESTED_UNATTACHED_REFERENCE "RequestedUnattachedReference"
-#define TRUST_REQUESTED_TOKEN_CANCELED "RequestedTokenCancelled"
-#define TRUST_CANCEL_TARGET "CancelTarget"
-#define TRUST_URI "URI"
+#define TRUST_REQUESTED_TOKEN_CANCELED "RequestedTokenCancelled"
+#define TRUST_COMPUTED_KEY_ALGO "ComputedKeyAlgorithm"
+#define TRUST_COMPUTED_KEY "ComputedKey"
+#define TRUST_REQUESTED_ATTACHED_REFERENCE "RequestedAttachedReference"
+#define TRUST_REQUESTED_UNATTACHED_REFERENCE "RequestedUnattachedReference"
+#define TRUST_REQUESTED_TOKEN_CANCELED "RequestedTokenCancelled"
+#define TRUST_CANCEL_TARGET "CancelTarget"
+#define TRUST_URI "URI"
+#define TRUST_EPR "EndpointReference"
+#define TRUST_EPR_ADDRESS "Address"
+ /* Request Types */
+#define TRUST_REQ_TYPE_ISSUE "/Issue"
+#define TRUST_REQ_TYPE_VALIDATE "/Validate"
+#define TRUST_REQ_TYPE_RENEW "/Renew"
+#define TRUST_REQ_TYPE_CANCEL "/Cancel"
/* Trust Namespace URIs and Namespace prefix */
#define TRUST_S11 "S11"
@@ -84,6 +91,17 @@
#define TRUST_WSA_XMLNS "http://schemas.xmlsoap.org/ws/2004/08/addressing"
#define TRUST_XS "xs"
#define TRUST_XS_XMLNS "http://www.w3.org/2001/XMLSchema"
+
+/* NS Versions */
+
+#define TRUST_VERSION_05_02 1
+#define TRUST_VERSION_05_12 2
+
+
+/* WS-SX Namespaces*/
+
+#define TRUST_WST_XMLNS_05_12 "http://docs.oasis-open.org/ws-sx/ws-trust/200512"
+#define TRUST_WST_XMLNS_05_02 "http://schemas.xmlsoap.org/ws/2005/02/trust"
#ifdef __cplusplus
}
Modified: webservices/rampart/scratch/c/trust/include/trust_data.h
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/include/trust_data.h?rev=584691&r1=584690&r2=584691&view=diff
==============================================================================
--- webservices/rampart/scratch/c/trust/include/trust_data.h (original)
+++ webservices/rampart/scratch/c/trust/include/trust_data.h Sun Oct 14 23:30:28 2007
@@ -1,93 +1,107 @@
-/*
- * 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_DATA
-#define TRUST_DATA
-
-/**
- * @file trust_data.h
- * @brief Holds function declarations and data for data
- */
-
-#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_data trust_data_t;
-
- AXIS2_EXPORT trust_data_t* AXIS2_CALL trust_data_create(
- const axis2_msg_ctx_t *in_msg_ctx,
- const axutil_env_t *env);
-
- AXIS2_EXPORT void AXIS2_CALL trust_data_free(
- trust_data_t *trust_data,
- const axutil_env_t *env);
-
- AXIS2_EXPORT axis2_status_t AXIS2_CALL trust_data_process_applies_to(
- trust_data_t *trust_data,
- const axutil_env_t *env);
-
- AXIS2_EXPORT axis2_status_t AXIS2_CALL trust_data_process_request_context(
- trust_data_t *trust_data,
- const axutil_env_t *env);
-
- AXIS2_EXPORT axis2_status_t AXIS2_CALL trust_data_process_request_type(
- trust_data_t *trust_data,
- const axutil_env_t *env);
-
- AXIS2_EXPORT axis2_status_t AXIS2_CALL trust_data_process_applies_to(
- trust_data_t *trust_data,
- const axutil_env_t *env);
-
- AXIS2_EXPORT axis2_status_t AXIS2_CALL trust_data_process_life_time(
- trust_data_t *trust_data,
- const axutil_env_t *env);
-
- AXIS2_EXPORT axis2_status_t AXIS2_CALL trust_data_process_claims(
- trust_data_t *trust_data,
- axutil_env_t *env);
-
- AXIS2_EXPORT axis2_status_t AXIS2_CALL trust_data_process_entorpy(
- trust_data_t *trust_data,
- const axutil_env_t *env);
-
- AXIS2_EXPORT axis2_status_t AXIS2_CALL trust_data_process_token_type(
- trust_data_t *trust_data,
- const axutil_env_t *env);
-
- AXIS2_EXPORT axis2_status_t AXIS2_CALL trust_data_process_entropy(
- trust_data_t *trust_data,
- const axutil_env_t *env);
-
-
-#ifdef __cplusplus
-}
-#endif
-#endif /*TRUST_DATA_H */
-
+/*
+ * 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_DATA
+#define TRUST_DATA
+
+/**
+ * @file trust_data.h
+ * @brief Holds function declarations and data for data
+ */
+
+#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_data trust_data_t;
+
+ AXIS2_EXPORT trust_data_t* AXIS2_CALL trust_data_create(
+ const axutil_env_t *env,
+ axiom_node_t *payload);
+
+ AXIS2_EXPORT void AXIS2_CALL trust_data_free(
+ trust_data_t *trust_data,
+ const axutil_env_t *env);
+
+ AXIS2_EXPORT axis2_status_t AXIS2_CALL trust_data_process_applies_to(
+ trust_data_t *trust_data,
+ const axutil_env_t *env);
+
+ AXIS2_EXPORT axis2_status_t AXIS2_CALL trust_data_process_request_context(
+ trust_data_t *trust_data,
+ const axutil_env_t *env);
+
+ AXIS2_EXPORT axis2_status_t AXIS2_CALL trust_data_process_request_type(
+ trust_data_t *trust_data,
+ const axutil_env_t *env);
+
+ AXIS2_EXPORT axis2_status_t AXIS2_CALL trust_data_process_applies_to(
+ trust_data_t *trust_data,
+ const axutil_env_t *env);
+
+ AXIS2_EXPORT axis2_status_t AXIS2_CALL trust_data_process_life_time(
+ trust_data_t *trust_data,
+ const axutil_env_t *env);
+
+ AXIS2_EXPORT axis2_status_t AXIS2_CALL trust_data_process_claims(
+ trust_data_t *trust_data,
+ axutil_env_t *env);
+
+ AXIS2_EXPORT axis2_status_t AXIS2_CALL trust_data_process_entorpy(
+ trust_data_t *trust_data,
+ const axutil_env_t *env);
+
+ AXIS2_EXPORT axis2_status_t AXIS2_CALL trust_data_process_token_type(
+ trust_data_t *trust_data,
+ const axutil_env_t *env);
+
+ AXIS2_EXPORT axis2_status_t AXIS2_CALL trust_data_process_entropy(
+ trust_data_t *trust_data,
+ const axutil_env_t *env);
+
+ AXIS2_EXPORT axis2_char_t* AXIS2_CALL trust_data_get_request_type(
+ trust_data_t *trust_data,
+ const axutil_env_t *env);
+
+ AXIS2_EXPORT axis2_char_t* AXIS2_CALL trust_data_get_soap_ns(
+ trust_data_t *trust_data,
+ const axutil_env_t *env);
+
+ AXIS2_EXPORT axis2_char_t* AXIS2_CALL trust_data_get_wst_ns(
+ trust_data_t *trust_data,
+ const axutil_env_t *env);
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /*TRUST_DATA_H */
+
Added: webservices/rampart/scratch/c/trust/include/trust_sts_client.h
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/include/trust_sts_client.h?rev=584691&view=auto
==============================================================================
--- webservices/rampart/scratch/c/trust/include/trust_sts_client.h (added)
+++ webservices/rampart/scratch/c/trust/include/trust_sts_client.h Sun Oct 14 23:30:28 2007
@@ -0,0 +1,70 @@
+/*
+* 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_STS_CLIENT
+#define TRUST_STS_CLIENT
+
+/**
+ * @file trust_sts_client.h
+ * @brief contains the specific sts client interface
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <axiom.h>
+#include <axutil_utils.h>
+#include <axis2_client.h>
+
+#include <trust_constants.h>
+#include <trust_util.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ typedef enum
+ {
+ ISSUE = 0,
+ VALIDATE,
+ RENEW,
+ CANCEL
+ } trust_request_type_t;
+
+ typedef struct trust_sts_client trust_sts_client_t;
+
+ AXIS2_EXPORT trust_sts_client_t* AXIS2_CALL trust_sts_client_create(
+ const axutil_env_t *env);
+
+ AXIS2_EXPORT void AXIS2_CALL trust_sts_client_free(
+ trust_sts_client_t* sts_client,
+ const axutil_env_t *env);
+
+ /* STS specific operations ------------------*/
+
+ /* ISSUE REQUEST */
+ AXIS2_EXPORT axiom_node_t* AXIS2_CALL trust_sts_client_create_issue_request(
+ trust_sts_client_t* sts_client,
+ const axutil_env_t *env,
+ axis2_char_t *applies_to);
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /*TRUST_STS_CLIENT_H */
Propchange: webservices/rampart/scratch/c/trust/include/trust_sts_client.h
------------------------------------------------------------------------------
svn:executable = *
Added: webservices/rampart/scratch/c/trust/include/trust_util.h
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/include/trust_util.h?rev=584691&view=auto
==============================================================================
--- webservices/rampart/scratch/c/trust/include/trust_util.h (added)
+++ webservices/rampart/scratch/c/trust/include/trust_util.h Sun Oct 14 23:30:28 2007
@@ -0,0 +1,85 @@
+/*
+ * 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_UTIL
+#define TRUST_UTIL
+
+/**
+ * @file trust_util.h
+ * @brief contains generic operations related to trust module
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <axiom.h>
+#include <axutil_utils.h>
+#include <axutil_string.h>
+
+#include <trust_constants.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /* Trust Specific Operations */
+ /* All the other elements wrap arounf RST : This is the root node for RST Message*/
+ AXIS2_EXPORT axiom_node_t* AXIS2_CALL trust_util_create_rst_element(
+ const axutil_env_t *env,
+ int version);
+
+ AXIS2_EXPORT axiom_node_t* AXIS2_CALL trust_util_create_request_type_element(
+ const axutil_env_t *env,
+ const int version,
+ axiom_node_t *parent_om_node,
+ const axis2_char_t *request_type);
+
+ AXIS2_EXPORT axiom_node_t* AXIS2_CALL trust_util_create_token_type_element(
+ const axutil_env_t *env,
+ const int version,
+ axiom_node_t *parent_om_node);
+
+ AXIS2_EXPORT axiom_node_t* AXIS2_CALL trust_util_requested_security_token_element(
+ const axutil_env_t *env,
+ const int version,
+ axiom_node_t *parent_node);
+
+ AXIS2_EXPORT axiom_node_t* AXIS2_CALL trust_util_create_applies_to_element(
+ const axutil_env_t *env,
+ axiom_node_t *parent_node,
+ const axis2_char_t *address,
+ const axis2_char_t *addressing_ns);
+
+
+ /* Internal Operation */
+ /* create generic axiom nodes - internal */
+ AXIS2_EXPORT axiom_node_t* AXIS2_CALL trust_util_create_om_node(
+ const axutil_env_t *env,
+ axiom_node_t *parent_om_node,
+ const axis2_char_t *ns,
+ const axis2_char_t *ln,
+ const axis2_char_t *prefix);
+
+ AXIS2_EXPORT axis2_char_t* AXIS2_CALL trust_util_get_wst_ns(
+ const axutil_env_t *env,
+ const int version);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /*TRUST_UTIL_H */
+
Propchange: webservices/rampart/scratch/c/trust/include/trust_util.h
------------------------------------------------------------------------------
svn:executable = *
Modified: webservices/rampart/scratch/c/trust/src/data.c
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/src/data.c?rev=584691&r1=584690&r2=584691&view=diff
==============================================================================
--- webservices/rampart/scratch/c/trust/src/data.c (original)
+++ webservices/rampart/scratch/c/trust/src/data.c Sun Oct 14 23:30:28 2007
@@ -18,7 +18,7 @@
struct trust_data {
/* in message context of STS */
- axis2_msg_ctx_t *in_msg_cntx;
+ axis2_msg_ctx_t *in_msg_ctx;
/* Axiom node which holds payload of RST message */
axiom_node_t *rst_node;
@@ -56,9 +56,6 @@
*/
axis2_char_t *claims_dialect;
- /* SOAP Namespace */
- axis2_char_t *soap_namespace;
-
/* WS-Trust Namespace */
axis2_char_t *wst_namespace;
@@ -67,34 +64,23 @@
};
AXIS2_EXPORT trust_data_t* AXIS2_CALL trust_data_create(
- const axis2_msg_ctx_t *in_msg_ctx,
- const axutil_env_t *env)
+ const axutil_env_t *env,
+ axiom_node_t *payload)
{
- axiom_soap_envelope_t *soap_env =NULL;
- axiom_soap_body_t *soap_body = NULL;
- axiom_namespace_t *soap_ns = NULL;
axiom_namespace_t *wst_ns = NULL;
- axiom_node_t *rst_node = NULL;
axiom_element_t *rst_ele = NULL;
trust_data_t *trust_data = (trust_data_t*)AXIS2_MALLOC(env->allocator, sizeof(trust_data_t));
- /* Processing Message Context */
- soap_env = axis2_msg_ctx_get_soap_envelope(in_msg_ctx, env);
- soap_body = axiom_soap_envelope_get_body(soap_env, env);
- rst_node = axiom_soap_body_get_base_node(soap_body, env);
- trust_data->rst_node = rst_node;
+ trust_data->rst_node = payload;
- /* Processing SOAP Namespace */
- soap_ns = axiom_soap_envelope_get_namespace(soap_env, env);
- trust_data->soap_namespace = axiom_namespace_get_uri(soap_ns, env);
/* Processing WS-Trust namespace */
- rst_ele = (axiom_element_t *)axiom_node_get_data_element(rst_node, env);
- wst_ns = axiom_element_get_namespace(rst_ele, env, rst_node);
+ rst_ele = (axiom_element_t *)axiom_node_get_data_element(trust_data->rst_node, env);
+ wst_ns = axiom_element_get_namespace(rst_ele, env, trust_data->rst_node);
trust_data->wst_namespace = axiom_namespace_get_uri(wst_ns, env);
@@ -395,7 +381,23 @@
return AXIS2_SUCCESS;
}
+AXIS2_EXPORT axis2_char_t* AXIS2_CALL trust_data_get_request_type(
+ trust_data_t *trust_data,
+ const axutil_env_t *env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ return trust_data->request_type;
+}
+
+AXIS2_EXPORT axis2_char_t* AXIS2_CALL trust_data_get_wst_ns(
+ trust_data_t *trust_data,
+ const axutil_env_t *env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return trust_data->wst_namespace;
+}
Modified: webservices/rampart/scratch/c/trust/src/sts.c
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/src/sts.c?rev=584691&r1=584690&r2=584691&view=diff
==============================================================================
--- webservices/rampart/scratch/c/trust/src/sts.c (original)
+++ webservices/rampart/scratch/c/trust/src/sts.c Sun Oct 14 23:30:28 2007
@@ -131,10 +131,15 @@
axiom_node_t *node,
axis2_msg_ctx_t *msg_ctx)
{
+ trust_data_t *trust_data = NULL;
+ axis2_char_t *om_str = NULL;
+ printf("\nInside Invoke");
if(node){
- if(msg_ctx){
-
- }
+ om_str = axiom_node_to_string(node, env);
+ printf("\nNode: %s", om_str);
+ trust_data = trust_data_create(env, node);
+ printf("\nRequest Type: %s\nWST NS: %s\n", trust_data_get_request_type(trust_data, env),
+ trust_data_get_wst_ns(trust_data, env));
}
return node;
}
Added: webservices/rampart/scratch/c/trust/src/sts_client/client.c
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/src/sts_client/client.c?rev=584691&view=auto
==============================================================================
--- webservices/rampart/scratch/c/trust/src/sts_client/client.c (added)
+++ webservices/rampart/scratch/c/trust/src/sts_client/client.c Sun Oct 14 23:30:28 2007
@@ -0,0 +1,90 @@
+#include <trust_sts_client.h>
+
+int main(
+ int argc,
+ char **argv)
+{
+ const axutil_env_t *env = NULL;
+ const axis2_char_t *address = NULL;
+ axis2_endpoint_ref_t *endpoint_ref = NULL;
+ axis2_options_t *options = NULL;
+ const axis2_char_t *client_home = NULL;
+ axis2_svc_client_t *svc_client = NULL;
+ axiom_node_t *payload = NULL;
+ axiom_node_t *ret_node = NULL;
+
+ trust_sts_client_t *sts_client = NULL;
+ axis2_char_t *appliesto = "http://people.apache.org/~milinda";
+
+ /* Set up the environment */
+ env = axutil_env_create_all("echo.log", AXIS2_LOG_LEVEL_TRACE);
+
+ /* Set end point reference of echo service */
+ address = "http://localhost:9091/axis2/services/STS";
+
+ endpoint_ref = axis2_endpoint_ref_create(env, address);
+
+ options = axis2_options_create(env);
+ axis2_options_set_to(options, env, endpoint_ref);
+ axis2_options_set_action(options, env, "http://schemas.xmlsoap.org/ws/2005/02/RST/issue");
+
+ client_home = AXIS2_GETENV("AXIS2C_HOME");
+ if (!client_home || !strcmp(client_home, ""))
+ client_home = "../..";
+
+ /* Create service client */
+ svc_client = axis2_svc_client_create(env, client_home);
+ if (!svc_client)
+ {
+ printf("Error creating service client, Please check AXIS2C_HOME again\n");
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Stub invoke FAILED: Error code:" " %d :: %s", env->error->error_number,
+ AXIS2_ERROR_GET_MESSAGE(env->error));
+ return -1;
+ }
+
+ /* Set service client options */
+ axis2_svc_client_set_options(svc_client, env, options);
+
+ /* Engage addressing module */
+ axis2_svc_client_engage_module(svc_client, env, AXIS2_MODULE_ADDRESSING);
+
+ sts_client = trust_sts_client_create(env);
+ payload = trust_sts_client_create_issue_request(sts_client, env, appliesto);
+
+ /* Send request */
+ ret_node = axis2_svc_client_send_receive(svc_client, env, payload);
+
+ axis2_char_t *om = NULL;
+ om = axiom_node_to_string(payload, env);
+ printf("\nPayload : %s\n", om);
+
+ if (ret_node)
+ {
+ axis2_char_t *om_str = NULL;
+ om_str = axiom_node_to_string(ret_node, env);
+ if (om_str)
+ printf("\nReceived OM : %s\n", om_str);
+ printf("\nSTS client invoke SUCCESSFUL!\n");
+ AXIS2_FREE(env->allocator, om_str);
+ ret_node = NULL;
+ }
+ else
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Stub invoke FAILED: Error code:" " %d :: %s", env->error->error_number,
+ AXIS2_ERROR_GET_MESSAGE(env->error));
+ printf("STS client invoke FAILED!\n");
+ }
+
+
+ if (svc_client)
+ {
+ axis2_svc_client_free(svc_client, env);
+ svc_client = NULL;
+ }
+ if (env)
+ {
+ axutil_env_free((axutil_env_t *) env);
+ env = NULL;
+ }
+ return 0;
+}
Propchange: webservices/rampart/scratch/c/trust/src/sts_client/client.c
------------------------------------------------------------------------------
svn:executable = *
Added: webservices/rampart/scratch/c/trust/src/sts_client/sts_client.c
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/src/sts_client/sts_client.c?rev=584691&view=auto
==============================================================================
--- webservices/rampart/scratch/c/trust/src/sts_client/sts_client.c (added)
+++ webservices/rampart/scratch/c/trust/src/sts_client/sts_client.c Sun Oct 14 23:30:28 2007
@@ -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.
+ */
+
+#include <trust_sts_client.h>
+
+struct trust_sts_client
+{
+ /*WS Trust version*/
+ int version;
+
+ /* Key size */
+ int key_size;
+
+ /* Time To Live */
+ int ttl;
+ /* FIX more attributes ...*/
+};
+
+AXIS2_EXPORT trust_sts_client_t* AXIS2_CALL trust_sts_client_create(
+ const axutil_env_t *env)
+{
+ trust_sts_client_t* sts_client = NULL;
+
+ sts_client = (trust_sts_client_t*)AXIS2_MALLOC(env->allocator, sizeof(trust_sts_client_t));
+
+ sts_client->version = TRUST_VERSION_05_02;
+
+ return sts_client;
+}
+
+AXIS2_EXPORT void AXIS2_CALL trust_sts_client_free(
+ trust_sts_client_t* sts_client,
+ const axutil_env_t *env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ if(sts_client)
+ {
+ AXIS2_FREE(env->allocator, sts_client);
+ }
+}
+
+AXIS2_EXPORT void AXIS2_CALL trust_sts_client_request_security_token(
+ trust_sts_client_t *sts_client)
+{
+ return;
+}
+
+
+AXIS2_EXPORT axiom_node_t* AXIS2_CALL trust_sts_client_create_issue_request(
+ trust_sts_client_t* sts_client,
+ const axutil_env_t *env,
+ axis2_char_t *applies_to)
+{
+ axiom_node_t *rst_node = NULL;
+
+ rst_node = trust_util_create_rst_element(env, sts_client->version);
+
+ /* Setting up the request type */
+ trust_util_create_request_type_element(env, sts_client->version, rst_node, TRUST_REQ_TYPE_ISSUE);
+
+ /* Setting up the token type */
+ trust_util_create_token_type_element(env, sts_client->version, rst_node);
+
+ return rst_node;
+}
+
Propchange: webservices/rampart/scratch/c/trust/src/sts_client/sts_client.c
------------------------------------------------------------------------------
svn:executable = *
Added: webservices/rampart/scratch/c/trust/src/util.c
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/src/util.c?rev=584691&view=auto
==============================================================================
--- webservices/rampart/scratch/c/trust/src/util.c (added)
+++ webservices/rampart/scratch/c/trust/src/util.c Sun Oct 14 23:30:28 2007
@@ -0,0 +1,238 @@
+/*
+ * 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_util.h"
+
+AXIS2_EXPORT axiom_node_t* AXIS2_CALL trust_util_create_rst_element(
+ const axutil_env_t *env,
+ int version)
+{
+ axis2_char_t *trust_ns = NULL;
+ axiom_node_t *root_node = NULL;
+
+ /* ? FIX Root Node is empty*/
+ root_node = axiom_node_create(env);
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ trust_ns = trust_util_get_wst_ns(env, version);
+
+ return trust_util_create_om_node(env, root_node, trust_ns, TRUST_REQUEST_SECURITY_TOKEN, TRUST_WST);
+}
+
+AXIS2_EXPORT axiom_node_t* AXIS2_CALL trust_util_create_request_type_element(
+ const axutil_env_t *env,
+ const int version,
+ axiom_node_t *parent_node,
+ const axis2_char_t *request_type)
+{
+ axis2_char_t *trust_ns = NULL;
+ axis2_char_t *req_type_str = NULL;
+ axiom_node_t *request_type_node = NULL;
+ axiom_element_t *request_type_ele = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ trust_ns = trust_util_get_wst_ns(env, version);
+
+ request_type_node = trust_util_create_om_node(env, parent_node, trust_ns, TRUST_REQUEST_TYPE, TRUST_WST);
+ request_type_ele = axiom_node_get_data_element(request_type_node, env);
+
+ if (0 == axutil_strcmp(request_type, TRUST_REQ_TYPE_ISSUE)||
+ 0 == axutil_strcmp(request_type, TRUST_REQ_TYPE_CANCEL)||
+ 0 == axutil_strcmp(request_type, TRUST_REQ_TYPE_RENEW)||
+ 0 == axutil_strcmp(request_type, TRUST_REQ_TYPE_VALIDATE))
+ {
+ req_type_str = axutil_stracat(env, trust_ns, request_type);
+ axiom_element_set_text(request_type_ele, env, req_type_str, request_type_node);
+ }else
+ {
+ axiom_element_set_text(request_type_ele, env, request_type, request_type_node);
+ }
+
+ return request_type_node;
+}
+
+
+AXIS2_EXPORT axiom_node_t* AXIS2_CALL trust_util_create_token_type_element(
+ const axutil_env_t *env,
+ const int version,
+ axiom_node_t *parent_om_node)
+{
+ axis2_char_t *trust_ns = NULL;
+ AXIS2_ENV_CHECK(env, NULL);
+
+ trust_ns = trust_util_get_wst_ns(env, version);
+
+ return trust_util_create_om_node(env, parent_om_node, trust_ns, TRUST_TOKEN_TYPE, TRUST_WST);
+}
+
+
+
+AXIS2_EXPORT axiom_node_t* AXIS2_CALL trust_util_create_applies_to_element(
+ const axutil_env_t *env,
+ axiom_node_t *parent_node,
+ const axis2_char_t *address,
+ const axis2_char_t *addressing_ns)
+{
+ axiom_node_t *applies_to_node = NULL;
+ axiom_node_t *epr_node = NULL; /* End Point Reference */
+ axiom_node_t *addr_node = NULL;
+ axiom_element_t *addr_ele = NULL;
+
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ applies_to_node = trust_util_create_om_node(env, parent_node,
+ TRUST_WSP_XMLNS, TRUST_APPLIES_TO, TRUST_WSP);
+
+
+ epr_node = trust_util_create_om_node(env, applies_to_node,
+ addressing_ns, TRUST_EPR,
+ TRUST_WSA);
+
+ addr_node = trust_util_create_om_node(env, epr_node, addressing_ns, TRUST_EPR_ADDRESS, TRUST_WSA);
+
+ addr_ele = axiom_node_get_data_element(addr_node, env);
+ axiom_element_set_text(addr_ele, env, address, addr_node);
+
+ return applies_to_node;
+}
+
+AXIS2_EXPORT axiom_node_t* AXIS2_CALL trust_util_requested_security_token_element(
+ const axutil_env_t *env,
+ const int version,
+ axiom_node_t *parent_node)
+{
+ axis2_char_t *wst_ns_str = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ wst_ns_str = trust_util_get_wst_ns(env, version);
+
+ return trust_util_create_om_node(env, parent_node, wst_ns_str, TRUST_REQUESTED_SECURITY_TOKEN, TRUST_WST);
+}
+
+AXIS2_EXPORT axiom_node_t* AXIS2_CALL trust_util_create_requsted_proof_token_element(
+ const axutil_env_t *env,
+ const int version,
+ axiom_node_t *parent_node)
+{
+ axis2_char_t *wst_ns = NULL;
+ AXIS2_ENV_CHECK(env, NULL);
+
+ wst_ns = trust_util_get_wst_ns(env, version);
+
+ return trust_util_create_om_node(env, parent_node, wst_ns, TRUST_REQUESTED_PROOF_TOKEN, TRUST_WST);
+}
+
+AXIS2_EXPORT axiom_node_t* AXIS2_CALL trust_util_create_entropy_element(
+ const axutil_env_t *env,
+ const int version,
+ axiom_node_t *parent_node)
+{
+ axis2_char_t *wst_ns = NULL;
+ AXIS2_ENV_CHECK(env, NULL);
+
+ wst_ns = trust_util_get_wst_ns(env, version);
+
+ return trust_util_create_om_node(env, parent_node, wst_ns, TRUST_ENTROPY, TRUST_WST);
+}
+
+AXIS2_EXPORT axiom_node_t* AXIS2_CALL trust_util_computed_key_element(
+ const axutil_env_t *env,
+ const int version,
+ axiom_node_t *parent_node)
+{
+ axis2_char_t *wst_ns = NULL;
+ AXIS2_ENV_CHECK(env, NULL);
+
+ wst_ns = trust_util_get_wst_ns(env, version);
+
+ return trust_util_create_om_node(env, parent_node, wst_ns, TRUST_COMPUTED_KEY, TRUST_WST);
+}
+
+
+AXIS2_EXPORT axiom_node_t* AXIS2_CALL trust_util_create_om_node(
+ const axutil_env_t *env,
+ axiom_node_t *parent_om_node,
+ const axis2_char_t *ns,
+ const axis2_char_t *ln,
+ const axis2_char_t *prefix)
+{
+ axiom_node_t *util_om_node = NULL;
+ axiom_element_t *util_om_ele = NULL;
+ axiom_namespace_t *util_ns = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ util_ns = axiom_namespace_create(env, ns, prefix);
+ util_om_ele = axiom_element_create(env, parent_om_node, ln, util_ns, &util_om_node);
+
+ return util_om_node;
+}
+
+
+AXIS2_EXPORT axis2_char_t* AXIS2_CALL trust_util_get_wst_ns(
+ const axutil_env_t *env,
+ const int version)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ switch(version)
+ {
+ case TRUST_VERSION_05_02:
+ return TRUST_WST_XMLNS_05_02;
+ case TRUST_VERSION_05_12:
+ return TRUST_WST_XMLNS_05_12;
+ default:
+ return NULL;
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Propchange: webservices/rampart/scratch/c/trust/src/util.c
------------------------------------------------------------------------------
svn:executable = *