From 7ebfec38cddfeb0bbce1cc286de86f29abc017d0 Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Tue, 2 Jan 2024 11:46:10 +0100 Subject: [PATCH 1/2] Send redirectUrl param to the IdP in the target url --- src/aai/aai.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/aai/aai.js b/src/aai/aai.js index f7e9f48654d..8f31b360349 100644 --- a/src/aai/aai.js +++ b/src/aai/aai.js @@ -20,7 +20,7 @@ this.setup = function(options) { var opts = jQuery.extend({}, this.defaults, options), defaultCallback = function(e) { - window.location = opts.host + '/Shibboleth.sso/Login?SAMLDS=1&target=' + opts.target + '&entityID=' + window.encodeURIComponent(e.entityID); + window.location = opts.host + '/Shibboleth.sso/Login?SAMLDS=1&target=' + opts.target + '?redirectUrl=' + window.location.href + '&entityID=' + window.encodeURIComponent(e.entityID); }; //console.log(opts); if(!opts.target){ @@ -33,7 +33,7 @@ opts.ourEntityID, opts.responseUrl, [ ], - opts.host + '/Shibboleth.sso/Login?SAMLDS=1&target='+opts.target+'&entityID='); + opts.host + '/Shibboleth.sso/Login?SAMLDS=1&target=' + opts.target + '?redirectUrl=' + window.location.href + '&entityID='); djc.discoPath = window.location.origin + (namespace === '' ? namespace : '/' + namespace) + "/assets/"; djc.metadata = [opts.metadataFeed]; djc.subtitle = "Login via Your home institution (e.g. university)"; From 8c31e2a7a004d8a2e097928bf06289710c27c850 Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Wed, 3 Jan 2024 08:49:06 +0100 Subject: [PATCH 2/2] The code is updated to be more readable. --- src/aai/aai.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/aai/aai.js b/src/aai/aai.js index 8f31b360349..97725bfb15b 100644 --- a/src/aai/aai.js +++ b/src/aai/aai.js @@ -18,9 +18,11 @@ textHelpMore: "First check you are searching under the right country.\nIf your provider is not listed, please read these instructions to obtain an account." }; this.setup = function(options) { + var targetUrl = ''; var opts = jQuery.extend({}, this.defaults, options), defaultCallback = function(e) { - window.location = opts.host + '/Shibboleth.sso/Login?SAMLDS=1&target=' + opts.target + '?redirectUrl=' + window.location.href + '&entityID=' + window.encodeURIComponent(e.entityID); + targetUrl = opts.target + '?redirectUrl=' + window.location.href; + window.location = opts.host + '/Shibboleth.sso/Login?SAMLDS=1&target=' + targetUrl + '&entityID=' + window.encodeURIComponent(e.entityID); }; //console.log(opts); if(!opts.target){ @@ -33,7 +35,7 @@ opts.ourEntityID, opts.responseUrl, [ ], - opts.host + '/Shibboleth.sso/Login?SAMLDS=1&target=' + opts.target + '?redirectUrl=' + window.location.href + '&entityID='); + opts.host + '/Shibboleth.sso/Login?SAMLDS=1&target=' + targetUrl + '&entityID='); djc.discoPath = window.location.origin + (namespace === '' ? namespace : '/' + namespace) + "/assets/"; djc.metadata = [opts.metadataFeed]; djc.subtitle = "Login via Your home institution (e.g. university)";