You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rampart-dev@ws.apache.org by su...@apache.org on 2008/02/12 09:21:38 UTC
svn commit: r620722 [1/2] - in /webservices/rampart/trunk/c: build/win32/
include/ samples/client/issued_token/ samples/secpolicy/
samples/secpolicy/scenario20/ samples/server/saml_sts/ src/trust/ src/util/
Author: supun
Date: Tue Feb 12 00:21:23 2008
New Revision: 620722
URL: http://svn.apache.org/viewvc?rev=620722&view=rev
Log:
This patch includes changes to the
1. rampart_config_t for setting a callback function for acquiring an issued token
2. Added two files rampart_issued.c and rampart_issued_token.c to handle the issued tokens
3. Added a scenario20 for demonstrating the issued token aquisition.
4. A bug fix in the rampart_context_get_supporting_token function.
5. Changes to the windows build system for buidlign the saml_sts service and issued_token client.
Added:
webservices/rampart/trunk/c/include/rampart_issued.h
webservices/rampart/trunk/c/include/rampart_issued_token.h
webservices/rampart/trunk/c/samples/client/issued_token/
webservices/rampart/trunk/c/samples/client/issued_token/echo.c
webservices/rampart/trunk/c/samples/secpolicy/scenario20/
webservices/rampart/trunk/c/samples/secpolicy/scenario20/client-policy.xml
webservices/rampart/trunk/c/samples/secpolicy/scenario20/services.xml
webservices/rampart/trunk/c/samples/secpolicy/scenario20/sts-client-policy.xml
webservices/rampart/trunk/c/samples/secpolicy/scenario20/sts-services.xml
webservices/rampart/trunk/c/samples/server/saml_sts/server_axis2.xml
webservices/rampart/trunk/c/src/util/rampart_issued.c
webservices/rampart/trunk/c/src/util/rampart_issued_token.c
Modified:
webservices/rampart/trunk/c/build/win32/deploy_rampart.bat
webservices/rampart/trunk/c/build/win32/makefile
webservices/rampart/trunk/c/include/rampart_config.h
webservices/rampart/trunk/c/include/rampart_context.h
webservices/rampart/trunk/c/include/rampart_saml.h
webservices/rampart/trunk/c/include/rampart_signature.h
webservices/rampart/trunk/c/include/trust_rst.h
webservices/rampart/trunk/c/samples/secpolicy/run_all.js
webservices/rampart/trunk/c/samples/server/saml_sts/services.xml
webservices/rampart/trunk/c/src/trust/rst.c
webservices/rampart/trunk/c/src/util/rampart_config.c
webservices/rampart/trunk/c/src/util/rampart_context.c
webservices/rampart/trunk/c/src/util/rampart_engine.c
webservices/rampart/trunk/c/src/util/rampart_saml.c
webservices/rampart/trunk/c/src/util/rampart_sec_header_builder.c
webservices/rampart/trunk/c/src/util/rampart_sec_header_processor.c
webservices/rampart/trunk/c/src/util/rampart_signature.c
Modified: webservices/rampart/trunk/c/build/win32/deploy_rampart.bat
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/build/win32/deploy_rampart.bat?rev=620722&r1=620721&r2=620722&view=diff
==============================================================================
--- webservices/rampart/trunk/c/build/win32/deploy_rampart.bat (original)
+++ webservices/rampart/trunk/c/build/win32/deploy_rampart.bat Tue Feb 12 00:21:23 2008
@@ -15,6 +15,10 @@
copy bin\samples\services\secconv_echo\secconv_echo.dll %AXIS2C_HOME%\services\secconv_echo\
copy bin\samples\services\secconv_echo\services.xml %AXIS2C_HOME%\services\secconv_echo\
+md %AXIS2C_HOME%\services\saml_sts\
+copy bin\samples\services\saml_sts\saml_sts.dll %AXIS2C_HOME%\services\saml_sts\
+copy bin\samples\services\saml_sts\services.xml %AXIS2C_HOME%\services\saml_sts\
+
md %AXIS2C_HOME%\bin\samples\rampart\
md %AXIS2C_HOME%\bin\samples\rampart\authn_provider\
copy bin\samples\authn_provider\authn.dll %AXIS2C_HOME%\bin\samples\rampart\authn_provider\
@@ -35,6 +39,9 @@
md %AXIS2C_HOME%\bin\samples\rampart\client\saml_echo\
copy bin\samples\client\saml_echo\echo.exe %AXIS2C_HOME%\bin\samples\rampart\client\saml_echo\
+
+md %AXIS2C_HOME%\bin\samples\rampart\client\issued_token\
+copy bin\samples\client\issued_token\echo.exe %AXIS2C_HOME%\bin\samples\rampart\client\issued_token\
md %AXIS2C_HOME%\bin\samples\rampart\callback
copy bin\samples\callback\pwcb.dll %AXIS2C_HOME%\bin\samples\rampart\callback\
Modified: webservices/rampart/trunk/c/build/win32/makefile
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/build/win32/makefile?rev=620722&r1=620721&r2=620722&view=diff
==============================================================================
--- webservices/rampart/trunk/c/build/win32/makefile (original)
+++ webservices/rampart/trunk/c/build/win32/makefile Tue Feb 12 00:21:23 2008
@@ -93,8 +93,10 @@
mkdir $(RAMPART_DISTDIR)\bin\samples\sct_provider
mkdir $(RAMPART_DISTDIR)\bin\samples\services\sec_echo
mkdir $(RAMPART_DISTDIR)\bin\samples\services\secconv_echo
+ mkdir $(RAMPART_DISTDIR)\bin\samples\services\saml_sts
mkdir $(RAMPART_DISTDIR)\bin\samples\client\sec_echo
mkdir $(RAMPART_DISTDIR)\bin\samples\client\saml_echo
+ mkdir $(RAMPART_DISTDIR)\bin\samples\client\issued_token
mkdir $(RAMPART_DISTDIR)\bin\samples\client\sec_echo\data
mkdir $(RAMPART_DISTDIR)\bin\samples\credential_provider
mkdir $(RAMPART_DISTDIR)\bin\samples\data
@@ -114,8 +116,10 @@
if not exist $(RAMPART_INTDIR)\samples\sct_provider mkdir $(RAMPART_INTDIR)\samples\sct_provider
if not exist $(RAMPART_INTDIR)\samples\services\sec_echo\ mkdir $(RAMPART_INTDIR)\samples\services\sec_echo
if not exist $(RAMPART_INTDIR)\samples\services\secconv_echo\ mkdir $(RAMPART_INTDIR)\samples\services\secconv_echo
+ if not exist $(RAMPART_INTDIR)\samples\services\saml_sts\ mkdir $(RAMPART_INTDIR)\samples\services\saml_sts
if not exist $(RAMPART_INTDIR)\samples\client\sec_echo\ mkdir $(RAMPART_INTDIR)\samples\client\sec_echo
if not exist $(RAMPART_INTDIR)\samples\client\saml_echo\ mkdir $(RAMPART_INTDIR)\samples\client\saml_echo
+ if not exist $(RAMPART_INTDIR)\samples\client\issued_token\ mkdir $(RAMPART_INTDIR)\samples\client\issued_token
if not exist $(RAMPART_INTDIR)\samples\credential_provider\ mkdir $(RAMPART_INTDIR)\samples\credential_provider
mod_rampart_sample_data:
@@ -197,6 +201,22 @@
mod_rampart_services_sec_echo: $(RAMPART_DISTDIR)\bin\samples\services\sec_echo\sec_echo.dll
+
+$(RAMPART_DISTDIR)\bin\samples\services\saml_sts\saml_sts.dll :
+ $(CC) $(CFLAGS) $(MOD_RAMPART_INCLUDE_PATH) /I$(RAMPART_SOURCE_DIR)\samples\server\saml_sts \
+ $(RAMPART_SOURCE_DIR)\samples\server\saml_sts\*.c /Fo$(RAMPART_INTDIR)\samples\services\saml_sts\ /c
+ $(LD) $(LDFLAGS) $(RAMPART_INTDIR)\samples\services\saml_sts\*.obj \
+ axutil.lib axiom.lib axis2_parser.lib $(LIBS) axis2_engine.lib /LIBPATH:$(RAMPART_DISTDIR)\modules\rampart\ \
+ axis2_http_receiver.lib axis2_http_sender.lib mod_rampart.lib \
+ /DLL /OUT:$(RAMPART_DISTDIR)\bin\samples\services\saml_sts\saml_sts.dll
+ -@$(_VC_MANIFEST_EMBED_DLL)
+
+ copy $(RAMPART_SOURCE_DIR)\samples\server\saml_sts\services.xml $(RAMPART_DISTDIR)\bin\samples\services\saml_sts\
+
+ copy $(RAMPART_SOURCE_DIR)\samples\server\sec_echo\server_axis2.xml $(RAMPART_DISTDIR)\bin\samples\services\saml_sts\
+
+mod_rampart_services_saml_sts: $(RAMPART_DISTDIR)\bin\samples\services\saml_sts\saml_sts.dll
+
$(RAMPART_DISTDIR)\bin\samples\services\secconv_echo\secconv_echo.dll :
$(CC) $(CFLAGS) $(MOD_RAMPART_INCLUDE_PATH) /I$(RAMPART_SOURCE_DIR)\samples\server\secconv_echo \
$(RAMPART_SOURCE_DIR)\samples\server\secconv_echo\*.c /Fo$(RAMPART_INTDIR)\samples\services\secconv_echo\ /c
@@ -236,6 +256,16 @@
mod_rampart_samples_saml_echo: $(RAMPART_DISTDIR)\bin\samples\client\saml_echo\echo.exe
+$(RAMPART_DISTDIR)\bin\samples\client\issued_token\echo.exe :
+ $(CC) $(CFLAGS) $(MOD_RAMPART_INCLUDE_PATH) \
+ $(RAMPART_SOURCE_DIR)\samples\client\issued_token\echo.c \
+ /Fo$(RAMPART_INTDIR)\samples\client\issued_token\ /c
+ $(LD) $(LDFLAGS) $(RAMPART_INTDIR)\samples\client\issued_token\echo.obj axutil.lib axiom.lib neethi.lib \
+ axis2_parser.lib axis2_engine.lib /LIBPATH:$(RAMPART_DISTDIR)\modules\rampart mod_rampart.lib /OUT:$(RAMPART_DISTDIR)\bin\samples\client\issued_token\echo.exe
+ -@$(_VC_MANIFEST_EMBED_EXE)
+
+mod_rampart_samples_issued_token: $(RAMPART_DISTDIR)\bin\samples\client\issued_token\echo.exe
+
$(RAMPART_DISTDIR)\bin\samples\credential_provider\cred_provider.dll :
$(CC) $(CFLAGS) $(MOD_RAMPART_INCLUDE_PATH) \
$(RAMPART_SOURCE_DIR)\samples\credential_provider\*.c \
@@ -290,7 +320,7 @@
copy_docs:
if exist $(RAMPART_SOURCE_DIR)\docs xcopy /E /I /Y $(RAMPART_SOURCE_DIR)\docs $(RAMPART_DISTDIR)\docs
-dist: clean distdir intdirs mod_rampart mod_rampart_pwcb mod_rampart_authn mod_rampart_rd mod_rampart_sct_provider mod_rampart_sct_provider_hashdb mod_rampart_services_sec_echo mod_rampart_services_secconv_echo mod_rampart_samples_sec_echo mod_rampart_samples_saml_echo mod_rampart_samples_credential_provider mod_rampart_copy_deploy mod_rampart_copy_include copy_dist_files copy_sec_policy mod_rampart_copy_keys del_am mod_rampart_sample_data copy_docs
+dist: clean distdir intdirs mod_rampart mod_rampart_pwcb mod_rampart_authn mod_rampart_rd mod_rampart_sct_provider mod_rampart_sct_provider_hashdb mod_rampart_services_sec_echo mod_rampart_services_secconv_echo mod_rampart_services_saml_sts mod_rampart_samples_sec_echo mod_rampart_samples_saml_echo mod_rampart_samples_issued_token mod_rampart_samples_credential_provider mod_rampart_copy_deploy mod_rampart_copy_include copy_dist_files copy_sec_policy mod_rampart_copy_keys del_am mod_rampart_sample_data copy_docs
dist_no_samples: clean distdir intdirs mod_rampart mod_rampart_copy_include copy_dist_files
Modified: webservices/rampart/trunk/c/include/rampart_config.h
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/rampart_config.h?rev=620722&r1=620721&r2=620722&view=diff
==============================================================================
--- webservices/rampart/trunk/c/include/rampart_config.h (original)
+++ webservices/rampart/trunk/c/include/rampart_config.h Tue Feb 12 00:21:23 2008
@@ -40,6 +40,7 @@
#include <oxs_key.h>
#include <axutil_array_list.h>
#include <rampart_saml_token.h>
+#include <rampart_issued_token.h>
#ifdef __cplusplus
extern "C"
@@ -98,6 +99,11 @@
const axutil_env_t *env,
rampart_saml_token_t *saml);
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rampart_config_set_issued_token_aquire_function(rampart_config_t *rampart_config,
+ const axutil_env_t *env,
+ issued_token_callback_func issued_token_aquire);
+
AXIS2_EXTERN axis2_char_t *AXIS2_CALL
rampart_config_get_username(
rampart_config_t *rampart_config,
@@ -120,6 +126,10 @@
AXIS2_EXTERN axutil_array_list_t * AXIS2_CALL
rampart_config_get_saml_tokens(rampart_config_t *rampart_config,
+ const axutil_env_t *env);
+
+ AXIS2_EXTERN issued_token_callback_func AXIS2_CALL
+ rampart_config_get_issued_token_aquire_function(rampart_config_t *rampart_config,
const axutil_env_t *env);
/*End of Getters */
Modified: webservices/rampart/trunk/c/include/rampart_context.h
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/rampart_context.h?rev=620722&r1=620721&r2=620722&view=diff
==============================================================================
--- webservices/rampart/trunk/c/include/rampart_context.h (original)
+++ webservices/rampart/trunk/c/include/rampart_context.h Tue Feb 12 00:21:23 2008
@@ -40,6 +40,7 @@
#include <oxs_key.h>
#include <axutil_array_list.h>
#include <rampart_saml_token.h>
+#include <rampart_issued_token.h>
#ifdef __cplusplus
extern "C"
@@ -72,8 +73,7 @@
const char *digest,
void *ctx);
-
-
+
/**
* Create a rampart_context.rampart_context is the wrapper
* of secpolicy and the main configuration for rampart.
@@ -404,20 +404,21 @@
rampart_context_t *rampart_context,
const axutil_env_t *env);
- AXIS2_EXTERN axis2_bool_t AXIS2_CALL
- rampart_context_is_include_supporting_saml_token(
- rampart_context_t *rampart_context, axis2_bool_t server_side,
- axis2_bool_t is_inpath, const axutil_env_t *env);
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rampart_context_is_include_supporting_token(
+ rampart_context_t *rampart_context, const axutil_env_t *env,
+ axis2_bool_t server_side, axis2_bool_t is_inpath,
+ rp_property_type_t token_type);
AXIS2_EXTERN axis2_bool_t AXIS2_CALL
rampart_context_is_include_protection_saml_token(
rampart_context_t *rampart_context, axis2_bool_t server_side,
axis2_bool_t is_inpath, const axutil_env_t *env);
- AXIS2_EXTERN rp_saml_token_t * AXIS2_CALL
- rampart_context_get_supporting_saml_token(
- rampart_context_t *rampart_context,
- const axutil_env_t *env);
+ AXIS2_EXTERN rp_property_t * AXIS2_CALL
+ rampart_context_get_supporting_token(
+ rampart_context_t *rampart_context,
+ const axutil_env_t *env, rp_property_type_t token_type);
AXIS2_EXTERN axis2_char_t *AXIS2_CALL
rampart_context_get_password_callback_class(
@@ -646,23 +647,6 @@
const axutil_env_t *env,
axis2_char_t *sct_id);
- /**
- * Set weather the issued token is aquired or not. When setting this to
- * true issued token must be set to the rampart context.
- */
- AXIS2_EXTERN axis2_bool_t AXIS2_CALL
- rampart_context_set_issued_token_aquired(
- rampart_context_t *rampart_context,
- const axutil_env_t *env,
- axis2_bool_t acquired);
-
- /**
- * Returns true when the issued token is been set in the rampart context.
- */
- AXIS2_EXTERN axis2_bool_t AXIS2_CALL
- rampart_context_is_issued_token_aquired(
- rampart_context_t *rampart_context,
- const axutil_env_t *env);
/* Return the saml token of token type set in the rampart context */
AXIS2_EXTERN rampart_saml_token_t * AXIS2_CALL
@@ -680,6 +664,17 @@
rampart_context_set_saml_tokens(rampart_context_t *rampart_context,
const axutil_env_t *env,
axutil_array_list_t *tokens);
+
+ AXIS2_EXTERN issued_token_callback_func AXIS2_CALL
+ rampart_context_get_issued_token_aquire_function(
+ rampart_context_t *rampart_context,
+ const axutil_env_t *env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rampart_context_set_issued_token_aquire_function(
+ rampart_context_t *rampart_context,
+ const axutil_env_t *env,
+ issued_token_callback_func issued_token_aquire);
#ifdef __cplusplus
}
Added: webservices/rampart/trunk/c/include/rampart_issued.h
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/rampart_issued.h?rev=620722&view=auto
==============================================================================
--- webservices/rampart/trunk/c/include/rampart_issued.h (added)
+++ webservices/rampart/trunk/c/include/rampart_issued.h Tue Feb 12 00:21:23 2008
@@ -0,0 +1,40 @@
+/*
+ * 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 RAMPART_ISSUED_H
+#define RAMPART_ISSUED_H
+
+#include <rampart_context.h>
+#include <rampart_issued_token.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rampart_issued_supporting_token_build(rampart_context_t *rampart_context,
+ const axutil_env_t *env, axiom_node_t *sec_node,
+ axutil_array_list_t *sign_parts);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
\ No newline at end of file
Added: webservices/rampart/trunk/c/include/rampart_issued_token.h
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/rampart_issued_token.h?rev=620722&view=auto
==============================================================================
--- webservices/rampart/trunk/c/include/rampart_issued_token.h (added)
+++ webservices/rampart/trunk/c/include/rampart_issued_token.h Tue Feb 12 00:21:23 2008
@@ -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
+ */
+
+#ifndef RAMPART_ISSUED_TOKEN_H
+#define RAMPART_ISSUED_TOKEN_H
+
+#include <rp_property.h>
+#include <rp_includes.h>
+#include <rp_secpolicy.h>
+#include <axutil_property.h>
+#include <axis2_key_type.h>
+#include <axis2_msg_ctx.h>
+#include <axutil_array_list.h>
+#include <axiom.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+typedef struct rampart_issued_token_t rampart_issued_token_t;
+
+typedef rampart_issued_token_t *(AXIS2_CALL *
+ issued_token_callback_func)(const axutil_env_t *env,
+ rp_property_t *issued_token,
+ void *ctx);
+
+AXIS2_EXTERN rampart_issued_token_t * AXIS2_CALL
+rampart_issued_token_create(const axutil_env_t *env);
+
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rampart_issued_token_free(rampart_issued_token_t *token,
+ axutil_env_t *env);
+
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rampart_issued_token_set_token(rampart_issued_token_t *issued_token,
+ axutil_env_t *env, void *token,
+ rp_property_type_t token_type);
+
+
+AXIS2_EXTERN rp_property_type_t AXIS2_CALL
+rampart_issued_token_get_token_type(rampart_issued_token_t *token,
+ axutil_env_t *env);
+
+
+AXIS2_EXTERN void * AXIS2_CALL
+rampart_issued_token_get_token(rampart_issued_token_t *token,
+ axutil_env_t *env);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
Modified: webservices/rampart/trunk/c/include/rampart_saml.h
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/rampart_saml.h?rev=620722&r1=620721&r2=620722&view=diff
==============================================================================
--- webservices/rampart/trunk/c/include/rampart_saml.h (original)
+++ webservices/rampart/trunk/c/include/rampart_saml.h Tue Feb 12 00:21:23 2008
@@ -53,10 +53,11 @@
AXIS2_EXTERN axis2_status_t AXIS2_CALL
rampart_saml_supporting_token_build(const axutil_env_t *env,
rampart_context_t *rampart_context,
- axiom_node_t *sec_node);
+ axiom_node_t *sec_node,
+ axutil_array_list_t *sign_parts);
AXIS2_EXTERN axis2_status_t AXIS2_CALL
-rampart_saml_token_validate(axutil_env_t *env,
+rampart_saml_token_validate(const axutil_env_t *env,
rampart_context_t *rampart_context,
axiom_node_t *assertion);
Modified: webservices/rampart/trunk/c/include/rampart_signature.h
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/rampart_signature.h?rev=620722&r1=620721&r2=620722&view=diff
==============================================================================
--- webservices/rampart/trunk/c/include/rampart_signature.h (original)
+++ webservices/rampart/trunk/c/include/rampart_signature.h Tue Feb 12 00:21:23 2008
@@ -65,7 +65,8 @@
axis2_msg_ctx_t *msg_ctx,
rampart_context_t *rampart_context,
axiom_soap_envelope_t *soap_envelope,
- axiom_node_t *sec_node);
+ axiom_node_t *sec_node,
+ axutil_array_list_t *sign_parts_list);
Modified: webservices/rampart/trunk/c/include/trust_rst.h
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/trust_rst.h?rev=620722&r1=620721&r2=620722&view=diff
==============================================================================
--- webservices/rampart/trunk/c/include/trust_rst.h (original)
+++ webservices/rampart/trunk/c/include/trust_rst.h Tue Feb 12 00:21:23 2008
@@ -28,6 +28,7 @@
#include <trust_entropy.h>
#include <trust_claims.h>
#include <trust_life_time.h>
+#include <rp_issued_token.h>
#ifdef __cplusplus
extern "C"
@@ -54,7 +55,12 @@
trust_rst_t *rst,
const axutil_env_t *env,
axiom_node_t *parent);
-
+
+ AXIS2_EXTERN axiom_node_t * AXIS2_CALL
+ trust_rst_build_rst_with_issued_token_assertion(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ rp_issued_token_t *issued_token);
/* Getters & Setters */
AXIS2_EXTERN axis2_char_t * AXIS2_CALL
Added: webservices/rampart/trunk/c/samples/client/issued_token/echo.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/samples/client/issued_token/echo.c?rev=620722&view=auto
==============================================================================
--- webservices/rampart/trunk/c/samples/client/issued_token/echo.c (added)
+++ webservices/rampart/trunk/c/samples/client/issued_token/echo.c Tue Feb 12 00:21:23 2008
@@ -0,0 +1,309 @@
+/*
+ * 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 <stdio.h>
+#include <axiom.h>
+#include <axis2_util.h>
+#include <axiom_soap.h>
+#include <axis2_client.h>
+#include <rampart_constants.h>
+#include <neethi_util.h>
+#include <neethi_policy.h>
+#include <saml.h>
+#include <rampart_config.h>
+#include <rampart_saml_token.h>
+#include <rampart_context.h>
+#include <trust_rst.h>
+#include <trust_rstr.h>
+
+axiom_node_t *
+build_om_payload_for_echo_svc(const axutil_env_t *env);
+
+rampart_issued_token_t * AXIS2_CALL
+get_issued_token(axutil_env_t *env, rp_property_t *issued_token, rampart_context_t *rampart_context);
+
+axis2_char_t *policy_file = NULL;
+axis2_char_t *sts_ploicy = NULL;
+const axis2_char_t *client_home = NULL;
+
+int main(int argc, char** argv)
+{
+ const axutil_env_t *env = NULL;
+ const axis2_char_t *address = NULL;
+ axis2_char_t *file_name = NULL;
+ axis2_endpoint_ref_t* endpoint_ref = NULL;
+ axis2_options_t *options = NULL;
+ axis2_svc_client_t* svc_client = NULL;
+ axiom_node_t *payload = NULL;
+ axiom_node_t *ret_node = NULL;
+ axis2_status_t status = AXIS2_FAILURE;
+ neethi_policy_t *policy = NULL;
+ rampart_config_t* client_config = NULL;
+ axutil_property_t *property = NULL;
+
+ /* 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:9090/axis2/services/echo";
+ if (argc > 2)
+ {
+ address = argv[1];
+ client_home = argv[2];
+ printf("Using endpoint : %s\n", address);
+ printf("Using client_home : %s\n", client_home);
+ }
+
+ if (axutil_strcmp(address, "-h") == 0)
+ {
+ printf("Usage : %s [endpoint_url] [client_home]\n", argv[0]);
+ printf("use -h for help\n");
+ return 0;
+ }
+
+ /* Create end-point-reference with given address */
+ endpoint_ref = axis2_endpoint_ref_create(env, address);
+
+ /* Setup options */
+ options = axis2_options_create(env);
+ axis2_options_set_to(options, env, endpoint_ref);
+ axis2_options_set_action(options, env,
+ "http://example.com/ws/2004/09/policy/Test/EchoRequest");
+ /*axis2_options_set_action(options, env,
+ "urn:echo");*/
+
+
+ /*If the client home is not specified, use the AXIS2C_HOME*/
+ if (!client_home)
+ {
+ client_home = AXIS2_GETENV("AXIS2C_HOME");
+ printf("\nNo client_home specified. Using default %s", client_home);
+ }
+
+ /* Create service client */
+ printf("client_home= %s", client_home);
+ svc_client = axis2_svc_client_create(env, client_home);
+ if (!svc_client)
+ {
+ printf("Error creating service client\n");
+ return -1;
+ }
+
+ client_config = rampart_config_create(env);
+ if(!client_config)
+ {
+ printf("Cannot create rampart config\n");
+ return 0;
+ }
+
+ rampart_config_set_issued_token_aquire_function(client_config, env, get_issued_token);
+
+ property = axutil_property_create_with_args(env, AXIS2_SCOPE_REQUEST ,
+ AXIS2_TRUE, (void *)rampart_config_free, client_config);
+ axis2_options_set_property(options, env, RAMPART_CLIENT_CONFIGURATION, property);
+
+ /* Set service client options */
+ axis2_svc_client_set_options(svc_client, env, options);
+
+ /*We need to specify the client's policy file location*/
+ if(client_home)
+ {
+ file_name = axutil_stracat(env, client_home, AXIS2_PATH_SEP_STR);
+ policy_file = axutil_stracat(env, file_name, "policy.xml");
+ sts_ploicy = axutil_stracat(env, file_name, "sts_policy.xml");
+ AXIS2_FREE(env->allocator, file_name);
+ file_name = NULL;
+ }else{
+ printf("Client Home not Specified\n");
+ printf("echo client invoke FAILED!\n");
+ return 0;
+ }
+ /*Create the policy, from file*/
+ policy = neethi_util_create_policy_from_file(env, policy_file);
+ if(policy_file){
+ AXIS2_FREE(env->allocator, policy_file);
+ policy_file = NULL;
+ }
+ if(!policy)
+ {
+ printf("\nPolicy creation failed from the file. %s\n", policy_file);
+ }
+
+ status = axis2_svc_client_set_policy(svc_client, env, policy);
+
+ if(status == AXIS2_FAILURE)
+ {
+ printf("Policy setting failed\n");
+ }
+ /* Build the SOAP request message payload using OM API.*/
+ payload = build_om_payload_for_echo_svc(env);
+
+ /*If not engaged in the client's axis2.xml, uncomment this line*/
+ /*axis2_svc_client_engage_module(svc_client, env, "rampart");*/
+
+ /* Send request */
+ ret_node = axis2_svc_client_send_receive(svc_client, env, payload);
+
+ if (axis2_svc_client_get_last_response_has_fault(svc_client, env))
+ {
+ axiom_soap_envelope_t *soap_envelope = NULL;
+ axiom_soap_body_t *soap_body = NULL;
+ axiom_soap_fault_t *soap_fault = NULL;
+
+ printf ("\nResponse has a SOAP fault\n");
+ soap_envelope =
+ axis2_svc_client_get_last_response_soap_envelope(svc_client, env);
+ if (soap_envelope)
+ soap_body = axiom_soap_envelope_get_body(soap_envelope, env);
+ if (soap_body)
+ soap_fault = axiom_soap_body_get_fault(soap_body, env);
+ if (soap_fault)
+ {
+ printf("\nReturned SOAP fault: %s\n",
+ axiom_node_to_string(axiom_soap_fault_get_base_node(soap_fault,env),
+ env));
+ }
+ printf("echo client invoke FAILED!\n");
+ return -1;
+ }
+
+ 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("\necho client invoke SUCCESSFUL!\n");
+ AXIS2_FREE(env->allocator, om_str);
+ ret_node = NULL;
+ }
+ else
+ {
+ printf("echo client invoke FAILED!\n");
+ return -1;
+ }
+
+ 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;
+}
+
+/* build SOAP request message content using OM */
+axiom_node_t *
+build_om_payload_for_echo_svc(const axutil_env_t *env)
+{
+ axiom_node_t *echo_om_node = NULL;
+ axiom_element_t* echo_om_ele = NULL;
+ axiom_node_t* text_om_node = NULL;
+ axiom_element_t * text_om_ele = NULL;
+ axiom_namespace_t *ns1 = NULL;
+ axis2_char_t *om_str = NULL;
+
+ ns1 = axiom_namespace_create(env, "http://ws.apache.org/rampart/c/samples", "ns1");
+ echo_om_ele = axiom_element_create(env, NULL, "echoIn", ns1, &echo_om_node);
+
+
+ text_om_ele = axiom_element_create(env, echo_om_node, "text", NULL, &text_om_node);
+ axiom_element_set_text(text_om_ele, env, "Hello", text_om_node);
+
+ om_str = axiom_node_to_string(echo_om_node, env);
+ if (om_str){
+ printf("\nSending OM : %s\n", om_str);
+ AXIS2_FREE(env->allocator, om_str);
+ om_str = NULL;
+ }
+ return echo_om_node;
+}
+
+
+rampart_issued_token_t * AXIS2_CALL
+get_issued_token(axutil_env_t *env, rp_property_t *issued_token, rampart_context_t *rampart_context)
+{
+ axis2_endpoint_ref_t *endpoint_ref = NULL;
+ axis2_options_t *options = NULL;
+ axis2_svc_client_t *svc_client = NULL;
+
+ axiom_node_t *rst_node = NULL;
+ axiom_node_t *return_rstr_node = NULL;
+ trust_rstr_t *rstr = NULL;
+ axiom_node_t *assertion = NULL;
+ rampart_saml_token_t *saml = NULL;
+ rampart_issued_token_t *token = NULL;
+ axis2_op_client_t* op_client = NULL;
+ axis2_msg_ctx_t *in_msg_ctx = NULL;
+ axis2_status_t status = AXIS2_SUCCESS;
+ neethi_policy_t *issuer_policy = NULL;
+
+ rp_issued_token_t *it = (rp_issued_token_t *)rp_property_get_value(issued_token, env);
+ /*Setting Issuer's EPR*/
+ endpoint_ref = endpoint_ref = axis2_endpoint_ref_create(env, "http://127.0.0.1:9090/axis2/services/saml_sts");
+ options = axis2_options_create(env);
+ axis2_options_set_to(options, env, endpoint_ref);
+ /*Create the policy, from file*/
+ issuer_policy = neethi_util_create_policy_from_file(env, sts_ploicy);
+ if(!issuer_policy)
+ {
+ printf("\nPolicy creation failed from the file. %s\n", policy_file);
+ }
+ /*axis2_options_set_action(options, env, action); WSA Action*/
+ svc_client = axis2_svc_client_create(env, client_home);
+
+ if (!svc_client)
+ {
+ 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 NULL;
+ }
+ axis2_options_set_action(options, env, "http://example.com/ws/2004/09/policy/Test/EchoRequest");
+ /* Set service client options */
+ axis2_svc_client_set_options(svc_client, env, options);
+
+ rst_node = trust_rst_build_rst_with_issued_token_assertion(NULL, env, it);
+ if (status == AXIS2_SUCCESS)
+ {
+ status = axis2_svc_client_set_policy(svc_client, env, issuer_policy);
+ if (status == AXIS2_FAILURE)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Policy setting failed.");
+ }
+ /*Building the RST */
+ if(rst_node)
+ {
+ return_rstr_node = axis2_svc_client_send_receive(svc_client, env, rst_node);
+ rstr = trust_rstr_create(env);
+ trust_rstr_set_wst_ns_uri(rstr, env, "http://schemas.xmlsoap.org/ws/2005/02/trust");
+ trust_rstr_populate_rstr(rstr, env, return_rstr_node);
+ assertion = trust_rstr_get_requested_security_token(rstr, env);
+ }
+ }
+ saml = rampart_saml_token_create(env, assertion, RAMPART_ST_CONFIR_TYPE_SENDER_VOUCHES);
+ rampart_saml_token_set_token_type(saml, env, RP_PROPERTY_SIGNED_SUPPORTING_TOKEN);
+ token = rampart_issued_token_create(env);
+ rampart_issued_token_set_token(token, env, saml, RP_PROPERTY_SAML_TOKEN);
+ return token;
+}
\ No newline at end of file
Modified: webservices/rampart/trunk/c/samples/secpolicy/run_all.js
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/samples/secpolicy/run_all.js?rev=620722&r1=620721&r2=620722&view=diff
==============================================================================
--- webservices/rampart/trunk/c/samples/secpolicy/run_all.js (original)
+++ webservices/rampart/trunk/c/samples/secpolicy/run_all.js Tue Feb 12 00:21:23 2008
@@ -1,20 +1,45 @@
var WshShell = new ActiveXObject("WScript.Shell");
-fso = new ActiveXObject("Scripting.FileSystemObject");
+var fso = new ActiveXObject("Scripting.FileSystemObject");
+var server_port = 7070;
-var fso, f, s, re, ss, r;
+var f, s, re, ss, r;
var ForReading = 1, ForWriting = 2;
var axis2c_home = WshShell.ExpandEnvironmentStrings("%AXIS2C_HOME%");
var client_repo = axis2c_home + "\\client_repo";
-for (var i = 1; i <= 14; i++) {
- WScript.Echo("Scenario " + i + ":");
- // Deploy the client policy file
- f = fso.OpenTextFile("scenario" + i + "\\client-policy.xml", ForReading);
- s = f.ReadAll();
- f.Close();
+for (var i = 14; i <= 0; i++) {
+ WScript.Echo("Scenario " + i + ":");
+ deploy(i);
+ WScript.Echo("services.xml and policy.xml deployed");
+ var http_server = WshShell.Exec(axis2c_home + "\\bin\\axis2_http_server.exe -p " + server_port + " -r " + axis2c_home);
+ WScript.Sleep(3000);
+ WScript.Echo("Started Axis2C simple HTTP server\n\n");
+ var client;
+ if (i != 14) {
+ client = WshShell.Exec(axis2c_home + "\\bin\\samples\\rampart\\client\\sec_echo\\echo.exe http://localhost:9090/axis2/services/sec_echo/echoString " + client_repo);
+ } else if (i == 14) {
+ client = WshShell.Exec(axis2c_home + "\\bin\\samples\\rampart\\client\\saml_echo\\echo.exe http://localhost:9090/axis2/services/sec_echo/echoString " + client_repo);
+ }
+ s = client.StdOut.ReadAll();
+ WScript.Echo(s);
+ http_server.Terminate();
+}
- f = fso.OpenTextFile(client_repo + "\\policy.xml", ForWriting, true);
+WScript.Echo("Scenario " + 20 + ":");
+deploy(20);
+deploy_20();
+WScript.Echo("services.xml and policy.xml deployed");
+var http_server = WshShell.Exec(axis2c_home + "\\bin\\axis2_http_server.exe -p " + server_port + " -r " + axis2c_home);
+WScript.Sleep(3000);
+WScript.Echo("Started Axis2C simple HTTP server\n\n");
+var client = WshShell.Exec(axis2c_home + "\\bin\\samples\\rampart\\client\\issued_token\\echo.exe http://localhost:9090/axis2/services/sec_echo/echoString " + client_repo);
+s = client.StdOut.ReadAll();
+WScript.Echo(s);
+http_server.Terminate();
+
+function replace()
+{
while (s.search(/AXIS2C_HOME/) != -1) {
r = s.replace(/AXIS2C_HOME/, axis2c_home);
s = r;
@@ -23,6 +48,20 @@
r = s.replace(/libpwcb\.so/, "pwcb.dll");
s = r;
}
+ while (s.search(/librdflatfile\.so/) != -1) {
+ r = s.replace(/librdflatfile\.so/, "rdflatfile.dll");
+ s = r;
+ }
+}
+
+function deploy(i)
+{
+ f = fso.OpenTextFile("scenario" + i + "\\client-policy.xml", ForReading);
+ s = f.ReadAll();
+ f.Close();
+
+ f = fso.OpenTextFile(client_repo + "\\policy.xml", ForWriting, true);
+ replace();
f.write(s);
f.close();
@@ -32,41 +71,25 @@
f.Close();
f = fso.OpenTextFile(axis2c_home + "\\services\\sec_echo\\services.xml", ForWriting, true);
- while (s.search(/AXIS2C_HOME/) != -1) {
- r = s.replace(/AXIS2C_HOME/, axis2c_home);
- s = r;
- }
- while (s.search(/libpwcb\.so/) != -1) {
- r = s.replace(/libpwcb\.so/, "pwcb.dll");
- s = r;
- }
- while (s.search(/librdflatfile\.so/) != -1) {
- r = s.replace(/librdflatfile\.so/, "rdflatfile.dll");
- s = r;
- }
+ replace();
f.write(s);
f.close();
-
- WScript.Echo("services.xml and policy.xml deployed");
-
- var http_server = WshShell.Exec(axis2c_home + "\\bin\\axis2_http_server.exe -p 7070 -r " + axis2c_home);
- WScript.Sleep(3000);
- WScript.Echo("Started Axis2C simple HTTP server\n\n");
-
- var client;
- if (i != 14) {
- var client = WshShell.Exec(axis2c_home + "\\bin\\samples\\rampart\\client\\sec_echo\\echo.exe http://localhost:9090/axis2/services/sec_echo/echoString " + client_repo);
- } else if (i == 14) {
- client = WshShell.Exec(axis2c_home + "\\bin\\samples\\rampart\\client\\saml_echo\\echo.exe http://localhost:9090/axis2/services/sec_echo/echoString " + client_repo);
- }
-
- s = client.StdOut.ReadAll();
- WScript.Echo(s);
-
- http_server.Terminate();
}
-
-
-
-
+function deploy_20()
+{
+ f = fso.OpenTextFile("scenario" + 20 + "\\sts-client-policy.xml", ForReading);
+ s = f.ReadAll();
+ f.Close();
+ f = fso.OpenTextFile(client_repo + "\\sts_policy.xml", ForWriting, true);
+ replace();
+ f.write(s);
+ f.close();
+ f = fso.OpenTextFile("scenario" + 20 + "\\sts-services.xml", ForReading);
+ s = f.ReadAll();
+ f.Close();
+ f = fso.OpenTextFile(axis2c_home + "\\services\\saml_sts\\services.xml", ForWriting, true);
+ replace();
+ f.write(s);
+ f.close();
+}
Added: webservices/rampart/trunk/c/samples/secpolicy/scenario20/client-policy.xml
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/samples/secpolicy/scenario20/client-policy.xml?rev=620722&view=auto
==============================================================================
--- webservices/rampart/trunk/c/samples/secpolicy/scenario20/client-policy.xml (added)
+++ webservices/rampart/trunk/c/samples/secpolicy/scenario20/client-policy.xml Tue Feb 12 00:21:23 2008
@@ -0,0 +1,67 @@
+<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>
+ </wsp:Policy>
+ </sp:AsymmetricBinding>
+ <sp:SignedSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:IssuedToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <sp:RequestSecurityTokenTemplate xmlns:wst="http://schemas.xmlsoap.org/ws/2005/02/trust">
+ <wst:TokenType>oasis:names:tc:SAML:1.0:assertion</wst:TokenType>
+ <wst:RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue</wst:RequestType>
+ </sp:RequestSecurityTokenTemplate>
+ </sp:IssuedToken>
+ </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: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: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>
Added: webservices/rampart/trunk/c/samples/secpolicy/scenario20/services.xml
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/samples/secpolicy/scenario20/services.xml?rev=620722&view=auto
==============================================================================
--- webservices/rampart/trunk/c/samples/secpolicy/scenario20/services.xml (added)
+++ webservices/rampart/trunk/c/samples/secpolicy/scenario20/services.xml Tue Feb 12 00:21:23 2008
@@ -0,0 +1,78 @@
+<service name="sec_echo">
+ <parameter name="ServiceClass" locked="xsd:false">sec_echo</parameter>
+
+ <description>
+ This is a testing service , to test the system is working or not
+ </description>
+ <module ref="rampart"/>
+
+ <operation name="echoString">
+ <parameter name="wsamapping">http://example.com/ws/2004/09/policy/Test/EchoRequest</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:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256Rsa15/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict/>
+ </wsp:Policy>
+ </sp:Layout>
+ </wsp:Policy>
+ </sp:AsymmetricBinding>
+ <sp:SignedSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:IssuedToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <sp:RequestSecurityTokenTemplate xmlns:wst="http://schemas.xmlsoap.org/ws/2005/02/trust">
+ <wst:TokenType>oasis:names:tc:SAML:1.0:assertion</wst:TokenType>
+ <wst:RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue</wst:RequestType>
+ </sp:RequestSecurityTokenTemplate>
+ </sp:IssuedToken>
+ </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: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:PasswordCallbackClass>AXIS2C_HOME/bin/samples/rampart/callback/libpwcb.so</rampc:PasswordCallbackClass>
+ <rampc:Certificate>AXIS2C_HOME/bin/samples/rampart/keys/bhome/bob_cert.cert</rampc:Certificate>
+ <rampc:PrivateKey>AXIS2C_HOME/bin/samples/rampart/keys/bhome/bob_key.pem</rampc:PrivateKey>
+ </rampc:RampartConfig>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+</service>
Added: webservices/rampart/trunk/c/samples/secpolicy/scenario20/sts-client-policy.xml
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/samples/secpolicy/scenario20/sts-client-policy.xml?rev=620722&view=auto
==============================================================================
--- webservices/rampart/trunk/c/samples/secpolicy/scenario20/sts-client-policy.xml (added)
+++ webservices/rampart/trunk/c/samples/secpolicy/scenario20/sts-client-policy.xml Tue Feb 12 00:21:23 2008
@@ -0,0 +1,56 @@
+<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>
+ </wsp:Policy>
+ </sp:AsymmetricBinding>
+ <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: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: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>
Added: webservices/rampart/trunk/c/samples/secpolicy/scenario20/sts-services.xml
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/samples/secpolicy/scenario20/sts-services.xml?rev=620722&view=auto
==============================================================================
--- webservices/rampart/trunk/c/samples/secpolicy/scenario20/sts-services.xml (added)
+++ webservices/rampart/trunk/c/samples/secpolicy/scenario20/sts-services.xml Tue Feb 12 00:21:23 2008
@@ -0,0 +1,67 @@
+<service name="sec_echo">
+ <parameter name="ServiceClass" locked="xsd:false">saml_sts</parameter>
+
+ <description>
+ This is a testing service , to test the system is working or not
+ </description>
+ <module ref="rampart"/>
+
+ <operation name="echoString">
+ <parameter name="wsamapping">http://example.com/ws/2004/09/policy/Test/EchoRequest</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:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256Rsa15/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict/>
+ </wsp:Policy>
+ </sp:Layout>
+ </wsp:Policy>
+ </sp:AsymmetricBinding>
+ <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: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:PasswordCallbackClass>AXIS2C_HOME/bin/samples/rampart/callback/libpwcb.so</rampc:PasswordCallbackClass>
+ <rampc:Certificate>AXIS2C_HOME/bin/samples/rampart/keys/bhome/bob_cert.cert</rampc:Certificate>
+ <rampc:PrivateKey>AXIS2C_HOME/bin/samples/rampart/keys/bhome/bob_key.pem</rampc:PrivateKey>
+ </rampc:RampartConfig>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+</service>
Added: webservices/rampart/trunk/c/samples/server/saml_sts/server_axis2.xml
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/samples/server/saml_sts/server_axis2.xml?rev=620722&view=auto
==============================================================================
--- webservices/rampart/trunk/c/samples/server/saml_sts/server_axis2.xml (added)
+++ webservices/rampart/trunk/c/samples/server/saml_sts/server_axis2.xml Tue Feb 12 00:21:23 2008
@@ -0,0 +1,111 @@
+<axisconfig name="Axis2/C">
+ <!--THIS IS A SAMPLE AXIS2.XML (SERVER) TO TRY RAMPART-C SAMPLES-->
+ <!-- ================================================= -->
+ <!-- Parameters -->
+ <!-- ================================================= -->
+ <!-- Uncomment following to enable MTOM support -->
+ <!--parameter name="enableMTOM" locked="false">true</parameter-->
+ <parameter name="enableREST" locked="false">true</parameter>
+
+ <!-- Uncomment following to persist op_ctx, useful with RM -->
+ <!--parameter name="persistOperationContext" locked="false">true</parameter-->
+
+ <!--if you want to extract the service archive file and work with that please uncomment this-->
+ <!--else , it wont extract archive file or does not take into consideration if someone drop-->
+ <!--exploded directory into /service directory-->
+ <!--<parameter name="extractServiceArchive" locked="false">true</parameter>-->
+
+
+ <!-- ================================================= -->
+ <!-- Message Receivers -->
+ <!-- ================================================= -->
+ <!-- This is the Deafult Message Receiver for the Request Response style Operations -->
+ <!--messageReceiver mep="INOUT" class="axis2_receivers"/-->
+
+ <!-- ================================================= -->
+ <!-- Transport Ins -->
+ <!-- ================================================= -->
+ <transportReceiver name="http" class="axis2_http_receiver">
+ <parameter name="port" locked="false">6060</parameter>
+ </transportReceiver>
+
+ <!-- ================================================= -->
+ <!-- Transport Outs -->
+ <!-- ================================================= -->
+
+ <transportSender name="http" class="axis2_http_sender">
+ <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
+ <!--parameter name="Transfer-Encoding">chunked</parameter-->
+ <!--parameter name="PROXY" proxy_host="127.0.0.1" proxy_port="8080" locked="true"/-->
+ </transportSender>
+ <!-- Uncomment this one with the appropriate papameters to enable the XMPP transport Sender-->
+ <!--transportSender name="xmpp" class="axis2_xmpp_sender">
+ <parameter name="PROTOCOL" locked="false">XMPP</parameter>
+ </transportSender-->
+ <!-- Uncomment this one with the appropriate papameters to enable the TCP transport Sender-->
+ <!--transportSender name="tcp" class="axis2_tcp_sender">
+ <parameter name="PROTOCOL" locked="false">TCP</parameter>
+ </transportSender-->
+
+ <!--
+ <transportSender name="https" class="axis2_http_sender">
+ <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
+ </transportSender>
+ <parameter name="SERVER_CERT">/path/to/ca/certificate</parameter>
+ <parameter name="KEY_FILE">/path/to/client/certificate/chain/file</parameter>
+ <parameter name="SSL_PASSPHRASE">passphrase</parameter>
+ -->
+
+
+ <!-- ================================================= -->
+ <!-- Global Modules -->
+ <!-- ================================================= -->
+ <!-- Comment this to disable Addressing -->
+ <module ref="addressing"/>
+
+
+ <!--Configuring module , providing paramters for modules whether they refer or not-->
+ <!--<moduleConfig name="addressing">-->
+ <!--<parameter name="addressingPara" locked="false">N/A</parameter>-->
+ <!--</moduleConfig>-->
+
+ <!-- ================================================= -->
+ <!-- Phases -->
+ <!-- ================================================= -->
+ <phaseOrder type="inflow">
+ <!-- System pre defined phases -->
+ <phase name="Transport"/>
+ <phase name="PreDispatch"/>
+ <phase name="Dispatch"/>
+ <phase name="PostDispatch"/>
+ <!-- End system pre defined phases -->
+ <!-- After PostDispatch phase, module or service author can add any phase as required -->
+ <!-- User defined phases could be added here -->
+ <phase name="userphase1"/>
+ <phase name="RMPhase"/>
+ <phase name="SavanPhase"/>
+ </phaseOrder>
+ <phaseOrder type="outflow">
+ <!-- User defined phases could be added here -->
+ <phase name="RMPhase"/>
+ <phase name="SavanPhase"/>
+ <phase name="userphase1"/>
+ <!--system predefined phase-->
+ <phase name="MessageOut"/>
+ <phase name="Security"/>
+ </phaseOrder>
+ <phaseOrder type="INfaultflow">
+ <!-- User defined phases could be added here -->
+ <phase name="userphase1"/>
+ <phase name="RMPhase"/>
+ <phase name="SavanPhase"/>
+ </phaseOrder>
+ <phaseOrder type="Outfaultflow">
+ <!-- User defined phases could be added here -->
+ <phase name="RMPhase"/>
+ <phase name="SavanPhase"/>
+ <phase name="userphase1"/>
+ <phase name="MessageOut"/>
+ </phaseOrder>
+</axisconfig>
+
Modified: webservices/rampart/trunk/c/samples/server/saml_sts/services.xml
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/samples/server/saml_sts/services.xml?rev=620722&r1=620721&r2=620722&view=diff
==============================================================================
--- webservices/rampart/trunk/c/samples/server/saml_sts/services.xml (original)
+++ webservices/rampart/trunk/c/samples/server/saml_sts/services.xml Tue Feb 12 00:21:23 2008
@@ -1,51 +1,67 @@
-<service name="sts">
- <parameter name="ServiceClass" locked="xsd:false">saml_sts</parameter>
-
- <description>
- This is a testing service , to test the trust implementation in Rampart/C.
- </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>
+<service name="sec_echo">
+ <parameter name="ServiceClass" locked="xsd:false">saml_sts</parameter>
+
+ <description>
+ This is a testing service , to test the system is working or not
+ </description>
+ <module ref="rampart"/>
+
+ <operation name="echoString">
+ <parameter name="wsamapping">http://example.com/ws/2004/09/policy/Test/EchoRequest</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:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256Rsa15/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict/>
+ </wsp:Policy>
+ </sp:Layout>
+ </wsp:Policy>
+ </sp:AsymmetricBinding>
+ <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: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:PasswordCallbackClass>AXIS2C_HOME/bin/samples/rampart/callback/libpwcb.so</rampc:PasswordCallbackClass>
+ <rampc:Certificate>AXIS2C_HOME/bin/samples/rampart/keys/bhome/bob_cert.cert</rampc:Certificate>
+ <rampc:PrivateKey>AXIS2C_HOME/bin/samples/rampart/keys/bhome/bob_key.pem</rampc:PrivateKey>
+ </rampc:RampartConfig>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+</service>
Modified: webservices/rampart/trunk/c/src/trust/rst.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/trust/rst.c?rev=620722&r1=620721&r2=620722&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/trust/rst.c (original)
+++ webservices/rampart/trunk/c/src/trust/rst.c Tue Feb 12 00:21:23 2008
@@ -15,6 +15,7 @@
* limitations under the License.
*/
#include <trust_rst.h>
+#include <trust_constants.h>
struct trust_rst
@@ -757,7 +758,44 @@
return NULL;
}
-
+AXIS2_EXTERN axiom_node_t * AXIS2_CALL
+trust_rst_build_rst_with_issued_token_assertion(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ rp_issued_token_t *issued_token)
+{
+ axiom_node_t *rst_node = NULL;
+ axiom_node_t *rst_template_node = NULL;
+ axiom_element_t * rst_template_element = NULL;
+ axiom_children_iterator_t *rst_template_children_iter = NULL;
+ axiom_node_t *rst_template_child = NULL;
+
+
+ /* */
+ rst = trust_rst_create(env);
+ trust_rst_set_wst_ns_uri(rst, env,"http://schemas.xmlsoap.org/ws/2005/02/trust");
+ rst_node = (axiom_node_t*)trust_util_create_rst_element(env, rst->wst_ns_uri, rst->attr_context);
+ rst_template_node = rp_issued_token_get_requested_sec_token_template(issued_token, env);
+ rst_template_node = axiom_node_detach(rst_template_node, env); /*Detaching RSTTemplate from the original location- FIX - Detaching problem with NS'*/
+ rst_template_element = axiom_node_get_data_element(rst_template_node, env);
+
+ rst_template_children_iter = axiom_element_get_children(rst_template_element, env, rst_template_node);
+
+
+ while(axiom_children_iterator_has_next(rst_template_children_iter, env))
+ {
+ rst_template_child = axiom_children_iterator_next(rst_template_children_iter, env);
+ if(rst_template_node)
+ axiom_node_add_child(rst_node, env, rst_template_child);
+ }
+
+ if(rst_node)
+ return rst_node;
+
+
+ return NULL;
+}
+
AXIS2_EXTERN axis2_char_t * AXIS2_CALL
trust_rst_get_attr_context(
trust_rst_t *rst,
Modified: webservices/rampart/trunk/c/src/util/rampart_config.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_config.c?rev=620722&r1=620721&r2=620722&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_config.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_config.c Tue Feb 12 00:21:23 2008
@@ -18,7 +18,6 @@
#include <rampart_config.h>
#include <rampart_constants.h>
-
struct rampart_config_t
{
/*****************************/
@@ -26,6 +25,7 @@
axis2_char_t *password;
axis2_char_t *password_type;
axutil_array_list_t *saml_tokens;
+ issued_token_callback_func issued_token_aquire;
int ttl;
};
@@ -51,6 +51,7 @@
rampart_config->password_type = NULL;
rampart_config->ttl = 0;
rampart_config->saml_tokens = NULL;
+ rampart_config->issued_token_aquire = NULL;
return rampart_config;
}
@@ -191,3 +192,19 @@
{
return rampart_config->saml_tokens;
}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rampart_config_set_issued_token_aquire_function(rampart_config_t *rampart_config,
+ const axutil_env_t *env,
+ issued_token_callback_func issued_token_aquire)
+{
+ rampart_config->issued_token_aquire = issued_token_aquire;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN issued_token_callback_func AXIS2_CALL
+rampart_config_get_issued_token_aquire_function(rampart_config_t *rampart_config,
+ const axutil_env_t *env)
+{
+ return rampart_config->issued_token_aquire;
+}
\ No newline at end of file
Modified: webservices/rampart/trunk/c/src/util/rampart_context.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_context.c?rev=620722&r1=620721&r2=620722&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_context.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_context.c Tue Feb 12 00:21:23 2008
@@ -51,7 +51,8 @@
/****************************/
/* Set true when the issued token is aquired and set to the rampart conext*/
- axis2_bool_t issued_token_aquired;
+ issued_token_callback_func aquire_issued_token;
+
/* SAML tokens. */
axutil_array_list_t *saml_tokens;
@@ -181,9 +182,9 @@
rampart_context->password_type = NULL;
rampart_context->private_key_file = NULL;
rampart_context->certificate_file = NULL;
- rampart_context->reciever_certificate_file = NULL;
- rampart_context->issued_token_aquired = AXIS2_FALSE;
+ rampart_context->reciever_certificate_file = NULL;
rampart_context->saml_tokens = NULL;
+ rampart_context->aquire_issued_token = NULL;
rampart_context->secpolicy = NULL;
rampart_context->password_callback_module = NULL;
@@ -1696,9 +1697,9 @@
}
AXIS2_EXTERN axis2_bool_t AXIS2_CALL
-rampart_context_is_include_supporting_saml_token(
- rampart_context_t *rampart_context, axis2_bool_t server_side,
- axis2_bool_t is_inpath, const axutil_env_t *env)
+rampart_context_is_include_supporting_token(
+ rampart_context_t *rampart_context, const axutil_env_t *env,
+ axis2_bool_t server_side, axis2_bool_t is_inpath, rp_property_type_t token_type)
{
axutil_array_list_t *array_list = NULL;
axis2_bool_t bvalidate = AXIS2_FALSE;
@@ -1725,11 +1726,11 @@
axutil_array_list_get(array_list, env, i);
if (token)
{
- if(rp_property_get_type(token,env) == RP_PROPERTY_SAML_TOKEN)
+ if(rp_property_get_type(token,env) == token_type)
{
bvalidate = rampart_context_is_token_include(
rampart_context, token,
- RP_PROPERTY_SAML_TOKEN, server_side,
+ token_type, server_side,
is_inpath, env);
break;
}
@@ -1739,6 +1740,7 @@
return bvalidate;
}
+
AXIS2_EXTERN axis2_bool_t AXIS2_CALL
rampart_context_is_include_protection_saml_token(
rampart_context_t *rampart_context, axis2_bool_t server_side,
@@ -1798,10 +1800,10 @@
else return AXIS2_FALSE;
}
-AXIS2_EXTERN rp_saml_token_t * AXIS2_CALL
-rampart_context_get_supporting_saml_token(
+AXIS2_EXTERN rp_property_t * AXIS2_CALL
+rampart_context_get_supporting_token(
rampart_context_t *rampart_context,
- const axutil_env_t *env)
+ const axutil_env_t *env, rp_property_type_t token_type)
{
axutil_array_list_t *array_list = NULL;
rp_supporting_tokens_t *signed_supporting = NULL;
@@ -1827,11 +1829,9 @@
axutil_array_list_get(array_list, env, i);
if (token)
{
- if(rp_property_get_type(token,env) == RP_PROPERTY_SAML_TOKEN)
- {
- rp_saml_token_t *saml_token =
- (rp_saml_token_t *)rp_property_get_value(token, env);
- return saml_token;
+ if(rp_property_get_type(token,env) == token_type)
+ {
+ return token;
}
}
}
@@ -2721,20 +2721,7 @@
rampart_context->signature_sct_id = sct_id;
return AXIS2_SUCCESS;
}
-AXIS2_EXTERN axis2_bool_t AXIS2_CALL
-rampart_context_is_issued_token_aquired(rampart_context_t *rampart_context,
- const axutil_env_t *env)
-{
- return rampart_context->issued_token_aquired;
-}
-AXIS2_EXTERN axis2_bool_t AXIS2_CALL
-rampart_context_set_issued_token_aquired(rampart_context_t *rampart_context,
- const axutil_env_t *env,
- axis2_bool_t acquired)
-{
- return rampart_context->issued_token_aquired = acquired;
-}
AXIS2_EXTERN rampart_saml_token_t * AXIS2_CALL
rampart_context_get_saml_token(rampart_context_t *rampart_context,
@@ -2801,3 +2788,18 @@
}
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rampart_context_set_issued_token_aquire_function(rampart_context_t *rampart_context,
+ const axutil_env_t *env,
+ issued_token_callback_func issued_token_aquire)
+{
+ rampart_context->aquire_issued_token = issued_token_aquire;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN issued_token_callback_func AXIS2_CALL
+rampart_context_get_issued_token_aquire_function(rampart_context_t *rampart_context,
+ const axutil_env_t *env)
+{
+ return rampart_context->aquire_issued_token;
+}
\ No newline at end of file
Modified: webservices/rampart/trunk/c/src/util/rampart_engine.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_engine.c?rev=620722&r1=620721&r2=620722&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_engine.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_engine.c Tue Feb 12 00:21:23 2008
@@ -186,6 +186,7 @@
rampart_config_t *client_config = NULL;
axutil_array_list_t *saml_tokens = NULL;
axis2_char_t *config_value = NULL;
+ issued_token_callback_func issued_token_aquire = NULL;
int ttl = 0;
client_config = (rampart_config_t*)value;
@@ -216,7 +217,12 @@
if (saml_tokens)
{
rampart_context_set_saml_tokens(rampart_context, env, saml_tokens);
- }
+ }
+ issued_token_aquire = rampart_config_get_issued_token_aquire_function(client_config, env);
+ if (issued_token_aquire)
+ {
+ rampart_context_set_issued_token_aquire_function(rampart_context, env, issued_token_aquire);
+ }
}
}
else
Added: webservices/rampart/trunk/c/src/util/rampart_issued.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_issued.c?rev=620722&view=auto
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_issued.c (added)
+++ webservices/rampart/trunk/c/src/util/rampart_issued.c Tue Feb 12 00:21:23 2008
@@ -0,0 +1,71 @@
+/*
+ * 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
+ */
+
+#include <rampart_issued.h>
+#include <rampart_saml.h>
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rampart_issued_supporting_token_build(rampart_context_t *rampart_context, const axutil_env_t *env, axiom_node_t *sec_node,
+ axutil_array_list_t *sign_parts)
+{
+ rp_property_t *token = NULL;
+ issued_token_callback_func issued_func = NULL;
+ rampart_issued_token_t *issued_token = NULL;
+ void *tok_val = NULL;
+
+ token = rampart_context_get_supporting_token(rampart_context, env, RP_PROPERTY_ISSUED_TOKEN);
+ if (!token)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[rampart][issued] Issued token not specified. ERROR");
+ return AXIS2_FAILURE;
+ }
+ issued_func = rampart_context_get_issued_token_aquire_function(rampart_context, env);
+
+ if (!issued_func)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[rampart][issued] Issued token call back function not set. ERROR");
+ return AXIS2_FAILURE;
+ }
+ issued_token = issued_func(env, token, rampart_context);
+
+ if (!issued_token)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[rampart][issued] Issued token call back returned NULL. ERROR");
+ return AXIS2_FAILURE;
+ }
+ tok_val = rampart_issued_token_get_token(issued_token, env);
+ if (!tok_val)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[rampart][issued] Issued token call back returned NULL token value. ERROR");
+ return AXIS2_FAILURE;
+ }
+
+ if (rampart_issued_token_get_token_type(issued_token, env) == RP_PROPERTY_SAML_TOKEN)
+ {
+ rampart_context_add_saml_token(rampart_context, env, tok_val);
+ if (rampart_saml_supporting_token_build(env, rampart_context, sec_node, sign_parts))
+ {
+ return AXIS2_SUCCESS;
+ }
+ }
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[rampart][issued] Not supported token type. ERROR");
+ return AXIS2_FAILURE;
+}
\ No newline at end of file
Added: webservices/rampart/trunk/c/src/util/rampart_issued_token.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_issued_token.c?rev=620722&view=auto
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_issued_token.c (added)
+++ webservices/rampart/trunk/c/src/util/rampart_issued_token.c Tue Feb 12 00:21:23 2008
@@ -0,0 +1,73 @@
+/*
+ * 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
+ */
+
+#include <rampart_issued_token.h>
+#include <rampart_saml_token.h>
+
+struct rampart_issued_token_t {
+ void *token;
+
+ /* specify weather this type of the token aquired.
+ security context token, saml token etc */
+ rp_property_type_t token_type;
+};
+
+AXIS2_EXTERN rampart_issued_token_t * AXIS2_CALL
+rampart_issued_token_create(const axutil_env_t *env)
+{
+ rampart_issued_token_t *issued_token = AXIS2_MALLOC(env-> allocator, sizeof(rampart_issued_token_t));
+
+ if (issued_token)
+ {
+ issued_token->token = NULL;
+ issued_token->token_type = RP_PROPERTY_UNKNOWN;
+ }
+ return issued_token;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rampart_issued_token_free(rampart_issued_token_t *token, axutil_env_t *env)
+{
+ if (token->token_type == RP_PROPERTY_SAML_TOKEN)
+ {
+ if (token->token)
+ {
+ rampart_saml_token_free(token->token, env);
+ }
+ }
+ AXIS2_FREE(env->allocator, token->token);
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rampart_issued_token_set_token(rampart_issued_token_t *issued_token, axutil_env_t *env, void *token, rp_property_type_t token_type)
+{
+ issued_token->token = token;
+ issued_token->token_type = token_type;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_property_type_t AXIS2_CALL
+rampart_issued_token_get_token_type(rampart_issued_token_t *token, axutil_env_t *env)
+{
+ return token->token_type;
+}
+
+AXIS2_EXTERN void * AXIS2_CALL
+rampart_issued_token_get_token(rampart_issued_token_t *token, axutil_env_t *env)
+{
+ return token->token;
+}
\ No newline at end of file
Modified: webservices/rampart/trunk/c/src/util/rampart_saml.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_saml.c?rev=620722&r1=620721&r2=620722&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_saml.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_saml.c Tue Feb 12 00:21:23 2008
@@ -17,13 +17,24 @@
#include <rampart_saml.h>
#include <oxs_constants.h>
#include <rp_property.h>
+#include <oxs_xml_signature.h>
+#include <oxs_transform.h>
+#include <oxs_utility.h>
+#include <oxs_transforms_factory.h>
+
+oxs_sign_part_t * AXIS2_CALL
+rampart_saml_token_create_sign_part(const axutil_env_t *env,
+ rampart_context_t *rampart_context,
+ rampart_saml_token_t *saml);
AXIS2_EXTERN axis2_status_t AXIS2_CALL
rampart_saml_supporting_token_build(const axutil_env_t *env,
rampart_context_t *rampart_context,
- axiom_node_t *sec_node)
+ axiom_node_t *sec_node,
+ axutil_array_list_t *sign_parts)
{
axiom_node_t *strn = NULL, *assertion = NULL;
+ oxs_sign_part_t *sign_part = NULL;
rampart_saml_token_t *saml = rampart_context_get_saml_token(rampart_context, env, RP_PROPERTY_SIGNED_SUPPORTING_TOKEN);
if (!saml)
{
@@ -46,11 +57,60 @@
rampart_saml_token_set_str(saml, env, strn);
}
axiom_node_add_child(sec_node, env, strn);
+ sign_part = rampart_saml_token_create_sign_part(env, rampart_context, saml);
+ if (!sign_part)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[rampart][rs] Sign part creation failed. ERROR");
+ return AXIS2_FAILURE;
+ }
+ axutil_array_list_add(sign_parts, env, sign_part);
return AXIS2_SUCCESS;
}
+oxs_sign_part_t * AXIS2_CALL
+rampart_saml_token_create_sign_part(const axutil_env_t *env,
+ rampart_context_t *rampart_context,
+ rampart_saml_token_t *saml)
+{
+ axiom_element_t *stre = NULL;
+ axiom_node_t *strn = NULL;
+ axutil_qname_t *qname = NULL;
+ axis2_char_t *id = NULL;
+ oxs_sign_part_t *sign_part = NULL;
+ oxs_transform_t *tr = NULL;
+ axutil_array_list_t *tr_list = NULL;
+
+ axis2_char_t * digest_method = rampart_context_get_digest_mtd(rampart_context, env);
+ strn = rampart_saml_token_get_str(saml, env);
+ stre = axiom_node_get_data_element(strn, env);
+
+ qname = axutil_qname_create(env, OXS_NODE_SECURITY_TOKEN_REFRENCE, OXS_WSSE_XMLNS, NULL);
+ sign_part = oxs_sign_part_create(env);
+ tr_list = axutil_array_list_create(env, 0);
+ /* If ID is not present we add it */
+ id = axiom_element_get_attribute_value(stre, env, qname);
+ if (!id)
+ {
+ id = oxs_util_generate_id(env, (axis2_char_t*)OXS_SIG_ID);
+ oxs_axiom_add_attribute(env, strn,
+ RAMPART_WSU, RAMPART_WSU_XMLNS, OXS_ATTR_ID, id);
+ }
+ oxs_sign_part_set_id(sign_part, env, id);
+ tr = oxs_transforms_factory_produce_transform(env,
+ OXS_HREF_TRANSFORM_STR_TRANSFORM);
+ axutil_array_list_add(tr_list, env, tr);
+ oxs_sign_part_set_transforms(sign_part, env, tr_list);
+ /* Sign the assertion, not the securitytokenreference */
+ oxs_sign_part_set_node(sign_part, env, strn);
+ oxs_sign_part_set_digest_mtd(sign_part, env, digest_method);
+
+ AXIS2_FREE(env->allocator, id);
+ return sign_part;
+}
+
AXIS2_EXTERN axis2_status_t AXIS2_CALL
-rampart_saml_token_validate(axutil_env_t *env,
+rampart_saml_token_validate(const axutil_env_t *env,
rampart_context_t *rampart_context,
axiom_node_t *assertion)
{