diff options
| author | Frederic Peters <fpeters@entrouvert.com> | 2006-10-29 18:17:30 +0000 |
|---|---|---|
| committer | Frederic Peters <fpeters@entrouvert.com> | 2006-10-29 18:17:30 +0000 |
| commit | 2cab803e5aced2db133bcdef9d6b744479646834 (patch) | |
| tree | 1d8c25c2bdc2de545abf0b146e052e7572087db6 | |
| parent | dd76935c233ab2f251044bb4b2840e1a8859008e (diff) | |
deal with default assertion consumer service url
| -rw-r--r-- | lasso/saml-2.0/login.c | 50 |
1 files changed, 23 insertions, 27 deletions
diff --git a/lasso/saml-2.0/login.c b/lasso/saml-2.0/login.c index d9a0bfcd..b9107f49 100644 --- a/lasso/saml-2.0/login.c +++ b/lasso/saml-2.0/login.c @@ -150,7 +150,7 @@ lasso_saml20_login_build_authn_request_msg(LassoLogin *login, LassoProvider *rem url = lasso_provider_get_metadata_one( remote_provider, "SingleSignOnService HTTP-Artifact"); if (login->http_method == LASSO_HTTP_METHOD_ARTIFACT_GET) { - profile->msg_url = g_strdup_printf("%s?SAMLArt=%s", + profile->msg_url = g_strdup_printf("%s?SAMLart=%s", url, artifact); } else { /* TODO: ARTIFACT POST */ @@ -183,35 +183,31 @@ lasso_saml20_login_process_authn_request_msg(LassoLogin *login, const char *auth protocol_binding = LASSO_SAMLP2_AUTHN_REQUEST(profile->request)->ProtocolBinding; if (protocol_binding == NULL) { - /* protocol binding not set; will look into - * AssertionConsumingServiceIndex */ + /* protocol binding not set; so it will look into + * AssertionConsumingServiceIndex + * Also, if AssertionConsumerServiceIndex is not set in request, + * its value will be -1, which is just the right value to get + * default assertion consumer... (convenient) + */ + gchar *binding; + LassoProvider *remote_provider; int service_index = LASSO_SAMLP2_AUTHN_REQUEST( profile->request)->AssertionConsumerServiceIndex; - if (service_index == -1) { - /* XXX: what does spec say when protocol binding and - * attribute consuming service index are both unset ? - */ - message(G_LOG_LEVEL_WARNING, "missing service index"); - } else { - gchar *binding; - LassoProvider *remote_provider; - - remote_provider = g_hash_table_lookup(profile->server->providers, - profile->remote_providerID); - if (remote_provider == NULL) { - return critical_error( - LASSO_PROFILE_ERROR_MISSING_REMOTE_PROVIDERID); - } - binding = lasso_saml20_provider_get_assertion_consumer_service_binding( - remote_provider, service_index); - if (binding == NULL) { - message(G_LOG_LEVEL_WARNING, "can't find binding for index"); - } else if (strcmp(binding, "HTTP-Artifact") == 0) { - login->protocolProfile = LASSO_LOGIN_PROTOCOL_PROFILE_BRWS_ART; - } else if (strcmp(binding, "HTTP-POST") == 0) { - login->protocolProfile = LASSO_LOGIN_PROTOCOL_PROFILE_BRWS_POST; - } + remote_provider = g_hash_table_lookup(profile->server->providers, + profile->remote_providerID); + if (remote_provider == NULL) { + return critical_error(LASSO_PROFILE_ERROR_MISSING_REMOTE_PROVIDERID); + } + + binding = lasso_saml20_provider_get_assertion_consumer_service_binding( + remote_provider, service_index); + if (binding == NULL) { + message(G_LOG_LEVEL_WARNING, "can't find binding for index"); + } else if (strcmp(binding, "HTTP-Artifact") == 0) { + login->protocolProfile = LASSO_LOGIN_PROTOCOL_PROFILE_BRWS_ART; + } else if (strcmp(binding, "HTTP-POST") == 0) { + login->protocolProfile = LASSO_LOGIN_PROTOCOL_PROFILE_BRWS_POST; } } else if (strcmp(protocol_binding, LASSO_SAML20_METADATA_BINDING_ARTIFACT) == 0) { login->protocolProfile = LASSO_LOGIN_PROTOCOL_PROFILE_BRWS_ART; |
