From f309632a05198cc24b1f8e771bbb40e3fd0c2ed2 Mon Sep 17 00:00:00 2001 From: exe-cutor Date: Wed, 11 Jul 2007 08:04:12 +0000 Subject: [PATCH] Merged changes from stable version --- auth/shibboleth/README.txt | 3 ++- auth/shibboleth/auth.php | 14 ++++++++++---- auth/shibboleth/index.php | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/auth/shibboleth/README.txt b/auth/shibboleth/README.txt index a353c482ea..dc07603042 100644 --- a/auth/shibboleth/README.txt +++ b/auth/shibboleth/README.txt @@ -9,13 +9,14 @@ Changes: - 11. 2004: Created by Markus Hagman - 05. 2005: Modifications to login process by Martin Dougiamas - 05. 2005: Various extensions and fixes by Lukas Haemmerle -- 06. 2005: Adaptions to new field locks and plugin config structures by Marting +- 06. 2005: Adaptions to new field locks and plugin config structures by Martin Langhoff and Lukas Haemmerle - 10. 2005: Added better error messages and moved text to language directories - 02. 2006: Simplified authentication so that authorization works properly Added instructions for IIS - 11. 2006: User capabilities are now loaded properly as of Moodle 1.7+ - 03. 2007: Adapted authentication method to Moodle 1.8 +- 07. 2007: Fixed a but that caused problems with uppercase usernames Moodle Configuration with Dual login ------------------------------------------------------------------------------- diff --git a/auth/shibboleth/auth.php b/auth/shibboleth/auth.php index f239fa5735..2647f92c8f 100644 --- a/auth/shibboleth/auth.php +++ b/auth/shibboleth/auth.php @@ -51,7 +51,7 @@ class auth_plugin_shibboleth extends auth_plugin_base { // If we are in the shibboleth directory then we trust the server var if (!empty($_SERVER[$this->config->user_attribute])) { - return ($_SERVER[$this->config->user_attribute] == $username); + return (strtolower($_SERVER[$this->config->user_attribute]) == strtolower($username)); } else { // If we are not, the user has used the manual login and the login name is // unknown, so we return false. @@ -87,7 +87,13 @@ class auth_plugin_shibboleth extends auth_plugin_base { $search_attribs = array(); foreach ($attrmap as $key=>$value) { - $result[$key] = $this->get_first_string($_SERVER[$value]); + + // Make usename lowercase + if ($key == 'username'){ + $result[$key] = strtolower($this->get_first_string($_SERVER[$value])); + } else { + $result[$key] = $this->get_first_string($_SERVER[$value]); + } } // Provide an API to modify the information to fit the Moodle internal @@ -118,7 +124,7 @@ class auth_plugin_shibboleth extends auth_plugin_base { $moodleattributes = array(); foreach ($fields as $field) { - if ($configarray["field_map_$field"]) { + if (isset($configarray["field_map_$field"])) { $moodleattributes[$field] = $configarray["field_map_$field"]; } } @@ -218,4 +224,4 @@ class auth_plugin_shibboleth extends auth_plugin_base { } } -?> +?> \ No newline at end of file diff --git a/auth/shibboleth/index.php b/auth/shibboleth/index.php index 9bda6c35d8..347e6a822c 100644 --- a/auth/shibboleth/index.php +++ b/auth/shibboleth/index.php @@ -26,7 +26,7 @@ /// If we can find the Shibboleth attribute, save it in session and return to main login page if (!empty($_SERVER[$pluginconfig->user_attribute])) { // Shibboleth auto-login - $frm->username = $_SERVER[$pluginconfig->user_attribute]; + $frm->username = strtolower($_SERVER[$pluginconfig->user_attribute]); $frm->password = substr(base64_encode($_SERVER[$pluginconfig->user_attribute]),0,8); // The random password consists of the first 8 letters of the base 64 encoded user ID // This password is never used unless the user account is converted to manual -- 2.39.5