diff --git a/auth/ldap/auth.php b/auth/ldap/auth.php index 8686965eadb..e9d82b72fe5 100644 --- a/auth/ldap/auth.php +++ b/auth/ldap/auth.php @@ -61,6 +61,15 @@ if (!defined('AUTH_NTLM_VALID_DOMAINNAME')) { if (!defined('AUTH_NTLM_DEFAULT_FORMAT')) { define('AUTH_NTLM_DEFAULT_FORMAT', '%domain%\\%username%'); } +if (!defined('AUTH_NTLM_FASTPATH_ATTEMPT')) { + define('AUTH_NTLM_FASTPATH_ATTEMPT', 0); +} +if (!defined('AUTH_NTLM_FASTPATH_YESFORM')) { + define('AUTH_NTLM_FASTPATH_YESFORM', 1); +} +if (!defined('AUTH_NTLM_FASTPATH_YESATTEMPT')) { + define('AUTH_NTLM_FASTPATH_YESATTEMPT', 2); +} // Allows us to retrieve a diagnostic message in case of LDAP operation error if (!defined('LDAP_OPT_DIAGNOSTIC_MESSAGE')) { @@ -1626,17 +1635,17 @@ class auth_plugin_ldap extends auth_plugin_base { } // Now start the whole NTLM machinery. - if(!empty($this->config->ntlmsso_ie_fastpath)) { - // Shortcut for IE browsers: skip the attempt page + if($this->config->ntlmsso_ie_fastpath == AUTH_NTLM_FASTPATH_YESATTEMPT || + $this->config->ntlmsso_ie_fastpath == AUTH_NTLM_FASTPATH_YESFORM) { + if(check_browser_version('MSIE')) { $sesskey = sesskey(); redirect($CFG->wwwroot.'/auth/ldap/ntlmsso_magic.php?sesskey='.$sesskey); - } else { + } else if ($this->config->ntlmsso_ie_fastpath == AUTH_NTLM_FASTPATH_YESFORM) { redirect($CFG->httpswwwroot.'/login/index.php?authldap_skipntlmsso=1'); } - } else { - redirect($CFG->wwwroot.'/auth/ldap/ntlmsso_attempt.php'); } + redirect($CFG->wwwroot.'/auth/ldap/ntlmsso_attempt.php'); } // No NTLM SSO, Use the normal login page instead. diff --git a/auth/ldap/config.html b/auth/ldap/config.html index f23886a2024..0b5de31d127 100644 --- a/auth/ldap/config.html +++ b/auth/ldap/config.html @@ -106,6 +106,10 @@ if (!isset($config->ntlmsso_remoteuserformat)) { $yesno = array(get_string('no'), get_string('yes')); +$fastpathoptions = array(AUTH_NTLM_FASTPATH_YESFORM => get_string('auth_ntlmsso_ie_fastpath_yesform', 'auth_ldap'), + AUTH_NTLM_FASTPATH_YESATTEMPT => get_string('auth_ntlmsso_ie_fastpath_yesattempt', 'auth_ldap'), + AUTH_NTLM_FASTPATH_ATTEMPT => get_string('auth_ntlmsso_ie_fastpath_attempt', 'auth_ldap')); + $disabled = ''; if (!ldap_paged_results_supported($config->ldap_version)) { $disabled = ' disabled="disabled"'; @@ -562,7 +566,7 @@ if (!ldap_paged_results_supported($config->ldap_version)) {