diff options
| author | Frederic Peters <fpeters@entrouvert.com> | 2005-01-21 16:04:55 +0000 |
|---|---|---|
| committer | Frederic Peters <fpeters@entrouvert.com> | 2005-01-21 16:04:55 +0000 |
| commit | 061b6861408379601c62b8ce92ee0e9104e79524 (patch) | |
| tree | 1bdbd74eec82c44180aa934d7135018e4c66ff83 | |
| parent | df25346c2cbed0ce44128a7e44b9b81c26d06918 (diff) | |
| download | lasso-061b6861408379601c62b8ce92ee0e9104e79524.tar.gz lasso-061b6861408379601c62b8ce92ee0e9104e79524.tar.xz lasso-061b6861408379601c62b8ce92ee0e9104e79524.zip | |
if existing, use SessionIndex from assertion in lib:LogoutRequest.
| -rw-r--r-- | lasso/id-ff/logout.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/lasso/id-ff/logout.c b/lasso/id-ff/logout.c index 9e0f99b9..1c9e71b1 100644 --- a/lasso/id-ff/logout.c +++ b/lasso/id-ff/logout.c @@ -29,6 +29,8 @@ #include <lasso/id-ff/providerprivate.h> #include <lasso/id-ff/sessionprivate.h> +#include <lasso/xml/lib_authentication_statement.h> + struct _LassoLogoutPrivate { gboolean dispose_has_run; @@ -265,20 +267,23 @@ lasso_logout_init_request(LassoLogout *logout, char *remote_providerID, LassoSamlAssertion *assertion; LassoFederation *federation = NULL; gboolean is_http_redirect_get_method = FALSE; + LassoSession *session; + char *session_index = NULL; g_return_val_if_fail(LASSO_IS_LOGOUT(logout), LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ); profile = LASSO_PROFILE(logout); /* verify if session exists */ - if (profile->session == NULL) { + session = lasso_profile_get_session(profile); + if (session == NULL) { return critical_error(LASSO_PROFILE_ERROR_SESSION_NOT_FOUND); } /* get the remote provider id If remote_providerID is NULL, then get the first remote provider id in session */ if (remote_providerID == NULL) { - profile->remote_providerID = lasso_session_get_provider_index(profile->session, 0); + profile->remote_providerID = lasso_session_get_provider_index(session, 0); } else { profile->remote_providerID = g_strdup(remote_providerID); } @@ -287,12 +292,21 @@ lasso_logout_init_request(LassoLogout *logout, char *remote_providerID, } /* get assertion */ - assertion = lasso_session_get_assertion(profile->session, profile->remote_providerID); + assertion = lasso_session_get_assertion(session, profile->remote_providerID); if (LASSO_IS_SAML_ASSERTION(assertion) == FALSE) { message(G_LOG_LEVEL_CRITICAL, "Assertion not found"); return LASSO_ERROR_UNDEFINED; } + if (assertion->AuthenticationStatement && LASSO_IS_LIB_AUTHENTICATION_STATEMENT( + assertion->AuthenticationStatement)) { + LassoLibAuthenticationStatement *as = + LASSO_LIB_AUTHENTICATION_STATEMENT(assertion->AuthenticationStatement); + if (as->SessionIndex) + session_index = g_strdup(as->SessionIndex); + } + + /* if format is one time, then get name identifier from assertion, else get name identifier from federation */ nameIdentifier = LASSO_SAML_SUBJECT_STATEMENT_ABSTRACT( @@ -360,6 +374,8 @@ lasso_logout_init_request(LassoLogout *logout, char *remote_providerID, LASSO_SIGNATURE_TYPE_NONE, 0); } + if (session_index) + LASSO_LIB_LOGOUT_REQUEST(profile->request)->SessionIndex = session_index; if (profile->msg_relayState) LASSO_LIB_LOGOUT_REQUEST(profile->request)->RelayState = g_strdup(profile->msg_relayState); |
