LP#1842297: Allow for login redirect with hostname
authoroajulianclementson <51331324+oajulianclementson@users.noreply.github.com>
Fri, 31 Jan 2020 22:51:35 +0000 (22:51 +0000)
committerChris Sharp <csharp@georgialibraries.org>
Mon, 16 Mar 2020 21:15:49 +0000 (17:15 -0400)
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/OpenAthens.pm

index f583740..4a5af93 100644 (file)
@@ -63,6 +63,12 @@ sub perform_openathens_sso_if_required {
         && $U->is_true($openathens_config->{active})
         && $U->is_true($openathens_config->{auto_signon_enabled})
     ) {
+        # Remove scheme and hostname from redirect_to (this may have been set
+        # by the login form, but isn't allowed by the OpenAthens SSO page)
+        if ($redirect_to =~ m#^https?://\Q$ctx->{hostname}\E(.+)#) {
+            $redirect_to = $1;
+        }
+
         my $redirect = $ctx->{opac_root} . '/sso/openathens?redirect_to='
             . uri_escape_utf8($redirect_to);