summaryrefslogtreecommitdiffstats
path: root/tests/login_tests.c
diff options
context:
space:
mode:
authorBenjamin Dauvergne <bdauvergne@entrouvert.com>2011-12-22 18:22:12 +0100
committerBenjamin Dauvergne <bdauvergne@entrouvert.com>2011-12-22 18:22:12 +0100
commit56d584ca69bf83d71bff52ecbf8fa3df6216c790 (patch)
treea1ba9dc9657e270262edde4833e04c8b28e57d2a /tests/login_tests.c
parent3dca5c2afa97fd3f80fd2765d3e4d3d2bd2b9539 (diff)
downloadlasso-56d584ca69bf83d71bff52ecbf8fa3df6216c790.tar.gz
lasso-56d584ca69bf83d71bff52ecbf8fa3df6216c790.tar.xz
lasso-56d584ca69bf83d71bff52ecbf8fa3df6216c790.zip
[tests] protect the ID-FF 1.2 test cases from effect of the thin-sessions flag until it is migrated to work also with thin sessions
Diffstat (limited to 'tests/login_tests.c')
-rw-r--r--tests/login_tests.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/tests/login_tests.c b/tests/login_tests.c
index c432fe9f..c13ecd35 100644
--- a/tests/login_tests.c
+++ b/tests/login_tests.c
@@ -33,6 +33,15 @@
#include "tests.h"
#include "../bindings/ghashtable.h"
+#define save_thin_session \
+ gboolean old_thin_sessions = lasso_flag_thin_sessions;
+
+#define push_thin_sessions \
+ lasso_flag_thin_sessions = FALSE;
+
+#define pop_thin_sessions \
+ lasso_flag_thin_sessions = old_thin_sessions;
+
static char*
generateIdentityProviderContextDump()
@@ -151,6 +160,7 @@ START_TEST(test02_serviceProviderLogin)
char *spLoginDump;
int requestType;
char *found;
+ save_thin_session;
serviceProviderContextDump = generateServiceProviderContextDump();
spContext = lasso_server_new_from_dump(serviceProviderContextDump);
@@ -180,6 +190,7 @@ START_TEST(test02_serviceProviderLogin)
"authnRequestQuery RelayState parameter should be encoded");
/* Identity provider singleSignOn, for a user having no federation. */
+ push_thin_sessions;
identityProviderContextDump = generateIdentityProviderContextDump();
idpContext = lasso_server_new_from_dump(identityProviderContextDump);
idpLoginContext = lasso_login_new(idpContext);
@@ -228,6 +239,7 @@ START_TEST(test02_serviceProviderLogin)
serviceProviderId = g_strdup(LASSO_PROFILE(idpLoginContext)->remote_providerID);
fail_unless(serviceProviderId != NULL,
"lasso_profile_get_remote_providerID shouldn't return NULL");
+ pop_thin_sessions;
/* Service provider assertion consumer */
lasso_server_destroy(spContext);
@@ -250,6 +262,7 @@ START_TEST(test02_serviceProviderLogin)
soapRequestMsg = LASSO_PROFILE(spLoginContext)->msg_body;
fail_unless(soapRequestMsg != NULL, "soapRequestMsg must not be NULL");
+ push_thin_sessions;
/* Identity provider SOAP endpoint */
lasso_server_destroy(idpContext);
lasso_login_destroy(idpLoginContext);
@@ -267,6 +280,7 @@ START_TEST(test02_serviceProviderLogin)
check_good_rc(lasso_login_build_response_msg(idpLoginContext, serviceProviderId));
soapResponseMsg = LASSO_PROFILE(idpLoginContext)->msg_body;
fail_unless(soapResponseMsg != NULL, "soapResponseMsg must not be NULL");
+ pop_thin_sessions;
/* Service provider assertion consumer (step 2: process SOAP response) */
check_good_rc(lasso_login_process_response_msg(spLoginContext, soapResponseMsg));
@@ -323,6 +337,7 @@ START_TEST(test03_serviceProviderLogin)
char *spIdentityContextDump;
char *spSessionDump;
int requestType;
+ save_thin_session;
serviceProviderContextDump = generateServiceProviderContextDump();
spContext = lasso_server_new_from_dump(serviceProviderContextDump);
@@ -348,6 +363,7 @@ START_TEST(test03_serviceProviderLogin)
fail_unless(strlen(authnRequestQuery) > 0,
"authnRequestRequest shouldn't be an empty string");
+ push_thin_sessions;
/* Identity provider singleSignOn, for a user having no federation. */
identityProviderContextDump = generateIdentityProviderContextDumpMemory();
idpContext = lasso_server_new_from_dump(identityProviderContextDump);
@@ -366,7 +382,6 @@ START_TEST(test03_serviceProviderLogin)
1, /* authentication_result */
0 /* is_consent_obtained */
);
-
rc = lasso_login_build_assertion(idpLoginContext,
LASSO_SAML_AUTHENTICATION_METHOD_PASSWORD,
"FIXME: authenticationInstant",
@@ -375,7 +390,6 @@ START_TEST(test03_serviceProviderLogin)
"FIXME: notOnOrAfter");
rc = lasso_login_build_artifact_msg(idpLoginContext, LASSO_HTTP_METHOD_REDIRECT);
fail_unless(rc == 0, "lasso_login_build_artifact_msg failed");
-
idpIdentityContextDump = lasso_identity_dump(LASSO_PROFILE(idpLoginContext)->identity);
fail_unless(idpIdentityContextDump != NULL,
"lasso_identity_dump shouldn't return NULL");
@@ -390,6 +404,7 @@ START_TEST(test03_serviceProviderLogin)
serviceProviderId = g_strdup(LASSO_PROFILE(idpLoginContext)->remote_providerID);
fail_unless(serviceProviderId != NULL,
"lasso_profile_get_remote_providerID shouldn't return NULL");
+ pop_thin_sessions;
/* Service provider assertion consumer */
lasso_server_destroy(spContext);
@@ -406,6 +421,7 @@ START_TEST(test03_serviceProviderLogin)
soapRequestMsg = LASSO_PROFILE(spLoginContext)->msg_body;
fail_unless(soapRequestMsg != NULL, "soapRequestMsg must not be NULL");
+ push_thin_sessions;
/* Identity provider SOAP endpoint */
lasso_server_destroy(idpContext);
lasso_login_destroy(idpLoginContext);
@@ -425,6 +441,7 @@ START_TEST(test03_serviceProviderLogin)
fail_unless(rc == 0, "lasso_login_build_response_msg failed");
soapResponseMsg = LASSO_PROFILE(idpLoginContext)->msg_body;
fail_unless(soapResponseMsg != NULL, "soapResponseMsg must not be NULL");
+ pop_thin_sessions;
/* Service provider assertion consumer (step 2: process SOAP response) */
rc = lasso_login_process_response_msg(spLoginContext, soapResponseMsg);