You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rampart-dev@ws.apache.org by su...@apache.org on 2007/12/10 06:31:45 UTC
svn commit: r602779 [1/2] - in /webservices/rampart/scratch/c/trust/c: ./
include/ samples/trust/ samples/trust/sts/ samples/trust/sts_client/
src/trust/
Author: supun
Date: Sun Dec 9 21:31:33 2007
New Revision: 602779
URL: http://svn.apache.org/viewvc?rev=602779&view=rev
Log:
Applied Kasun's patch RAMPART-39 Attachment 6
Added:
webservices/rampart/scratch/c/trust/c/samples/trust/
webservices/rampart/scratch/c/trust/c/samples/trust/sts/
webservices/rampart/scratch/c/trust/c/samples/trust/sts/issuer.c (with props)
webservices/rampart/scratch/c/trust/c/samples/trust/sts/saml_issuer.h (with props)
webservices/rampart/scratch/c/trust/c/samples/trust/sts/saml_skeleton.c (with props)
webservices/rampart/scratch/c/trust/c/samples/trust/sts/services.xml (with props)
webservices/rampart/scratch/c/trust/c/samples/trust/sts/sts_test.sh (with props)
webservices/rampart/scratch/c/trust/c/samples/trust/sts_client/
webservices/rampart/scratch/c/trust/c/samples/trust/sts_client/client.c (with props)
webservices/rampart/scratch/c/trust/c/samples/trust/sts_client/client.xml (with props)
webservices/rampart/scratch/c/trust/c/samples/trust/sts_client/compile_sts_client.sh (with props)
webservices/rampart/scratch/c/trust/c/samples/trust/sts_client/service.xml (with props)
Modified:
webservices/rampart/scratch/c/trust/c/build.sh
webservices/rampart/scratch/c/trust/c/include/trust_claims.h
webservices/rampart/scratch/c/trust/c/include/trust_constants.h
webservices/rampart/scratch/c/trust/c/include/trust_context.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_sts_client.h
webservices/rampart/scratch/c/trust/c/include/trust_util.h
webservices/rampart/scratch/c/trust/c/src/trust/Makefile.am
webservices/rampart/scratch/c/trust/c/src/trust/claims.c
webservices/rampart/scratch/c/trust/c/src/trust/context.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/sts_client.c
webservices/rampart/scratch/c/trust/c/src/trust/token.c
webservices/rampart/scratch/c/trust/c/src/trust/util.c
Modified: webservices/rampart/scratch/c/trust/c/build.sh
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/c/build.sh?rev=602779&r1=602778&r2=602779&view=diff
==============================================================================
--- webservices/rampart/scratch/c/trust/c/build.sh (original)
+++ webservices/rampart/scratch/c/trust/c/build.sh Sun Dec 9 21:31:33 2007
@@ -1,6 +1,6 @@
#!/bin/bash
set -e
./autogen.sh
-./configure --prefix=${AXIS2C_HOME} --enable-static=no --with-axis2=${AXIS2C_HOME}/include/axis2-1.1
+./configure --prefix=${AXIS2C_HOME} --enable-static=no --with-axis2=${AXIS2C_HOME}/include/axis2-1.2
make
make install
Modified: 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=602779&r1=602778&r2=602779&view=diff
==============================================================================
--- webservices/rampart/scratch/c/trust/c/include/trust_claims.h (original)
+++ webservices/rampart/scratch/c/trust/c/include/trust_claims.h Sun Dec 9 21:31:33 2007
@@ -20,6 +20,7 @@
#include <axutil_utils.h>
#include <axiom.h>
+
#include <trust_constants.h>
#ifdef __cplusplus
Modified: webservices/rampart/scratch/c/trust/c/include/trust_constants.h
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/c/include/trust_constants.h?rev=602779&r1=602778&r2=602779&view=diff
==============================================================================
--- webservices/rampart/scratch/c/trust/c/include/trust_constants.h (original)
+++ webservices/rampart/scratch/c/trust/c/include/trust_constants.h Sun Dec 9 21:31:33 2007
@@ -39,12 +39,12 @@
#define TRUST_KEY_SIZE "KeySize"
#define TRUST_CLAIMS "Claims"
-#define TRUST_CLAIMS_DIALECT "Dialect"
+#define TRUST_CLAIMS_DIALECT "Dialect"
#define TRUST_ENTROPY "Entropy"
#define TRUST_BINARY_SECRET "BinarySecret"
-#define TRUST_LIFE_TIME "LifeTime"
+#define TRUST_LIFE_TIME "Lifetime"
#define TRUST_LIFE_TIME_CREATED "Created"
#define TRUST_LIFE_TIME_EXPIRES "Expires"
@@ -98,9 +98,9 @@
#define TRUST_RST_ACTION_SCT "/RST/SCT"
#define TRUST_RST_ACTION_CANCEL_SCT "/RST/SCT/Cancel"
-#define TRUST_KEY_TYPE_SYMM_KEY "/SymmetricKey"
-#define TRUST_KEY_TYPE_PUBLIC_KEY "/PublicKey"
-#define TRUST_KEY_TYPE_BEARER "/Bearer"
+#define TRUST_KEY_TYPE_SYMM_KEY "http://schemas.xmlsoap.org/ws/2005/02/trust/SymmetricKey"
+#define TRUST_KEY_TYPE_PUBLIC_KEY "http://schemas.xmlsoap.org/ws/2005/02/trust/PublicKey"
+#define TRUST_KEY_TYPE_BEARER "http://schemas.xmlsoap.org/ws/2005/02/trust//Bearer"
/* Trust Namespace URIs and Namespace prefix */
#define TRUST_S11 "S11"
Modified: webservices/rampart/scratch/c/trust/c/include/trust_context.h
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/c/include/trust_context.h?rev=602779&r1=602778&r2=602779&view=diff
==============================================================================
--- webservices/rampart/scratch/c/trust/c/include/trust_context.h (original)
+++ webservices/rampart/scratch/c/trust/c/include/trust_context.h Sun Dec 9 21:31:33 2007
@@ -34,6 +34,8 @@
#include <axis2_msg_ctx.h>
#include <axis2_addr.h>
#include <trust_constants.h>
+#include <trust_rst_context.h>
+#include <trust_rstr_context.h>
#ifdef __cplusplus
extern "C"
@@ -43,154 +45,71 @@
typedef struct trust_context trust_context_t;
AXIS2_EXTERN trust_context_t *AXIS2_CALL
- trust_context_create(
- const axutil_env_t * env,
- axis2_msg_ctx_t * in_msg_ctx);
-
- AXIS2_EXTERN void AXIS2_CALL
- trust_context_free(
- trust_context_t * trust_context,
- const axutil_env_t * env);
-
- AXIS2_EXTERN axis2_status_t AXIS2_CALL
- trust_context_process_applies_to(
- trust_context_t * trust_context,
- const axutil_env_t * env);
-
- AXIS2_EXTERN axis2_status_t AXIS2_CALL
-
- trust_context_process_request_context(
- trust_context_t * trust_context,
- const axutil_env_t * env);
-
- AXIS2_EXTERN axis2_status_t AXIS2_CALL
- trust_context_process_request_type(
- trust_context_t * trust_context,
- const axutil_env_t * env);
-
- AXIS2_EXTERN axis2_status_t AXIS2_CALL
- trust_context_process_applies_to(
- trust_context_t * trust_context,
- const axutil_env_t * env);
-
- AXIS2_EXTERN axis2_status_t AXIS2_CALL
- trust_context_process_life_time(
- trust_context_t * trust_context,
- const axutil_env_t * env);
-
- AXIS2_EXTERN axis2_status_t AXIS2_CALL
- trust_context_process_claims(
- trust_context_t * trust_context,
- const axutil_env_t * env);
-
- AXIS2_EXTERN axis2_status_t AXIS2_CALL
- trust_context_process_entorpy(
- trust_context_t * trust_context,
- const axutil_env_t * env);
-
- AXIS2_EXTERN axis2_status_t AXIS2_CALL
- trust_context_process_token_type(
- trust_context_t * trust_context,
- const axutil_env_t * env);
-
- AXIS2_EXTERN axis2_status_t AXIS2_CALL
- trust_context_process_entropy(
- trust_context_t * trust_context,
- const axutil_env_t * env);
-
- AXIS2_EXTERN axis2_status_t AXIS2_CALL
- trust_context_process_key_type(
- trust_context_t * data,
- const axutil_env_t * env);
+ trust_context_create(
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN void AXIS2_CALL
+ trust_context_free(
+ const axutil_env_t * env,
+ trust_context_t *trust_context);
+
+ /*Populate RST_CONTEXT : Often used in STS/IP side */
AXIS2_EXTERN axis2_status_t AXIS2_CALL
- trust_context_process_key_size(
- trust_context_t * data,
- const axutil_env_t * env);
-
- AXIS2_EXTERN axis2_char_t *AXIS2_CALL
- trust_context_get_token_type(
- trust_context_t * trust_context,
- const axutil_env_t * env);
+ trust_context_process_rst(
+ const axutil_env_t * env,
+ trust_context_t *trust_context,
+ axis2_msg_ctx_t * in_msg_ctx);
+ /*Populate RSTR_CONTEXT : Often used in Token Requestor side*/
AXIS2_EXTERN axis2_status_t AXIS2_CALL
- trust_context_set_token_type(
- trust_context_t * trust_context,
- const axutil_env_t * env,
- axis2_char_t *token_type);
+ trust_context_process_rstr(
+ const axutil_env_t * env,
+ trust_context_t *trust_context,
+ axis2_msg_ctx_t * in_msg_ctx);
- AXIS2_EXTERN axiom_node_t * AXIS2_CALL
- trust_context_get_rst_node(
- trust_context_t * trust_context,
- const axutil_env_t * env);
+ /*Build RST Node from created RST_CONTEXT */
+ AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+ trust_context_build_rst_node(
+ const axutil_env_t * env,
+ trust_context_t *trust_context);
- AXIS2_EXTERN axis2_status_t AXIS2_CALL
- trust_context_set_rst_node(
- trust_context_t * trust_context,
+ /*Build RSTR Node from created RSTR_CONTEXT */
+ AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+ trust_context_build_rstr_node(
const axutil_env_t * env,
- axiom_node_t *rst_node);
+ trust_context_t *trust_context);
- AXIS2_EXTERN axis2_char_t *AXIS2_CALL
- trust_context_get_request_type(
- trust_context_t * trust_context,
- const axutil_env_t * env);
- AXIS2_EXTERN axis2_status_t AXIS2_CALL
- trust_context_set_request_type(
- trust_context_t * trust_context,
+ /*Get Populated RST_CONTEXT */
+ AXIS2_EXTERN trust_rst_context_t* AXIS2_CALL
+ trust_context_get_rst_context(
const axutil_env_t * env,
- axis2_char_t *request_type);
-
- AXIS2_EXTERN axis2_char_t *AXIS2_CALL
- trust_context_get_soap_ns(
- trust_context_t * trust_context,
- const axutil_env_t * env);
-
- AXIS2_EXTERN axis2_char_t *AXIS2_CALL
- trust_context_get_wst_ns(
- trust_context_t * trust_context,
- const axutil_env_t * env);
+ trust_context_t *trust_context);
- AXIS2_EXTERN axis2_char_t * AXIS2_CALL
- trust_context_get_appliesto_address(
- trust_context_t *trust_context,
- const axutil_env_t *env);
+ /*Get Populated RSTR_CONTEXT */
+ AXIS2_EXTERN trust_rstr_context_t* AXIS2_CALL
+ trust_context_get_rstr_context(
+ const axutil_env_t * env,
+ trust_context_t *trust_context);
- AXIS2_EXTERN axiom_node_t * AXIS2_CALL
- trust_context_get_appliesto_epr_node(
- trust_context_t *trust_context,
- const axutil_env_t *env);
-
- AXIS2_EXTERN axis2_char_t * AXIS2_CALL
- trust_context_get_rst_context_attr(
+ /*Set RST_CONTEXT */
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ trust_context_set_rst(
+ const axutil_env_t * env,
trust_context_t *trust_context,
- const axutil_env_t *env);
+ trust_rst_context_t *rst_context);
- AXIS2_EXTERN axis2_char_t *AXIS2_CALL
- trust_context_get_key_type(
- trust_context_t *trust_context,
- const axutil_env_t *env);
-
- AXIS2_EXTERN int AXIS2_CALL
- trust_context_get_key_size(
+ /*Set RSTR_CONTEXT */
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ trust_context_set_rstr(
+ const axutil_env_t * env,
trust_context_t *trust_context,
- const axutil_env_t *env);
+ trust_rstr_context_t *rstr_context);
- AXIS2_EXTERN axis2_char_t * AXIS2_CALL
- trust_context_get_request_entropy(
- trust_context_t *trust_context,
- const axutil_env_t *env);
- AXIS2_EXTERN axiom_node_t * AXIS2_CALL
- trust_context_get_claims_node(
- trust_context_t *trust_context,
- const axutil_env_t *env);
+
- AXIS2_EXTERN axis2_char_t * AXIS2_CALL
- trust_context_get_claims_dialect(
- trust_context_t * trust_context,
- const axutil_env_t *env);
-
#ifdef __cplusplus
}
#endif
Modified: 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=602779&r1=602778&r2=602779&view=diff
==============================================================================
--- webservices/rampart/scratch/c/trust/c/include/trust_entropy.h (original)
+++ webservices/rampart/scratch/c/trust/c/include/trust_entropy.h Sun Dec 9 21:31:33 2007
@@ -19,6 +19,10 @@
#define TRUST_ENTROPY_H
#include <axutil_utils.h>
+#include <axutil_utils.h>
+#include <axutil_string.h>
+#include <axutil_base64.h>
+#include <axiom_soap.h>
#include <axiom.h>
#include <trust_constants.h>
@@ -70,6 +74,11 @@
trust_entropy_t *entropy,
const axutil_env_t *env);
+ AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+ trust_entropy_get_str_for_bin_sec_type(
+ trust_bin_sec_type_t type,
+ const axutil_env_t *env);
+
AXIS2_EXTERN axis2_status_t AXIS2_CALL
trust_entropy_set_binary_secret(
trust_entropy_t *entropy,
@@ -97,16 +106,6 @@
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
}
Modified: 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=602779&r1=602778&r2=602779&view=diff
==============================================================================
--- webservices/rampart/scratch/c/trust/c/include/trust_life_time.h (original)
+++ webservices/rampart/scratch/c/trust/c/include/trust_life_time.h Sun Dec 9 21:31:33 2007
@@ -15,8 +15,8 @@
* limitations under the License.
*/
-#ifndef TRUST_LIFE_TIME_H
-#define TRUST_LIFE_TIME_H
+#ifndef TRUST_LIFETIME_H
+#define TRUST_LIFETIME_H
#include <stdio.h>
#include <stdlib.h>
@@ -27,6 +27,7 @@
#include <axiom.h>
#include <axis2_msg_ctx.h>
#include <axis2_addr.h>
+
#include <trust_constants.h>
#ifdef __cplusplus
Modified: webservices/rampart/scratch/c/trust/c/include/trust_sts_client.h
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/c/include/trust_sts_client.h?rev=602779&r1=602778&r2=602779&view=diff
==============================================================================
--- webservices/rampart/scratch/c/trust/c/include/trust_sts_client.h (original)
+++ webservices/rampart/scratch/c/trust/c/include/trust_sts_client.h Sun Dec 9 21:31:33 2007
@@ -39,6 +39,10 @@
#include <trust_policy_util.h>
#include <trust_token.h>
+#include <trust_rst_context.h>
+#include <trust_rstr_context.h>
+#include <trust_context.h>
+
#ifdef __cplusplus
extern "C"
{
@@ -55,45 +59,14 @@
trust_sts_client_t * sts_client,
const axutil_env_t * env);
+
+ /*Send RST to the specified STS/IP. RST Node that is built from RST_Context should be passed*/
AXIS2_EXTERN void AXIS2_CALL
trust_sts_client_request_security_token(
trust_sts_client_t * sts_client,
const axutil_env_t * env,
- axis2_char_t * applies_to,
- axis2_char_t * token_type);
+ trust_context_t *trust_context);
- AXIS2_EXTERN 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 * request_type,
- axis2_char_t * applies_to,
- axis2_char_t * token_type);
-
- AXIS2_EXTERN axiom_node_t * AXIS2_CALL
- trust_sts_client_create_renew_request(
- trust_sts_client_t *sts_client,
- const axutil_env_t *env,
- axis2_char_t *token_type,
- axis2_char_t *request_type,
- axiom_node_t *renew_target,
- axis2_bool_t allow_postdating,
- trust_allow_t renew_allow,
- trust_ok_t ok_flag);
-
- AXIS2_EXTERN axiom_node_t * AXIS2_CALL
- tust_sts_client_create_cancel_request(
- trust_sts_client_t *sts_client,
- const axutil_env_t *env,
- axis2_char_t *request_type,
- axiom_node_t *cancel_target);
-
- AXIS2_EXTERN axiom_node_t * AXIS2_CALL
- trust_sts_client_create_validate_request(
- trust_sts_client_t *sts_client,
- const axutil_env_t *env,
- axis2_char_t *token_type,
- axis2_char_t *request_type);
AXIS2_EXTERN axis2_status_t AXIS2_CALL
trust_sts_client_process_policies(
@@ -102,33 +75,14 @@
neethi_policy_t * issuer_policy,
neethi_policy_t * service_policy);
+
AXIS2_EXTERN axis2_svc_client_t *AXIS2_CALL
trust_sts_client_get_svc_client(
trust_sts_client_t * sts_client,
const axutil_env_t * env,
axis2_char_t * action);
- AXIS2_EXTERN trust_token_t *AXIS2_CALL
- trust_sts_client_process_issue_response(
- trust_sts_client_t * sts_client,
- const axutil_env_t * env,
- int wst_version,
- axiom_node_t * response_node,
- axiom_node_t * payload_sent);
- AXIS2_EXTERN axis2_char_t *AXIS2_CALL
- trust_sts_client_find_identifier(
- trust_sts_client_t * sts_client,
- axiom_node_t * req_att_ref_node,
- axiom_node_t * req_unatt_ref_node,
- axiom_node_t * sec_token_node,
- const axutil_env_t * env);
-
- AXIS2_EXTERN axis2_char_t *AXIS2_CALL
- trust_sts_client_get_id_from_str(
- trust_sts_client_t * sts_client,
- axiom_node_t * ref_node,
- const axutil_env_t * env);
#ifdef __cplusplus
}
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=602779&r1=602778&r2=602779&view=diff
==============================================================================
--- webservices/rampart/scratch/c/trust/c/include/trust_util.h (original)
+++ webservices/rampart/scratch/c/trust/c/include/trust_util.h Sun Dec 9 21:31:33 2007
@@ -63,8 +63,7 @@
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_create_rst_element(
const axutil_env_t * env,
- axis2_char_t *wst_ns_uri,
- axiom_node_t *parent,
+ int wst_version,
axis2_char_t * context);
/**
@@ -81,7 +80,7 @@
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_create_rstr_element(
const axutil_env_t * env,
- axis2_char_t *wst_ns_uri,
+ int wst_version,
axis2_char_t * context);
/**
@@ -97,7 +96,7 @@
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_create_rstr_collection_element(
const axutil_env_t * env,
- axis2_char_t *wst_ns_uri);
+ int wst_version);
/**
* Create the RequestType Element for Issuance binding.
@@ -111,7 +110,7 @@
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_create_request_type_element(
const axutil_env_t * env,
- axis2_char_t *wst_ns_uri,
+ int wst_version,
axiom_node_t * parent_node,
axis2_char_t * request_type);
@@ -125,11 +124,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,
- axis2_char_t *wst_ns_uri,
- axiom_node_t * parent_node,
- axis2_char_t * token_type);
+ trust_util_create_token_type_element(
+ const axutil_env_t * env,
+ int wst_version,
+ axiom_node_t * parent_node,
+ axis2_char_t * token_type);
/**
* Create the AppliesTo Element for Issuance binding.
@@ -162,7 +161,7 @@
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_create_claims_element(
const axutil_env_t * env,
- axis2_char_t *wst_ns_uri,
+ int wst_version,
axiom_node_t * parent_node,
axiom_node_t * claims_content,
axis2_char_t * dialect_uri);
@@ -178,8 +177,10 @@
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_create_requested_security_token_element(
const axutil_env_t * env,
- axis2_char_t *wst_ns_uri,
- axiom_node_t * parent_node);
+ int wst_version,
+ axiom_node_t * parent_node,
+ axiom_node_t * sec_token_node);
+
/**
* Create the RequestedProofToken Element for Issuance binding.
@@ -192,7 +193,7 @@
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_create_requsted_proof_token_element(
const axutil_env_t * env,
- axis2_char_t *wst_ns_uri,
+ int wst_version,
axiom_node_t * parent_node);
/**
@@ -208,7 +209,7 @@
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_create_entropy_element(
const axutil_env_t * env,
- axis2_char_t *wst_ns_uri,
+ int wst_version,
axiom_node_t * parent_node);
/**
@@ -223,7 +224,7 @@
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_computed_key_element(
const axutil_env_t * env,
- axis2_char_t *wst_ns_uri,
+ int wst_version,
axiom_node_t * parent_node);
/**
@@ -239,7 +240,7 @@
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_create_binary_secret_element(
const axutil_env_t * env,
- axis2_char_t *wst_ns_uri,
+ int wst_version,
axiom_node_t * parent_node,
axis2_char_t * enc_secret,
axis2_char_t * bin_sec_type);
@@ -255,7 +256,7 @@
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_create_computed_key_algo_element(
const axutil_env_t * env,
- axis2_char_t *wst_ns_uri,
+ int wst_version,
axiom_node_t * parent_node,
axis2_char_t * algo_id);
@@ -270,7 +271,7 @@
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_create_key_size_element(
const axutil_env_t * env,
- axis2_char_t *wst_ns_uri,
+ int wst_version,
axiom_node_t * parent_node,
axis2_char_t * key_size);
@@ -285,7 +286,7 @@
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_create_key_type_element(
const axutil_env_t * env,
- axis2_char_t *wst_ns_uri,
+ int wst_version,
axiom_node_t * parent_node,
axis2_char_t * key_type);
@@ -301,7 +302,7 @@
trust_util_create_life_time_element(
const axutil_env_t * env,
axiom_node_t * parent_node,
- axis2_char_t *wst_ns_uri,
+ int wst_version,
int ttl);
/**
@@ -314,7 +315,7 @@
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_create_req_attached_reference_element(
const axutil_env_t * env,
- axis2_char_t *wst_ns_uri,
+ int wst_version,
axiom_node_t * parent_node);
/**
@@ -327,7 +328,7 @@
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_create_req_unattached_reference_element(
const axutil_env_t * env,
- axis2_char_t *wst_ns_uri,
+ const int version,
axiom_node_t * parent_node);
/**
@@ -341,7 +342,7 @@
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_create_encrypted_data_element(
const axutil_env_t * env,
- axis2_char_t *wst_ns_uri,
+ int wst_version,
axiom_node_t * parent_node,
axis2_char_t * enc_data);
@@ -356,7 +357,7 @@
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_create_renew_traget_element(
const axutil_env_t * env,
- axis2_char_t *wst_ns_uri,
+ int wst_version,
axiom_node_t * parent_node,
axiom_node_t * token_renew_pending_node);
@@ -370,7 +371,7 @@
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_create_allow_postdating_element(
const axutil_env_t * env,
- axis2_char_t *wst_ns_uri,
+ int wst_version,
axiom_node_t * parent_node);
/**
@@ -385,7 +386,7 @@
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_create_renewing_element(
const axutil_env_t * env,
- axis2_char_t *wst_ns_uri,
+ int wst_version,
axiom_node_t * parent_node,
trust_allow_t allow_flag,
trust_ok_t ok_flag);
@@ -401,7 +402,7 @@
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_create_cancel_target_element(
const axutil_env_t * env,
- axis2_char_t *wst_ns_uri,
+ int wst_version,
axiom_node_t * parent_node,
axiom_node_t * token_cancel_pending_node);
@@ -417,7 +418,7 @@
trust_util_create_validation_response_element(
const axutil_env_t * env,
axiom_node_t * parent_node,
- axis2_char_t *wst_ns_uri,
+ int wst_version,
axis2_char_t * code,
axis2_char_t * reason);
Added: webservices/rampart/scratch/c/trust/c/samples/trust/sts/issuer.c
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/c/samples/trust/sts/issuer.c?rev=602779&view=auto
==============================================================================
--- webservices/rampart/scratch/c/trust/c/samples/trust/sts/issuer.c (added)
+++ webservices/rampart/scratch/c/trust/c/samples/trust/sts/issuer.c Sun Dec 9 21:31:33 2007
@@ -0,0 +1,155 @@
+/*
+ * 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 "saml_issuer.h"
+
+#include <axis2_op_ctx.h>
+#include <axis2_msg_ctx.h>
+
+axiom_node_t *
+create_saml_token(axutil_env_t *env);
+
+saml_condition_t *
+create_condition(axutil_env_t *env);
+
+saml_stmt_t *
+create_auth_statement(axutil_env_t *env);
+
+saml_auth_binding_t *
+create_autherity_binding(axutil_env_t *env);
+
+saml_subject_t *
+create_subject(axutil_env_t *env);
+
+axiom_node_t *axis2_saml_issuer_issue(
+ const axutil_env_t * env,
+ trust_context_t *trust_ctx)
+{
+ axis2_char_t *token_type = NULL;
+ axiom_node_t *issued_saml_token = NULL;
+ axiom_node_t *rstr_node = NULL;
+ axiom_node_t *requested_sec_token_node = NULL;
+
+ trust_rst_context_t *rst_context = NULL; /*Created RST Context*/
+ trust_rstr_context_t *rstr_context = NULL; /*Used for Creating RSTR*/
+
+ rst_context = trust_context_get_rst_context(env, trust_ctx);
+
+
+ token_type = trust_rst_context_get_token_type(rst_context, env);
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sts] token type %s..!", token_type);
+
+ if (axutil_strcmp(token_type, SAML_TOKEN))
+ {
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sts] token type not equal..!");
+ return NULL;
+ }
+
+ rstr_context = trust_rstr_context_create(1, env);
+
+ //rstr_node = trust_util_create_rstr_element(env, TRUST_VERSION_05_02, NULL);
+ //requested_sec_token_node = trust_util_create_requested_security_token_element(env, TRUST_VERSION_05_02, rstr_node);
+
+ issued_saml_token = create_saml_token(env);
+ trust_rstr_context_set_requested_security_token(rstr_context, env, issued_saml_token);
+
+ trust_context_set_rstr(env, trust_ctx, rstr_context);
+ rstr_node = trust_context_build_rstr_node(env, trust_ctx);
+ //axiom_node_add_child(requested_sec_token_node, env, issued_saml_token);
+
+
+ return rstr_node;
+}
+
+axiom_node_t *
+create_saml_token(axutil_env_t *env)
+{
+ axutil_date_time_t *time = NULL;
+ saml_assertion_t *assertion = NULL;
+ axiom_node_t *node = NULL;
+ time = axutil_date_time_create(env);
+ assertion = saml_assertion_create(env);
+ if (assertion)
+ {
+ saml_assertion_set_minor_version(assertion, env, 1);
+ saml_assertion_set_issue_instant(assertion, env, time);
+ saml_assertion_set_issuer(assertion, env, "http://ws.apache.org/rampart/c");
+ saml_assertion_add_condition(assertion, env, create_condition(env));
+ saml_assertion_set_not_before(assertion, env, axutil_date_time_create(env));
+ saml_assertion_add_statement(assertion, env, create_auth_statement(env));
+ }
+ node = saml_assertion_to_om(assertion, NULL, env);
+ saml_assertion_free(assertion, env);
+ return node;
+}
+
+saml_condition_t *
+create_condition(axutil_env_t *env)
+{
+ saml_audi_restriction_cond_t *arc = NULL;
+ saml_condition_t *condition = AXIS2_MALLOC(env->allocator, sizeof(saml_condition_t));
+ arc = saml_audi_restriction_cond_create(env);
+ saml_audi_restriction_cond_add_audience(arc, env, "www.samle.com");
+ return condition;
+}
+
+saml_stmt_t *
+create_auth_statement(axutil_env_t *env)
+{
+ saml_auth_stmt_t *a_stmt = NULL;
+ saml_stmt_t *stmt = saml_stmt_create(env);
+ a_stmt = saml_auth_stmt_create(env);
+ saml_stmt_set_stmt(stmt, env, a_stmt, SAML_STMT_AUTHENTICATIONSTATEMENT);
+
+ saml_auth_stmt_set_auth_method(a_stmt, env, SAML_AUTH_METHOD_URI_PASSWORD);
+ saml_auth_stmt_set_auth_instant(a_stmt, env, axutil_date_time_create(env));
+
+ saml_auth_stmt_set_subject(a_stmt, env, create_subject(env));
+ saml_auth_stmt_set_subject_dns(a_stmt, env, "192.148.5.8");
+ saml_auth_stmt_set_subject_ip(a_stmt, env, "128.5.6.4");
+ saml_auth_stmt_add_auth_binding(a_stmt, env, create_autherity_binding(env));
+ return stmt;
+}
+
+saml_auth_binding_t *
+create_autherity_binding(axutil_env_t *env)
+{
+ saml_auth_binding_t *bind = NULL;
+ bind = saml_auth_binding_create(env);
+ saml_auth_binding_set_authority_kind(bind, env, "abc:aa:aa");
+ saml_auth_binding_set_binding(bind, env, "SOAP");
+ saml_auth_binding_set_location(bind, env, "http://myhome.com/sevices/echo");
+ return bind;
+}
+
+saml_subject_t *
+create_subject(axutil_env_t *env)
+{
+ saml_subject_t *subject = NULL;
+ saml_named_id_t *id = NULL;
+ subject = saml_subject_create(env);
+
+ id = saml_named_id_create(env);
+ saml_named_id_set_name(id, env, "Computer Science & Engineering Department");
+ saml_named_id_set_format(id, env, SAML_EMAIL_ADDRESS);
+ saml_named_id_set_name_qualifier(id, env, "University of Moratuwa");
+ saml_subject_set_named_id(subject, env, id);
+
+ saml_subject_add_confirmation(subject, env, SAML_SUB_CONFIRMATION_ARTIFACT);
+ saml_subject_add_confirmation(subject, env, SAML_SUB_CONFIRMATION_BEARER);
+ return subject;
+}
Propchange: webservices/rampart/scratch/c/trust/c/samples/trust/sts/issuer.c
------------------------------------------------------------------------------
svn:executable = *
Added: webservices/rampart/scratch/c/trust/c/samples/trust/sts/saml_issuer.h
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/c/samples/trust/sts/saml_issuer.h?rev=602779&view=auto
==============================================================================
--- webservices/rampart/scratch/c/trust/c/samples/trust/sts/saml_issuer.h (added)
+++ webservices/rampart/scratch/c/trust/c/samples/trust/sts/saml_issuer.h Sun Dec 9 21:31:33 2007
@@ -0,0 +1,37 @@
+/*
+ * 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 SAML_ISSUER_H
+#define SAML_ISSUER_H
+
+#include <axis2_svc_skeleton.h>
+#include <axutil_log_default.h>
+#include <axutil_error_default.h>
+#include <axiom_text.h>
+#include <axiom_node.h>
+#include <axiom_element.h>
+#include <trust_context.h>
+#include <trust_rst_context.h>
+#include <trust_rstr_context.h>
+#include <saml.h>
+
+#define SAML_TOKEN "oasis:names:tc:SAML:1.0:assertion"
+
+axiom_node_t *axis2_saml_issuer_issue(
+ const axutil_env_t * env,
+ trust_context_t *trust_ctx);
+
+#endif
Propchange: webservices/rampart/scratch/c/trust/c/samples/trust/sts/saml_issuer.h
------------------------------------------------------------------------------
svn:executable = *
Added: webservices/rampart/scratch/c/trust/c/samples/trust/sts/saml_skeleton.c
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/c/samples/trust/sts/saml_skeleton.c?rev=602779&view=auto
==============================================================================
--- webservices/rampart/scratch/c/trust/c/samples/trust/sts/saml_skeleton.c (added)
+++ webservices/rampart/scratch/c/trust/c/samples/trust/sts/saml_skeleton.c Sun Dec 9 21:31:33 2007
@@ -0,0 +1,145 @@
+/*
+ * 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 <axis2_svc_skeleton.h>
+#include "saml_issuer.h"
+#include <axutil_array_list.h>
+#include <axis2_op_ctx.h>
+#include <axis2_msg_ctx.h>
+#include <axis2_const.h>
+#include <trust_context.h>
+#include <trust_rst_context.h>
+#include <trust_rstr_context.h>
+
+#include <stdio.h>
+
+int AXIS2_CALL saml_issuer_free(
+ axis2_svc_skeleton_t *svc_skeleton,
+ const axutil_env_t *env);
+
+axiom_node_t *AXIS2_CALL saml_issuer_invoke(
+ axis2_svc_skeleton_t *svc_skeleton,
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axis2_msg_ctx_t *msg_ctx);
+
+int AXIS2_CALL saml_issuer_init(
+ axis2_svc_skeleton_t *svc_skeleton,
+ const axutil_env_t *env);
+
+static const axis2_svc_skeleton_ops_t saml_issuer_svc_skeleton_ops_var = {
+ saml_issuer_init,
+ saml_issuer_invoke,
+ NULL,
+ saml_issuer_free
+};
+
+AXIS2_EXTERN axis2_svc_skeleton_t *AXIS2_CALL
+axis2_saml_issuer_create(
+ const axutil_env_t *env)
+{
+ axis2_svc_skeleton_t *svc_skeleton = NULL;
+ svc_skeleton = AXIS2_MALLOC(env->allocator, sizeof(axis2_svc_skeleton_t));
+ svc_skeleton->ops = &saml_issuer_svc_skeleton_ops_var;
+ svc_skeleton->func_array = NULL;
+ return svc_skeleton;
+}
+
+int AXIS2_CALL
+saml_issuer_init(
+ axis2_svc_skeleton_t *svc_skeleton,
+ const axutil_env_t *env)
+{
+ return AXIS2_SUCCESS;
+}
+
+int AXIS2_CALL
+saml_issuer_free(
+ axis2_svc_skeleton_t *svc_skeleton,
+ const axutil_env_t *env)
+{
+ if (svc_skeleton)
+ {
+ AXIS2_FREE(env->allocator, svc_skeleton);
+ svc_skeleton = NULL;
+ }
+ return AXIS2_SUCCESS;
+}
+
+axiom_node_t *AXIS2_CALL
+saml_issuer_invoke(
+ axis2_svc_skeleton_t *svc_skeleton,
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axis2_msg_ctx_t *msg_ctx)
+{
+ axis2_msg_ctx_t *in_msg_ctx = NULL;
+ axis2_op_ctx_t *op_ctx = NULL;
+
+ trust_context_t *trust_ctx = NULL;
+ trust_rst_context_t *rst_ctx = NULL;
+
+
+ printf("RST Received\n");
+ op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
+ in_msg_ctx = axis2_op_ctx_get_msg_ctx(op_ctx, env, AXIS2_WSDL_MESSAGE_LABEL_IN);
+
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sts] create data..!");
+
+ trust_ctx = trust_context_create(env); // Creatin Trust_Context
+ /*Trust Version is passed */
+ rst_ctx = trust_rst_context_create(1, env);
+
+ /*Populating RST*/
+ if(AXIS2_FAILURE == trust_context_process_rst(env, trust_ctx, in_msg_ctx))
+ {
+ printf("RST Processing Failed!\n");
+ }
+
+
+
+
+ return axis2_saml_issuer_issue(env, trust_ctx);
+
+ //return NULL;
+}
+
+AXIS2_EXPORT int
+axis2_get_instance(
+ struct axis2_svc_skeleton **inst,
+ const axutil_env_t * env)
+{
+ *inst = axis2_saml_issuer_create(env);
+ if (!(*inst))
+ {
+ return AXIS2_FAILURE;
+ }
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXPORT int
+axis2_remove_instance(
+ axis2_svc_skeleton_t *inst,
+ const axutil_env_t *env)
+{
+ axis2_status_t status = AXIS2_FAILURE;
+ if (inst)
+ {
+ status = AXIS2_SVC_SKELETON_FREE(inst, env);
+ }
+ return status;
+}
Propchange: webservices/rampart/scratch/c/trust/c/samples/trust/sts/saml_skeleton.c
------------------------------------------------------------------------------
svn:executable = *
Added: webservices/rampart/scratch/c/trust/c/samples/trust/sts/services.xml
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/c/samples/trust/sts/services.xml?rev=602779&view=auto
==============================================================================
--- webservices/rampart/scratch/c/trust/c/samples/trust/sts/services.xml (added)
+++ webservices/rampart/scratch/c/trust/c/samples/trust/sts/services.xml Sun Dec 9 21:31:33 2007
@@ -0,0 +1,51 @@
+<service name="sts">
+ <parameter name="ServiceClass" locked="xsd:false">sts</parameter>
+
+ <description>
+ This is a testing service , to test the system is working or not
+ </description>
+ <module ref="rampart"/>
+
+ <operation name="issue">
+ <!--messageReceiver class="axis2_receivers" /-->
+ <parameter name="wsamapping" >http://schemas.xmlsoap.org/ws/2005/02/RST/Issue</parameter>
+ </operation>
+ <wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:InitiatorToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:InitiatorToken>
+ <sp:RecipientToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:RecipientToken>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ </wsp:Policy>
+ </sp:AsymmetricBinding>
+ <rampc:RampartConfig xmlns:rampc="http://ws.apache.org/rampart/c/policy">
+ <!--rampc:TimeToLive>360</rampc:TimeToLive-->
+ </rampc:RampartConfig>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+
+</service>
Propchange: webservices/rampart/scratch/c/trust/c/samples/trust/sts/services.xml
------------------------------------------------------------------------------
svn:executable = *
Added: webservices/rampart/scratch/c/trust/c/samples/trust/sts/sts_test.sh
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/c/samples/trust/sts/sts_test.sh?rev=602779&view=auto
==============================================================================
--- webservices/rampart/scratch/c/trust/c/samples/trust/sts/sts_test.sh (added)
+++ webservices/rampart/scratch/c/trust/c/samples/trust/sts/sts_test.sh Sun Dec 9 21:31:33 2007
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+#create the service lib
+gcc -g -I$AXIS2C_HOME/include/axis2-1.2 -I$AXIS2C_HOME/include/rampart-1.0.0 -I./include -L./ -L$AXIS2C_HOME/lib -shared ./*.c -o libsts.a -fPIC -DPIC -shared -lpthread -ldl -ltrust -lneethi -lsaml -laxis2_engine -laxis2_axiom -laxutil -Wl,-soname -Wl,libsts.so -o libsts.so
+
Propchange: webservices/rampart/scratch/c/trust/c/samples/trust/sts/sts_test.sh
------------------------------------------------------------------------------
svn:executable = *
Added: webservices/rampart/scratch/c/trust/c/samples/trust/sts_client/client.c
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/c/samples/trust/sts_client/client.c?rev=602779&view=auto
==============================================================================
--- webservices/rampart/scratch/c/trust/c/samples/trust/sts_client/client.c (added)
+++ webservices/rampart/scratch/c/trust/c/samples/trust/sts_client/client.c Sun Dec 9 21:31:33 2007
@@ -0,0 +1,62 @@
+#include <trust_sts_client.h>
+#include <trust_context.h>
+#include <trust_rst_context.h>
+#include <trust_rstr_context.h>
+#include <axutil_env.h>
+#include <rampart_constants.h>
+#include <neethi_util.h>
+#include <neethi_policy.h>
+
+int main(
+ int argc,
+ char **argv)
+{
+ trust_sts_client_t *sts_client = NULL;
+ const axutil_env_t *env = NULL;
+ const axis2_char_t *address = NULL;
+ const axis2_char_t *client_home = NULL;
+
+ axis2_char_t *file_name = NULL;
+ axis2_char_t *file_name2 = NULL;
+
+ axis2_char_t *appliesto = "http://people.apache.org/~milinda";
+ axis2_char_t *token = "oasis:names:tc:SAML:1.0:assertion";
+ axis2_char_t *request_type = "http://schemas.xmlsoap.org/ws/2005/02/RST/Issue";
+
+ trust_context_t *trust_ctx = NULL;
+ trust_rst_context_t *rst_context = NULL;
+
+
+ /* Set up the environment */
+ env = axutil_env_create_all("sts.log", AXIS2_LOG_LEVEL_TRACE);
+
+ /* Set end point reference of echo service */
+ address = "http://localhost:9090/axis2/services/sts";
+ client_home = "/home/kasun/Development/axis2c/c/deploy/client_repo";
+
+ file_name = "/home/kasun/Development/FEDi/Dev/FEDi-Trust-Working/trust_test/sts_client/client.xml";
+ file_name2 = "/home/kasun/Development/FEDi/Dev/FEDi-Trust-Working/trust_test/sts_client/service.xml";
+
+ sts_client = trust_sts_client_create(env);
+
+
+ trust_sts_client_set_home_dir(sts_client, env, client_home);
+ trust_sts_client_set_issuer_address(sts_client, env, address);
+ trust_sts_client_set_issuer_policy_location(sts_client, env, file_name);
+ trust_sts_client_set_service_policy_location(sts_client, env, file_name2);
+
+ trust_ctx = trust_context_create(env);
+ rst_context = trust_rst_context_create(1, env);
+
+ trust_rst_context_set_token_type(rst_context, env, token);
+ trust_rst_context_set_appliesto(rst_context, env, appliesto);
+ trust_rst_context_set_request_type(rst_context, env, request_type);
+
+ trust_context_set_rst(env, trust_ctx, rst_context);
+
+ trust_sts_client_request_security_token(sts_client, env, trust_ctx);
+
+
+ trust_sts_client_free(sts_client, env);
+ return 0;
+}
Propchange: webservices/rampart/scratch/c/trust/c/samples/trust/sts_client/client.c
------------------------------------------------------------------------------
svn:executable = *
Added: webservices/rampart/scratch/c/trust/c/samples/trust/sts_client/client.xml
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/c/samples/trust/sts_client/client.xml?rev=602779&view=auto
==============================================================================
--- webservices/rampart/scratch/c/trust/c/samples/trust/sts_client/client.xml (added)
+++ webservices/rampart/scratch/c/trust/c/samples/trust/sts_client/client.xml Sun Dec 9 21:31:33 2007
@@ -0,0 +1,42 @@
+<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:InitiatorToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:InitiatorToken>
+ <sp:RecipientToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:RecipientToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256Rsa15/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ </wsp:Policy>
+ </sp:AsymmetricBinding>
+ <rampc:RampartConfig xmlns:rampc="http://ws.apache.org/rampart/c/policy">
+ <rampc:TimeToLive>360</rampc:TimeToLive>
+ </rampc:RampartConfig>
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
Propchange: webservices/rampart/scratch/c/trust/c/samples/trust/sts_client/client.xml
------------------------------------------------------------------------------
svn:executable = *
Added: webservices/rampart/scratch/c/trust/c/samples/trust/sts_client/compile_sts_client.sh
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/c/samples/trust/sts_client/compile_sts_client.sh?rev=602779&view=auto
==============================================================================
--- webservices/rampart/scratch/c/trust/c/samples/trust/sts_client/compile_sts_client.sh (added)
+++ webservices/rampart/scratch/c/trust/c/samples/trust/sts_client/compile_sts_client.sh Sun Dec 9 21:31:33 2007
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+#create the sts client lib
+gcc -g -I$AXIS2C_HOME/include/axis2-1.2 -I$AXIS2C_HOME/include/rampart-1.0.0 -I./include -L$AXIS2C_HOME/lib -L$AXIS2C_HOME/modules/rampart -L./ ./client.c -o sts_client -laxutil -ltrust -lmod_rampart -lneethi -laxis2_axiom -laxis2_engine
Propchange: webservices/rampart/scratch/c/trust/c/samples/trust/sts_client/compile_sts_client.sh
------------------------------------------------------------------------------
svn:executable = *
Added: webservices/rampart/scratch/c/trust/c/samples/trust/sts_client/service.xml
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/c/samples/trust/sts_client/service.xml?rev=602779&view=auto
==============================================================================
--- webservices/rampart/scratch/c/trust/c/samples/trust/sts_client/service.xml (added)
+++ webservices/rampart/scratch/c/trust/c/samples/trust/sts_client/service.xml Sun Dec 9 21:31:33 2007
@@ -0,0 +1,77 @@
+<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:InitiatorToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:InitiatorToken>
+ <sp:RecipientToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:RecipientToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256Rsa15/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ <sp:EncryptSignature/>
+ <sp:EncryptBeforeSigning/>
+ </wsp:Policy>
+ </sp:AsymmetricBinding>
+ <sp:SignedSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Always"/>
+ </wsp:Policy>
+ </sp:SignedSupportingTokens>
+ <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportRefKeyIdentifier/>
+ <sp:MustSupportRefEmbeddedToken/>
+ <sp:MustSupportRefIssuerSerial/>
+ </wsp:Policy>
+ </sp:Wss10>
+ <sp:Trust10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportIssuedTokens/>
+ <sp:RequireClientEntropy/>
+ <sp:RequireServerEntropy/>
+ </wsp:Policy>
+ </sp:Trust10>
+ <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:EncryptedParts>
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ <sp:Header Namespace="http://www.w3.org/2005/08/addressing"/>
+ </sp:SignedParts>
+ <rampc:RampartConfig xmlns:rampc="http://ws.apache.org/rampart/c/policy">
+ <rampc:User>Alice</rampc:User>
+ <rampc:TimeToLive>360</rampc:TimeToLive>
+ <rampc:EncryptionUser>a</rampc:EncryptionUser>
+ <rampc:PasswordType>Digest</rampc:PasswordType>
+ <rampc:PasswordCallbackClass>AXIS2C_HOME/bin/samples/rampart/callback/libpwcb.so</rampc:PasswordCallbackClass>
+ <rampc:ReceiverCertificate>AXIS2C_HOME/bin/samples/rampart/keys/ahome/bob_cert.cert</rampc:ReceiverCertificate>
+ <rampc:Certificate>AXIS2C_HOME/bin/samples/rampart/keys/ahome/alice_cert.cert</rampc:Certificate>
+ <rampc:PrivateKey>AXIS2C_HOME/bin/samples/rampart/keys/ahome/alice_key.pem</rampc:PrivateKey>
+ </rampc:RampartConfig>
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
Propchange: webservices/rampart/scratch/c/trust/c/samples/trust/sts_client/service.xml
------------------------------------------------------------------------------
svn:executable = *
Modified: webservices/rampart/scratch/c/trust/c/src/trust/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/c/src/trust/Makefile.am?rev=602779&r1=602778&r2=602779&view=diff
==============================================================================
--- webservices/rampart/scratch/c/trust/c/src/trust/Makefile.am (original)
+++ webservices/rampart/scratch/c/trust/c/src/trust/Makefile.am Sun Dec 9 21:31:33 2007
@@ -1,10 +1,16 @@
lib_LTLIBRARIES = libtrust.la
libtrust_la_SOURCES = context.c \
- util.c \
- sts_client.c \
- policy_util.c \
- token.c
+ util.c \
+ sts_client.c \
+ policy_util.c \
+ token.c \
+ claims.c \
+ entropy.c \
+ life_time.c \
+ rst_context.c \
+ rstr_context.c
+
INCLUDES = -I$(top_builddir)/include \
-I ../../../../util/include \
Modified: 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=602779&r1=602778&r2=602779&view=diff
==============================================================================
--- webservices/rampart/scratch/c/trust/c/src/trust/claims.c (original)
+++ webservices/rampart/scratch/c/trust/c/src/trust/claims.c Sun Dec 9 21:31:33 2007
@@ -20,10 +20,9 @@
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
@@ -33,8 +32,6 @@
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;
@@ -74,7 +71,7 @@
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))
+ if(status && trust_claims_set_attr_dialect(claims, env, dialect_attr))
{
return AXIS2_SUCCESS;
}
@@ -93,7 +90,7 @@
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);
+ 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!");
Modified: webservices/rampart/scratch/c/trust/c/src/trust/context.c
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/c/src/trust/context.c?rev=602779&r1=602778&r2=602779&view=diff
==============================================================================
--- webservices/rampart/scratch/c/trust/c/src/trust/context.c (original)
+++ webservices/rampart/scratch/c/trust/c/src/trust/context.c Sun Dec 9 21:31:33 2007
@@ -18,586 +18,261 @@
struct trust_context
{
- /* in message context of STS */
- axis2_msg_ctx_t *in_msg_ctx;
+ axis2_char_t *wst_namespace;
+ axis2_char_t *soap_namespace;
+
+ /*RST Context*/
+ trust_rst_context_t *rst_context;
- /* Axiom node which holds payload of RST message */
+ /*RSTR Context*/
+ trust_rstr_context_t *rstr_context;
+
+
+ /*To store the built RST node*/
axiom_node_t *rst_node;
+
+ /*To store the built RSTR node*/
+ axiom_node_t *rstr_node;
+
+ /*Extensible - Other Contexts Related to Trust */
+
+
+};
- /** Request Type
- * e.g. wsse:ReqIssue/Validate/Renew etc
- */
- axis2_char_t *request_type;
-
- /** Required Token Type
- * e.g. wsse:X509v3
- */
- axis2_char_t *token_type;
-
- /*optional element specifies the scope for which this security token is desired */
- axiom_node_t *applies_to_epr_node;
-
- axis2_char_t *applies_to_address;
-
- /** RST Context attribute
- * This optional URI specifies an identifier/context for this request
- */
- axis2_char_t *rst_context_attr;
-
- /* KeyType element of the RST */
- axis2_char_t *key_type;
-
- int key_size;
-
- axis2_char_t *request_entropy;
-
- axis2_char_t *response_entropy;
-
- /*optional element for specific set of requested claims */
- axiom_node_t *claims_node;
-
- /**wst:RequestSecurityToken/wst:Claims@Dialect
- *Attribute specifies a URI to indicate the syntax of the claims
- */
- axis2_char_t *claims_dialect;
- /* SOAP Namespace */
- axis2_char_t *soap_namespace;
+AXIS2_EXTERN trust_context_t *AXIS2_CALL
+trust_context_create(
+ const axutil_env_t * env)
+{
+ trust_context_t *trust_context = NULL;
+
+ trust_context = (trust_context_t *) AXIS2_MALLOC(env->allocator, sizeof(trust_context_t));
+
+ trust_context->rst_context = NULL;
+ trust_context->rstr_context = NULL;
+ trust_context->rst_node = NULL;
+ trust_context->rstr_node = NULL;
+
+ return trust_context;
+}
- /* WS-Trust Namespace */
- axis2_char_t *wst_namespace;
+/*Free Contexts*/
+AXIS2_EXTERN void AXIS2_CALL
+trust_context_free(
+ const axutil_env_t * env,
+ trust_context_t *trust_context)
+{
+ if (trust_context)
+ {
+ /*Free Other Contexts*/
+ AXIS2_FREE(env->allocator, trust_context);
+ }
+}
- /*Addressing NS */
- axis2_char_t *addressing_namespace;
-};
-AXIS2_EXTERN trust_context_t *AXIS2_CALL
-trust_context_create(
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_context_process_rst(
const axutil_env_t * env,
+ trust_context_t *trust_context,
axis2_msg_ctx_t * in_msg_ctx)
-{
+{
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 *body_base_node = NULL;
axiom_element_t *rst_ele = NULL;
-
- trust_context_t *trust_context = NULL;
- trust_context = (trust_context_t *) AXIS2_MALLOC(env->allocator, sizeof(trust_context_t));
-
+ int trust_version = -1;
+
/* 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);
body_base_node = axiom_soap_body_get_base_node(soap_body, env);
trust_context->rst_node = axiom_node_get_first_child(body_base_node, env);
-
- /* rocessing SOAP Namespace */
+
+ /* Processing SOAP Namespace */
soap_ns = axiom_soap_envelope_get_namespace(soap_env, env);
trust_context->soap_namespace = axiom_namespace_get_uri(soap_ns, env);
-
- /* Processing WS-Trust namespace*/
+
+ /* Processing WS-Trust namespace*/
rst_ele = (axiom_element_t *) axiom_node_get_data_element(trust_context->rst_node, env);
wst_ns = axiom_element_get_namespace(rst_ele, env, trust_context->rst_node);
trust_context->wst_namespace = axiom_namespace_get_uri(wst_ns, env);
- trust_context_process_request_context(trust_context, env);
- trust_context_process_request_type(trust_context, env);
- trust_context_process_token_type(trust_context, env);
- trust_context_process_applies_to(trust_context, env);
- trust_context_process_claims(trust_context, env);
- trust_context_process_entropy(trust_context, env);
- trust_context_process_key_type(trust_context, env);
- trust_context_process_key_size(trust_context, env);
-
- return trust_context;
-}
-
-AXIS2_EXTERN void AXIS2_CALL
-trust_context_free(
- trust_context_t * trust_context,
- const axutil_env_t * env)
-{
- if (trust_context)
- {
- AXIS2_FREE(env->allocator, trust_context);
- }
-}
-
-AXIS2_EXTERN axis2_status_t AXIS2_CALL
-trust_context_process_applies_to(
- trust_context_t * trust_context,
- const axutil_env_t * env)
-{
- axutil_qname_t *applies_to_qname = NULL;
- axutil_qname_t *addr_qname = NULL;
- axiom_node_t *appliesto_node = NULL;
- axiom_node_t *rst_node = NULL;
- axiom_node_t *epr_node = NULL;
- axiom_node_t *addr_node = NULL;
- axiom_element_t *appliesto_ele = NULL;
- axiom_element_t *rst_ele = NULL;
- axiom_element_t *epr_ele = NULL;
- axiom_element_t *addr_ele = NULL;
- axiom_namespace_t *addr_namespace = NULL;
-
-
- rst_node = trust_context->rst_node;
- rst_ele = (axiom_element_t *) (axiom_node_get_data_element(rst_node, env));
-
- applies_to_qname = axutil_qname_create(env, TRUST_APPLIES_TO, TRUST_WSP_XMLNS, TRUST_WSP);
-
- appliesto_ele =
- axiom_element_get_first_child_with_qname(rst_ele, env, applies_to_qname, rst_node,
- &appliesto_node);
- if (appliesto_ele)
+ if(0 == axutil_strcmp(trust_context->wst_namespace, TRUST_WST_XMLNS_05_02))
{
- epr_ele = axiom_element_get_first_element(appliesto_ele, env, appliesto_node, &epr_node);
-
- trust_context->applies_to_epr_node = epr_node;
-
- if (!trust_context->addressing_namespace)
- {
- addr_namespace = axiom_element_find_namespace(epr_ele, env, epr_node, "http://schemas.xmlsoap.org/ws/2004/08/addressing", NULL);
- if(!addr_namespace)
- {
- addr_namespace = axiom_element_find_namespace(epr_ele, env, epr_node, "http://www.w3.org/2005/08/addressing", NULL);
- }
- if(addr_namespace)
- {
- trust_context->addressing_namespace = axiom_namespace_get_uri(addr_namespace, env);
- }
- }
-
- if (epr_ele && addr_namespace)
- {
- addr_qname =
- axutil_qname_create(env, EPR_ADDRESS, trust_context->addressing_namespace, NULL);
- addr_ele =
- axiom_element_get_first_child_with_qname(epr_ele, env, addr_qname, epr_node,
- &addr_node);
- if (addr_ele && axiom_element_get_text(addr_ele, env, addr_node))
- {
- trust_context->applies_to_address = axiom_element_get_text(addr_ele, env, addr_node);
- }
- }
- else
- {
- AXIS2_FREE(env->allocator, applies_to_qname);
- return AXIS2_FAILURE;
- }
-
+ trust_version = 1;
}
- else
+ if(0 == axutil_strcmp(trust_context->wst_namespace, TRUST_WST_XMLNS_05_12))
{
- AXIS2_FREE(env->allocator, applies_to_qname);
- return AXIS2_FAILURE;
+ trust_version = 2;
}
- AXIS2_FREE(env->allocator, applies_to_qname);
- return AXIS2_SUCCESS;
-}
-
-AXIS2_EXTERN axis2_status_t AXIS2_CALL
-trust_context_process_request_context(
- trust_context_t * trust_context,
- const axutil_env_t * env)
-{
- axiom_element_t *rst_ele = NULL;
- axutil_qname_t *attr_ctx_qname = NULL;
- axis2_char_t *context = NULL;
-
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-
- attr_ctx_qname = axutil_qname_create(env, TRUST_RST_CONTEXT, TRUST_WST_XMLNS, TRUST_WST);
- if (!attr_ctx_qname)
- return AXIS2_FAILURE;
-
- rst_ele = (axiom_element_t *) (axiom_node_get_data_element(trust_context->rst_node, env));
- context = axiom_element_get_attribute_value(rst_ele, env, attr_ctx_qname);
-
- if (context)
- {
- trust_context->rst_context_attr = context;
- AXIS2_FREE(env->allocator, attr_ctx_qname);
- return AXIS2_SUCCESS;
- }
- AXIS2_FREE(env->allocator, attr_ctx_qname);
- return AXIS2_FAILURE;
-}
-
-AXIS2_EXTERN axis2_status_t AXIS2_CALL
-trust_context_process_request_type(
- trust_context_t * trust_context,
- const axutil_env_t * env)
-{
- axiom_element_t *req_type_ele = NULL;
- axiom_element_t *rst_ele = NULL;
- axiom_node_t *rst_node = NULL;
- axiom_node_t *req_type_node = NULL;
- axutil_qname_t *req_type_qname = NULL;
-
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-
- rst_node = trust_context->rst_node;
- rst_ele = (axiom_element_t *) (axiom_node_get_data_element(rst_node, env));
-
- req_type_qname =
- axutil_qname_create(env, TRUST_REQUEST_TYPE, trust_context->wst_namespace, TRUST_WST);
-
- 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)
- {
- AXIS2_FREE(env->allocator, req_type_qname);
- return AXIS2_FAILURE;
- }
-
- trust_context->request_type = axiom_element_get_text(req_type_ele, env, req_type_node);
-
- AXIS2_FREE(env->allocator, req_type_qname);
- return AXIS2_SUCCESS;
-}
-
-AXIS2_EXTERN axis2_status_t AXIS2_CALL
-trust_context_process_token_type(
- trust_context_t * trust_context,
- const axutil_env_t * env)
-{
- axiom_node_t *token_type_node = NULL;
- axiom_element_t *token_type_ele = NULL;
- axiom_element_t *rst_ele = NULL;
- axutil_qname_t *token_type_qname = NULL;
-
- rst_ele = (axiom_element_t *) (axiom_node_get_data_element(trust_context->rst_node, env));
-
- token_type_qname =
- axutil_qname_create(env, TRUST_TOKEN_TYPE, trust_context->wst_namespace, TRUST_WST);
-
- token_type_ele =
- axiom_element_get_first_child_with_qname(rst_ele, env, token_type_qname,
- trust_context->rst_node, &token_type_node);
- if (!token_type_ele)
+
+ if(trust_version != -1)
{
- AXIS2_FREE(env->allocator, token_type_qname);
- return AXIS2_FAILURE;
+ trust_context->rst_context = trust_rst_context_create(trust_version, env);
+ if(AXIS2_SUCCESS == trust_rst_context_populate_rst(trust_context->rst_context, env, trust_context->rst_node))
+ {
+ return AXIS2_SUCCESS;
+ }
}
-
- trust_context->token_type = axiom_element_get_text(token_type_ele, env, token_type_node);
-
- AXIS2_FREE(env->allocator, token_type_qname);
- return AXIS2_SUCCESS;
+
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] Invalid WST Version in RST message");
+ return AXIS2_FAILURE;
}
AXIS2_EXTERN axis2_status_t AXIS2_CALL
-trust_context_process_claims(
- trust_context_t * trust_context,
- const axutil_env_t * env)
+trust_context_process_rstr(
+ const axutil_env_t * env,
+ trust_context_t *trust_context,
+ axis2_msg_ctx_t * in_msg_ctx)
{
- axiom_node_t *claims_node = NULL;
- axiom_element_t *claims_ele = NULL;
- axiom_element_t *rst_ele = NULL;
- axutil_qname_t *claims_qname = NULL;
- axutil_qname_t *attr_dialect_qname = NULL;
- axis2_char_t *dialect = NULL;
+ 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 *body_base_node = NULL;
+ axiom_element_t *rstr_ele = NULL;
+ int trust_version = -1;
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ /* 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);
+ body_base_node = axiom_soap_body_get_base_node(soap_body, env);
+ trust_context->rst_node = axiom_node_get_first_child(body_base_node, env);
- rst_ele = (axiom_element_t *) (axiom_node_get_data_element(trust_context->rst_node, env));
+ /* Processing SOAP Namespace */
+ soap_ns = axiom_soap_envelope_get_namespace(soap_env, env);
+ trust_context->soap_namespace = axiom_namespace_get_uri(soap_ns, env);
- claims_qname = axutil_qname_create(env, TRUST_CLAIMS, trust_context->wst_namespace, TRUST_WST);
+ rstr_ele = (axiom_element_t *) axiom_node_get_data_element(trust_context->rstr_node, env);
+ wst_ns = axiom_element_get_namespace(rstr_ele, env, trust_context->rstr_node);
+ trust_context->wst_namespace = axiom_namespace_get_uri(wst_ns, env);
- claims_ele =
- axiom_element_get_first_child_with_qname(rst_ele, env, claims_qname, trust_context->rst_node,
- &claims_node);
- if (!claims_ele)
+ if(0 == axutil_strcmp(trust_context->wst_namespace, TRUST_WST_XMLNS_05_02))
{
- AXIS2_FREE(env->allocator, claims_qname);
- return AXIS2_FAILURE;
+ trust_version = 1;
}
-
- trust_context->claims_node = claims_node;
-
- attr_dialect_qname =
- axutil_qname_create(env, TRUST_CLAIMS_DIALECT, trust_context->wst_namespace, TRUST_WST);
- if (!attr_dialect_qname)
+ if(0 == axutil_strcmp(trust_context->wst_namespace, TRUST_WST_XMLNS_05_12))
{
- AXIS2_FREE(env->allocator, claims_qname);
- return AXIS2_FAILURE;
+ trust_version = 2;
}
-
- dialect = axiom_element_get_attribute_value(claims_ele, env, attr_dialect_qname);
-
- if (!dialect)
+
+ if(trust_version != -1)
{
- AXIS2_FREE(env->allocator, claims_qname);
- AXIS2_FREE(env->allocator, attr_dialect_qname);
- return AXIS2_FAILURE;
+ trust_context->rstr_context = trust_rstr_context_create(trust_version, env);
+ if(AXIS2_SUCCESS == trust_rstr_context_populate_rstr(trust_context->rstr_context, env, trust_context->rstr_node))
+ {
+ return AXIS2_SUCCESS;
+ }
}
- trust_context->claims_dialect = dialect;
+
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] Invalid WST Version in RSTR message");
+ return AXIS2_FAILURE;
- AXIS2_FREE(env->allocator, claims_qname);
- AXIS2_FREE(env->allocator, attr_dialect_qname);
- return AXIS2_SUCCESS;
}
-AXIS2_EXTERN axis2_status_t AXIS2_CALL
-trust_context_process_entropy(
- trust_context_t * trust_context,
- const axutil_env_t * env)
-{
- /* TO DO: Complete the entropy processing */
- axiom_node_t *entropy_node = NULL;
- axiom_node_t *binary_secret_node = NULL;
- axiom_element_t *entropy_ele = NULL;
- axiom_element_t *rst_ele = NULL;
- axiom_element_t *binary_secret_ele = NULL;
- axutil_qname_t *entropy_qname = NULL;
- axis2_char_t *bin_sec_str = NULL;
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- rst_ele = (axiom_element_t *) (axiom_node_get_data_element(trust_context->rst_node, env));
-
- entropy_qname = axutil_qname_create(env, TRUST_ENTROPY, trust_context->wst_namespace, TRUST_WST);
-
- entropy_ele =
- axiom_element_get_first_child_with_qname(rst_ele, env, entropy_qname, trust_context->rst_node,
- &entropy_node);
- if (!entropy_ele)
- {
- AXIS2_FREE(env->allocator, entropy_qname);
- return AXIS2_FAILURE;
- }
-
- binary_secret_ele =
- axiom_element_get_first_element(entropy_ele, env, entropy_node, &binary_secret_node);
- bin_sec_str = axiom_element_get_text(binary_secret_ele, env, binary_secret_node);
-
- if (binary_secret_ele && bin_sec_str && (axutil_strcmp("", bin_sec_str) != 0))
- {
- /*axutil_base64_decode(trust_context->request_entropy, bin_sec_str);*/
- trust_context->request_entropy = bin_sec_str;
- }
- else
- {
- AXIS2_FREE(env->allocator, entropy_qname);
- return AXIS2_FAILURE;
- }
-
- return AXIS2_SUCCESS;
-}
-
-AXIS2_EXTERN axis2_status_t AXIS2_CALL
-trust_context_process_key_type(
- trust_context_t * data,
- const axutil_env_t * env)
+/*Build RST Node from created RST_CONTEXT */
+AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+trust_context_build_rst_node(
+ const axutil_env_t * env,
+ trust_context_t *trust_context)
{
- axiom_node_t *key_type_node = NULL;
- axiom_element_t *key_type_ele = NULL;
- axiom_element_t *rst_ele = NULL;
- axutil_qname_t *key_type_qname = NULL;
-
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ if(trust_context->rst_context)
+ {
+ trust_context->rst_node = trust_rst_context_build_rst(trust_context->rst_context, env, NULL);
+ if(trust_context->rst_node)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Node Not NULL");
+ }
+ else
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Node -- NULL");
+ }
- rst_ele = (axiom_element_t *) (axiom_node_get_data_element(data->rst_node, env));
-
- key_type_qname = axutil_qname_create(env, TRUST_KEY_TYPE, data->wst_namespace, TRUST_WST);
-
- key_type_ele =
- axiom_element_get_first_child_with_qname(rst_ele, env, key_type_qname, data->rst_node,
- &key_type_node);
- if (!key_type_ele)
- {
- AXIS2_FREE(env->allocator, key_type_qname);
- return AXIS2_FAILURE;
+ return trust_context->rst_node;
}
-
- data->key_type = axiom_element_get_text(key_type_ele, env, key_type_node);
-
- AXIS2_FREE(env->allocator, key_type_qname);
- return AXIS2_SUCCESS;
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] RST_OM -> RST node FAILED:RST_OM NULL");
+ return NULL;
}
-
-AXIS2_EXTERN axis2_status_t AXIS2_CALL
-trust_context_process_key_size(
- trust_context_t * data,
- const axutil_env_t * env)
+
+/*Build RSTR Node from created RSTR_CONTEXT */
+AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+trust_context_build_rstr_node(
+ const axutil_env_t * env,
+ trust_context_t *trust_context)
{
- axiom_node_t *key_size_node = NULL;
- axiom_element_t *key_size_ele = NULL;
- axiom_element_t *rst_ele = NULL;
- axutil_qname_t *key_size_qname = NULL;
- axis2_char_t *size_str = NULL;
-
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-
- rst_ele = (axiom_element_t *) (axiom_node_get_data_element(data->rst_node, env));
-
- key_size_qname = axutil_qname_create(env, TRUST_KEY_SIZE, data->wst_namespace, TRUST_WST);
-
- key_size_ele =
- axiom_element_get_first_child_with_qname(rst_ele, env, key_size_qname, data->rst_node,
- &key_size_node);
- if (!key_size_ele)
+ if(trust_context->rstr_context)
{
- AXIS2_FREE(env->allocator, key_size_qname);
- return AXIS2_FAILURE;
+ trust_context->rstr_node = trust_rstr_context_build_rstr(trust_context->rstr_context, env, NULL);
+ return trust_context->rstr_node;
}
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] RSTR_OM -> RSTR node FAILED:RSTR_OM NULL");
+ return NULL;
- size_str = axiom_element_get_text(key_size_ele, env, key_size_node);
-
- if (!size_str)
- {
- AXIS2_FREE(env->allocator, key_size_qname);
- return AXIS2_FAILURE;
- }
-
- data->key_size = atoi(size_str);
- AXIS2_FREE(env->allocator, key_size_qname);
- return AXIS2_SUCCESS;
}
-
-AXIS2_EXTERN axis2_char_t *AXIS2_CALL
-trust_context_get_request_type(
- trust_context_t * trust_context,
- const axutil_env_t * env)
+
+
+/*Get Populated RST_CONTEXT */
+AXIS2_EXTERN trust_rst_context_t* AXIS2_CALL
+trust_context_get_rst_context(
+ const axutil_env_t * env,
+ trust_context_t *trust_context)
{
- return trust_context->request_type;
+ if(trust_context)
+ return trust_context->rst_context;
+ return NULL;
}
-
-AXIS2_EXTERN axis2_status_t AXIS2_CALL
-trust_context_set_request_type(
- trust_context_t * trust_context,
- const axutil_env_t * env,
- axis2_char_t *request_type)
+
+/*Get Populated RSTR_CONTEXT */
+AXIS2_EXTERN trust_rstr_context_t* AXIS2_CALL
+ trust_context_get_rstr_context(
+ const axutil_env_t * env,
+ trust_context_t *trust_context)
{
- if(request_type)
+ if(trust_context)
{
- trust_context->request_type = request_type;
- return AXIS2_SUCCESS;
+ return trust_context->rstr_context;
}
-
- return AXIS2_FAILURE;
-}
-
-AXIS2_EXTERN axis2_char_t *AXIS2_CALL
-trust_context_get_token_type(
- trust_context_t * trust_context,
- const axutil_env_t * env)
-{
- return trust_context->token_type;
+ return NULL;
}
-
+
+/*Set RST_CONTEXT */
AXIS2_EXTERN axis2_status_t AXIS2_CALL
-trust_context_set_token_type(
- trust_context_t * trust_context,
+trust_context_set_rst(
const axutil_env_t * env,
- axis2_char_t *token_type)
+ trust_context_t *trust_context,
+ trust_rst_context_t *rst_context)
{
- if(token_type)
+ if(trust_context)
{
- trust_context->token_type = token_type;
+ trust_context->rst_context = rst_context;
return AXIS2_SUCCESS;
}
return AXIS2_FAILURE;
-}
-AXIS2_EXTERN axiom_node_t * AXIS2_CALL
-trust_context_get_rst_node(
- trust_context_t * trust_context,
- const axutil_env_t * env)
-{
- return trust_context->rst_node;
}
-
+
+/*Set RSTR_CONTEXT */
AXIS2_EXTERN axis2_status_t AXIS2_CALL
-trust_context_set_rst_node(
- trust_context_t * trust_context,
- const axutil_env_t * env,
- axiom_node_t *rst_node)
+trust_context_set_rstr(
+ const axutil_env_t * env,
+ trust_context_t *trust_context,
+ trust_rstr_context_t *rstr_context)
{
- if(rst_node)
+ if(trust_context)
{
- trust_context->rst_node = rst_node;
+ trust_context->rstr_context = rstr_context;
return AXIS2_SUCCESS;
}
-
return AXIS2_FAILURE;
}
-AXIS2_EXTERN axis2_char_t *AXIS2_CALL
-trust_context_get_wst_ns(
- trust_context_t * trust_context,
- const axutil_env_t * env)
-{
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-
- return trust_context->wst_namespace;
-}
-
-AXIS2_EXTERN axis2_char_t * AXIS2_CALL
-trust_context_get_appliesto_address(
- trust_context_t *trust_context,
- const axutil_env_t *env)
-{
- return trust_context->applies_to_address;
-}
-
-AXIS2_EXTERN axiom_node_t * AXIS2_CALL
-trust_context_get_appliesto_epr_node(
- trust_context_t *trust_context,
- const axutil_env_t *env)
-{
- return trust_context->applies_to_epr_node;
-}
-
-AXIS2_EXTERN axis2_char_t * AXIS2_CALL
-trust_context_get_rst_context_attr(
- trust_context_t *trust_context,
- const axutil_env_t *env)
-{
- return trust_context->rst_context_attr;
-}
-AXIS2_EXTERN axis2_char_t *AXIS2_CALL
-trust_context_get_key_type(
- trust_context_t *trust_context,
- const axutil_env_t *env)
-{
- return trust_context->key_type;
-}
-AXIS2_EXTERN int AXIS2_CALL
-trust_context_get_key_size(
- trust_context_t *trust_context,
- const axutil_env_t *env)
-{
- return trust_context->key_size;
-}
-AXIS2_EXTERN axis2_char_t * AXIS2_CALL
-trust_context_get_request_entropy(
- trust_context_t *trust_context,
- const axutil_env_t *env)
-{
- return trust_context->request_entropy;
-}
-AXIS2_EXTERN axiom_node_t * AXIS2_CALL
-trust_context_get_claims_node(
- trust_context_t *trust_context,
- const axutil_env_t *env)
-{
- return trust_context->claims_node;
-}
-
-AXIS2_EXTERN axis2_char_t * AXIS2_CALL
-trust_context_get_claims_dialect(
- trust_context_t * trust_context,
- const axutil_env_t *env)
-{
- return trust_context->claims_dialect;
-}
Modified: 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=602779&r1=602778&r2=602779&view=diff
==============================================================================
--- webservices/rampart/scratch/c/trust/c/src/trust/entropy.c (original)
+++ webservices/rampart/scratch/c/trust/c/src/trust/entropy.c Sun Dec 9 21:31:33 2007
@@ -26,6 +26,8 @@
axis2_char_t *binary_secret;
+ axis2_char_t *encrypted_key;
+
trust_bin_sec_type_t binsec_type;
axiom_node_t *other;
@@ -45,8 +47,7 @@
entropy->bin_sec = AXIS2_TRUE;
entropy->binary_secret = NULL;
entropy->binsec_type = SYMMETRIC;
- entropy->other = NULL;
- entropy->ns_uri = NULL;
+ entropy->encrypted_key = NULL;
return entropy;
}
@@ -129,14 +130,14 @@
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);
+ 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);
+ bin_sec_type = 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;
@@ -238,7 +239,7 @@
return AXIS2_FAILURE;
}
-trust_bin_sec_type_t AXIS2_CALL
+AXIS2_EXTERN trust_bin_sec_type_t AXIS2_CALL
trust_entropy_get_bin_sec_type_from_str(
axis2_char_t *str,
const axutil_env_t *env)
@@ -259,7 +260,7 @@
return BIN_SEC_TYPE_ERROR;
}
-axis2_char_t * AXIS2_CALL
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
trust_entropy_get_str_for_bin_sec_type(
trust_bin_sec_type_t type,
const axutil_env_t *env)
Modified: 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=602779&r1=602778&r2=602779&view=diff
==============================================================================
--- webservices/rampart/scratch/c/trust/c/src/trust/life_time.c (original)
+++ webservices/rampart/scratch/c/trust/c/src/trust/life_time.c Sun Dec 9 21:31:33 2007
@@ -20,12 +20,10 @@
struct trust_life_time
{
int ttl;
-
axutil_date_time_t *created;
-
axutil_date_time_t *expires;
-
axis2_char_t *wst_ns_uri;
+ axis2_char_t *wsu_ns_uri;
};
AXIS2_EXTERN trust_life_time_t * AXIS2_CALL
@@ -40,18 +38,20 @@
life_time->created = NULL;
life_time->expires = NULL;
life_time->wst_ns_uri = NULL;
-
+ life_time->wsu_ns_uri = NULL;
+
return life_time;
}
AXIS2_EXTERN axis2_status_t AXIS2_CALL
-trust_life_time_free(
+ 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,
@@ -76,7 +76,7 @@
if(life_time_ele)
{
created_qname = axutil_qname_create(env, TRUST_LIFE_TIME_CREATED, TRUST_WSU_XMLNS, TRUST_WSU);
- if(created_qname)
+ if(!created_qname)
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] Created Qname creation failed.");
return AXIS2_FAILURE;
@@ -103,7 +103,7 @@
}
expires_qname = axutil_qname_create(env, TRUST_LIFE_TIME_EXPIRES, TRUST_WSU_XMLNS, TRUST_WSU);
- if(created_qname)
+ if(!created_qname)
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] Expires Qname creation failed.");
return AXIS2_FAILURE;
@@ -153,9 +153,9 @@
axis2_char_t *created_str = NULL;
axis2_char_t *expires_str = NULL;
- if(life_time->ttl != -1 && life_time->ttl>0)
+ 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);
+ 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.");