diff --git a/includes/auth/auth_saml.php b/includes/auth/auth_saml.php index efae9a1..eb392ac 100644 --- a/includes/auth/auth_saml.php +++ b/includes/auth/auth_saml.php @@ -78,7 +78,7 @@ function autologin_saml() if (!saml_instance()->isAuthenticated()) return array(); - return saml_user_row(saml_attribute($config['saml_uid'])); + return saml_user_row(utf8_htmlspecialchars(saml_attribute($config['saml_mail']))); } /** Login through SAML. @@ -106,14 +106,17 @@ function login_saml(&$username, &$password) saml_auth_or_redirect(); if ($saml->isAuthenticated()) { - $username = saml_attribute($config['saml_uid']); - $user_row = saml_user_row($username); + // Use usermail instead of username; username could be changed in phpBB3 ucp, mail should be more unique + $usermail = ''; + if (!empty($config['saml_mail'])) + $usermail = utf8_htmlspecialchars(saml_attribute($config['saml_mail'])); + + $user_row = saml_user_row($usermail); if (empty($user_row)) { // User unknown... We create his/her profile. - $usermail = ''; - if (!empty($config['saml_mail'])) - $usermail = utf8_htmlspecialchars(saml_attribute($config['saml_mail'])); + + $username = saml_attribute($config['saml_uid'])); // retrieve default group id global $db; @@ -263,20 +266,20 @@ function saml_username() * * Reads the user row from the database. If none is found, then returns the $default_row. * - * @param string $username Username. + * @param string $usermail Usermail. * @param array $default_row The default row in case no user is found. * @param bool $select_all Whether to retrieve all fields or just a specific subset. * * @return array The user row or $default_row if the user does not exists in phpBB. */ -function saml_user_row($username, $default_row = array(), $select_all = true) +function saml_user_row($usermail, $default_row = array(), $select_all = true) { global $db; $user_row = $default_row; $sql = 'SELECT'; if ($select_all) $sql .= ' *'; - $sql .= ' FROM ' . USERS_TABLE . " WHERE username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'"; + $sql .= ' FROM ' . USERS_TABLE . " WHERE user_email = '" . $usermail . "'"; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); diff --git a/language/de/mods/info_acp_saml.php b/language/de/mods/info_acp_saml.php new file mode 100644 index 0000000..74fde7c --- /dev/null +++ b/language/de/mods/info_acp_saml.php @@ -0,0 +1,50 @@ + + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies +or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE +AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ +/** + * phpBB SAML auth plug-in. English translation. + * + * @package language + * @version $Id$ + * @copyright (c) 2012 Anelis + * @author Gregoire Astruc + * @licence http://opensource.org/licenses/MIT MIT Licence + */ + +if (empty($lang) || !is_array($lang)) +{ + $lang = array(); +} + +$lang = array_merge($lang, array( + 'SAML_NOT_IMPLEMENTED' => 'SAML wurde noch nicht implementiert.', + 'SAML_PATH' => 'SimpleSAMLphp Pfad', + 'SAML_PATH_EXPLAIN' => 'Absoluter oder Relativer Pfad zu der simpleSAMLphp Installation.', + 'SAML_SP' => 'Genutzter SP.', + 'SAML_SP_EXPLAIN' => 'SAML Service Provider, den das Board nutzt.', + 'SAML_UID' => 'SAML Benutzernamen Attribut.', + 'SAML_UID_EXPLAIN' => 'Gibt Benutzernamen an. Bsp: uid, sn, cn, username, eduPerson...', + 'SAML_MAIL' => 'SAML EMail Attribut.', + 'SAML_MAIL_EXPLAIN' => 'Setzt die EMail-Adresse des Nutzers bei der ersten Anmeldung.', + + 'SAML_NOT_DIRECTORY' => 'Der angegebene Pfad ist kein gültiges Verzeichnis.', + 'SAML_CANNOT_INCLUDE' => 'Kann simpleSAMLphp Installation nicht finden. Ist der Pfad korrekt angegeben?', + 'SAML_INVALID_SP' => 'Der Name des SP ist ungültig.', +)); +?>