[TikiWiki-commits] [Git][tikiwiki/tiki][30.x] [FIX] SAML (SSO) Login: user should be redirected to originally requested URL

"Bruno Kambere \(@kambereBr\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a3c3d199b9df_38198ae8377e6@gitlab-sidekiq-low-urgency-cpu-bound-v2-5dfb9f7675-zvndg.mail>

Bruno Kambere pushed to branch 30.x at Tiki Wiki CMS Groupware / Tiki


Commits:
9642c9a6 by Josaphat Imani at 2026-06-24T23:18:35+03:00
[FIX] SAML (SSO) Login: user should be redirected to originally requested URL
---
* [FIX] SAML (SSO) Login: user should be redirected to originally requested URL
---
* [FIX] SAML Login: redirect to where you should go

See merge request tikiwiki/tiki!10419


(cherry picked from commit edc3ee18f42890ef991cefb50d9822df723a6f8c)

72bc807f [FIX] SAML Login: redirect to where you should go

Co-authored-by: Josaphat Imani <[email protected]>

See merge request tikiwiki/tiki!10594

- - - - -


1 changed file:

- lib/userslib.php


Changes:

=====================================
lib/userslib.php
=====================================
@@ -1236,11 +1236,13 @@ class UsersLib extends TikiLib
         }
 
         $clicked_on_saml_link = false;
+        $post_auth_redirect = '';
 
         // Check endpoints
         if (array_key_exists('auth', $_REQUEST) && $_REQUEST['auth'] == 'saml') {
             $saml_instance = $this->get_saml_auth();
-            $saml_instance->login();
+            $return_to = $_SESSION['loginfrom'] ?? null;
+            $saml_instance->login($return_to);
         } elseif (array_key_exists('saml_metadata', $_REQUEST)) {
             $samlSettingsInfo = $this->get_saml_settings();
             $saml_settings = new Saml2\Settings($samlSettingsInfo, true);
@@ -1278,11 +1280,8 @@ class UsersLib extends TikiLib
             $_SESSION['samlUserdata'] = $saml_instance->getAttributes();
             $_SESSION['samlNameId'] = $saml_instance->getNameId();
             $_SESSION['samlSessionIndex'] = $saml_instance->getSessionIndex();
-/*
-            if (isset($_POST['RelayState']) && OneLogin_Saml2_Utils::getSelfURL() != $_POST['RelayState']) {
-                $saml_instance->redirectTo($_POST['RelayState']);
-            }
-*/
+
+            $post_auth_redirect = $_POST['RelayState'] ?? '';
         } elseif (array_key_exists('saml_sls', $_REQUEST)) {
             $saml_instance = $this->get_saml_auth();
 
@@ -1308,6 +1307,11 @@ class UsersLib extends TikiLib
 
         if ($clicked_on_saml_link || ($force_saml_login && ! $already_logged_as_admin)) {
             $this->validate_user("", "", "", "");
+
+            if (! empty($post_auth_redirect)) {
+                header('Location: ' . $post_auth_redirect);
+                exit;
+            }
         }
     }
 



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/9642c9a6d9aea7f525feec2f4b4a09296e573af0

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/9642c9a6d9aea7f525feec2f4b4a09296e573af0
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.