Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

saml2_settings::OPTION_DUAL_LOGIN_NO not always respected #834

Open
danmarsden opened this issue Sep 11, 2024 · 0 comments
Open

saml2_settings::OPTION_DUAL_LOGIN_NO not always respected #834

danmarsden opened this issue Sep 11, 2024 · 0 comments

Comments

@danmarsden
Copy link
Member

the should_login_redirect() function will sometimes initiate a redirect to saml when multiple auth methods are in use, so it should allow the normal process to occur.
Possible patch that fixes it (I'll review this further and look at a PR.)

diff --git a/auth/saml2/classes/auth.php b/auth/saml2/classes/auth.php
index 61aaedd3eff..ccb46466448 100644
--- a/auth/saml2/classes/auth.php
+++ b/auth/saml2/classes/auth.php
@@ -471,6 +471,14 @@ class auth extends \auth_plugin_base {
$saml = 0;
}

• // If ?saml=on even when duallogin is on, go directly to IdP.
• if ($saml == 1) {
• $this->log(__FUNCTION__ . ' redirecting due to query param ?saml=on');
• return true;
• }
+
• return false;
+
// Never redirect on POST.
if (isset($_SERVER['REQUEST_METHOD']) && ($_SERVER['REQUEST_METHOD'] == 'POST')) {
$this->log(__FUNCTION__ . ' skipping due to method=post');
@@ -519,12 +527,6 @@ class auth extends \auth_plugin_base {
return false;
}

• // If ?saml=on even when duallogin is on, go directly to IdP.
• if ($saml == 1) {
• $this->log(__FUNCTION__ . ' redirecting due to query param ?saml=on');
• return true;
• }
-
// Check whether we've skipped saml already.
// This is here because loginpage_hook is called again during form
// submission (all of login.php is processed) and ?saml=off is not
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant