|
|
18af29 |
From 1e85f1b2bd30c0d93b4a2ef37b35abeae3d15b56 Mon Sep 17 00:00:00 2001
|
|
|
18af29 |
From: Dmitrii Shcherbakov <dmitrii.shcherbakov@canonical.com>
|
|
|
18af29 |
Date: Fri, 28 Jun 2019 02:36:19 +0300
|
|
|
18af29 |
Subject: [PATCH] PAOS: Do not populate "Destination" attribute
|
|
|
18af29 |
|
|
|
18af29 |
When ECP profile (saml-ecp-v2.0-cs01) is used with PAOS binding Lasso
|
|
|
18af29 |
populates an AuthnRequest with the "Destination" attribute set to
|
|
|
18af29 |
AssertionConsumerURL of an SP - this leads to IdP-side errors because
|
|
|
18af29 |
the destination attribute in the request does not match the IdP URL.
|
|
|
18af29 |
|
|
|
18af29 |
The "Destination" attribute is mandatory only for HTTP Redirect and HTTP
|
|
|
18af29 |
Post bindings when AuthRequests are signed per saml-bindings-2.0-os
|
|
|
18af29 |
(sections 3.4.5.2 and 3.5.5.2). Specifically for PAOS it makes sense to
|
|
|
18af29 |
avoid setting that optional attribute because an ECP decides which IdP
|
|
|
18af29 |
to use, not the SP.
|
|
|
18af29 |
|
|
|
18af29 |
Fixes Bug: 34409
|
|
|
18af29 |
License: MIT
|
|
|
18af29 |
Signed-off-by: Dmitrii Shcherbakov <dmitrii.shcherbakov@canonical.com>
|
|
|
18af29 |
---
|
|
|
18af29 |
lasso/saml-2.0/login.c | 18 +++++++++---------
|
|
|
18af29 |
lasso/saml-2.0/profile.c | 10 +++++++++-
|
|
|
18af29 |
2 files changed, 18 insertions(+), 10 deletions(-)
|
|
|
18af29 |
|
|
|
18af29 |
diff --git a/lasso/saml-2.0/login.c b/lasso/saml-2.0/login.c
|
|
|
18af29 |
index 6e8f7553..0d4bb1da 100644
|
|
|
18af29 |
--- a/lasso/saml-2.0/login.c
|
|
|
18af29 |
+++ b/lasso/saml-2.0/login.c
|
|
|
18af29 |
@@ -222,7 +222,7 @@ _lasso_login_must_verify_signature(LassoProfile *profile) {
|
|
|
18af29 |
gint
|
|
|
18af29 |
lasso_saml20_login_build_authn_request_msg(LassoLogin *login)
|
|
|
18af29 |
{
|
|
|
18af29 |
- char *url = NULL;
|
|
|
18af29 |
+ char *assertionConsumerServiceURL = NULL;
|
|
|
18af29 |
gboolean must_sign = TRUE;
|
|
|
18af29 |
LassoProfile *profile;
|
|
|
18af29 |
LassoSamlp2AuthnRequest *authn_request;
|
|
|
18af29 |
@@ -247,29 +247,29 @@ lasso_saml20_login_build_authn_request_msg(LassoLogin *login)
|
|
|
18af29 |
}
|
|
|
18af29 |
|
|
|
18af29 |
if (login->http_method == LASSO_HTTP_METHOD_PAOS) {
|
|
|
18af29 |
-
|
|
|
18af29 |
/*
|
|
|
18af29 |
* PAOS is special, the url passed to build_request is the
|
|
|
18af29 |
* AssertionConsumerServiceURL of this SP, not the
|
|
|
18af29 |
- * destination.
|
|
|
18af29 |
+ * destination IdP URL. This is done to fill paos:responseConsumerURL
|
|
|
18af29 |
+ * appropriately down the line in build_request_msg.
|
|
|
18af29 |
+ * See https://dev.entrouvert.org/issues/34409 for more information.
|
|
|
18af29 |
*/
|
|
|
18af29 |
if (authn_request->AssertionConsumerServiceURL) {
|
|
|
18af29 |
- url = authn_request->AssertionConsumerServiceURL;
|
|
|
18af29 |
+ assertionConsumerServiceURL = authn_request->AssertionConsumerServiceURL;
|
|
|
18af29 |
if (!lasso_saml20_provider_check_assertion_consumer_service_url(
|
|
|
18af29 |
- LASSO_PROVIDER(profile->server), url, LASSO_SAML2_METADATA_BINDING_PAOS)) {
|
|
|
18af29 |
+ LASSO_PROVIDER(profile->server), assertionConsumerServiceURL, LASSO_SAML2_METADATA_BINDING_PAOS)) {
|
|
|
18af29 |
rc = LASSO_PROFILE_ERROR_INVALID_REQUEST;
|
|
|
18af29 |
goto cleanup;
|
|
|
18af29 |
}
|
|
|
18af29 |
} else {
|
|
|
18af29 |
- url = lasso_saml20_provider_get_assertion_consumer_service_url_by_binding(
|
|
|
18af29 |
+ assertionConsumerServiceURL = lasso_saml20_provider_get_assertion_consumer_service_url_by_binding(
|
|
|
18af29 |
LASSO_PROVIDER(profile->server), LASSO_SAML2_METADATA_BINDING_PAOS);
|
|
|
18af29 |
- lasso_assign_new_string(authn_request->AssertionConsumerServiceURL, url);
|
|
|
18af29 |
+ lasso_assign_new_string(authn_request->AssertionConsumerServiceURL, assertionConsumerServiceURL);
|
|
|
18af29 |
}
|
|
|
18af29 |
}
|
|
|
18af29 |
|
|
|
18af29 |
-
|
|
|
18af29 |
lasso_check_good_rc(lasso_saml20_profile_build_request_msg(profile, "SingleSignOnService",
|
|
|
18af29 |
- login->http_method, url));
|
|
|
18af29 |
+ login->http_method, assertionConsumerServiceURL));
|
|
|
18af29 |
|
|
|
18af29 |
cleanup:
|
|
|
18af29 |
return rc;
|
|
|
18af29 |
diff --git a/lasso/saml-2.0/profile.c b/lasso/saml-2.0/profile.c
|
|
|
18af29 |
index 22a4e08c..85f535ae 100644
|
|
|
18af29 |
--- a/lasso/saml-2.0/profile.c
|
|
|
18af29 |
+++ b/lasso/saml-2.0/profile.c
|
|
|
18af29 |
@@ -968,7 +968,15 @@ lasso_saml20_profile_build_request_msg(LassoProfile *profile, const char *servic
|
|
|
18af29 |
made_url = url = get_url(provider, service, http_method_to_binding(method));
|
|
|
18af29 |
}
|
|
|
18af29 |
|
|
|
18af29 |
- if (url) {
|
|
|
18af29 |
+
|
|
|
18af29 |
+ // Usage of the Destination attribute on a request is mandated only
|
|
|
18af29 |
+ // in "3.4.5.2" and "3.5.5.2" in saml-bindings-2.0-os for signed requests
|
|
|
18af29 |
+ // and is marked as optional in the XSD schema otherwise.
|
|
|
18af29 |
+ // PAOS is a special case because an SP does not select an IdP - ECP does
|
|
|
18af29 |
+ // it instead. Therefore, this attribute needs to be left unpopulated.
|
|
|
18af29 |
+ if (method == LASSO_HTTP_METHOD_PAOS) {
|
|
|
18af29 |
+ lasso_release_string(((LassoSamlp2RequestAbstract*)profile->request)->Destination);
|
|
|
18af29 |
+ } else if (url) {
|
|
|
18af29 |
lasso_assign_string(((LassoSamlp2RequestAbstract*)profile->request)->Destination,
|
|
|
18af29 |
url);
|
|
|
18af29 |
} else {
|
|
|
18af29 |
--
|
|
|
18af29 |
2.20.1
|
|
|
18af29 |
|