From: Jan Date: Wed, 19 May 2010 13:57:57 +0000 (+0100) Subject: Fix checking for expired sessions. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=dd2216fff583f53621f057c8be6c21e7fe55271d;p=horde.git Fix checking for expired sessions. --- diff --git a/framework/Auth/lib/Horde/Auth/Shibboleth.php b/framework/Auth/lib/Horde/Auth/Shibboleth.php index 01311e714..7b0e2b73d 100644 --- a/framework/Auth/lib/Horde/Auth/Shibboleth.php +++ b/framework/Auth/lib/Horde/Auth/Shibboleth.php @@ -83,7 +83,7 @@ class Horde_Auth_Shibboleth extends Horde_Auth_Base public function checkExistingAuth() { return !empty($_SERVER[$this->_params['username_header']]) && - $_SERVER[$this->_params['username_header']] == Horde_Auth::getAuth(); + $this->_removeScope($_SERVER[$this->_params['username_header']]) == Horde_Auth::getAuth(); } /** @@ -101,12 +101,7 @@ class Horde_Auth_Shibboleth extends Horde_Auth_Base $username = $_SERVER[$this->_params['username_header']]; // Remove scope from username, if present. - $pos = strrpos($username, '@'); - if ($pos !== false) { - $username = substr($username, 0, $pos); - } - - $this->_credentials['userId'] = $username; + $this->_credentials['userId'] = $this->_removeScope($username); // Set password for hordeauth login. switch ($this->_params['password_holder']) { @@ -125,4 +120,20 @@ class Horde_Auth_Shibboleth extends Horde_Auth_Base return true; } + /** + * Removes the scope from the user name, if present. + * + * @param string $username The full user name. + * + * @return string The user name without scope. + */ + protected function _removeScope($username) + { + $pos = strrpos($username, '@'); + if ($pos !== false) { + $username = substr($username, 0, $pos); + } + return $username; + } + }