From 9785911b17d587cb31efef4145bd86a023e82fc3 Mon Sep 17 00:00:00 2001 From: fabio Date: Fri, 8 Jul 2022 15:59:50 +0200 Subject: [PATCH 1/2] [#224] fix --- spid-validator/server/lib/saml-utils.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/spid-validator/server/lib/saml-utils.js b/spid-validator/server/lib/saml-utils.js index 46aa320..1cf90ac 100644 --- a/spid-validator/server/lib/saml-utils.js +++ b/spid-validator/server/lib/saml-utils.js @@ -609,7 +609,16 @@ class IdP { qs += this.getLogoutResponsePayload(SAMLResponse, relayState, null); } - return url + "?" + qs; + const searchParams = new URLSearchParams(qs); + + let slo = new URL(url); + let existingParams = new URLSearchParams(slo.search); + existingParams.forEach(function(value, key) { + searchParams.set(value, key); + }); + + slo.search = searchParams.toString(); + return slo.toString(); } getLogoutResponsePayload(SAMLResponse, relayState, sigAlg) { From 3859cd51ee4524b250d598a313a34ef382da7e95 Mon Sep 17 00:00:00 2001 From: fabio Date: Fri, 8 Jul 2022 16:12:07 +0200 Subject: [PATCH 2/2] [#224] key/value in a b ad order --- spid-validator/server/lib/saml-utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spid-validator/server/lib/saml-utils.js b/spid-validator/server/lib/saml-utils.js index 1cf90ac..99c62a1 100644 --- a/spid-validator/server/lib/saml-utils.js +++ b/spid-validator/server/lib/saml-utils.js @@ -614,7 +614,7 @@ class IdP { let slo = new URL(url); let existingParams = new URLSearchParams(slo.search); existingParams.forEach(function(value, key) { - searchParams.set(value, key); + searchParams.set(key, value); }); slo.search = searchParams.toString();