From 17a39a132b4e6d8bf1239f5d674f50d4e7142e17 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Tue, 21 Jul 2009 21:39:28 -0600 Subject: [PATCH] Fix auth with application driver (transparent auth was unnecessarily erasing auth credentials) --- framework/Auth/lib/Horde/Auth.php | 12 +++++------- framework/Auth/lib/Horde/Auth/Base.php | 21 +++++++-------------- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/framework/Auth/lib/Horde/Auth.php b/framework/Auth/lib/Horde/Auth.php index ca3a39232..11ae5fd3b 100644 --- a/framework/Auth/lib/Horde/Auth.php +++ b/framework/Auth/lib/Horde/Auth.php @@ -426,9 +426,9 @@ class Horde_Auth */ static public function getAuth() { - return (!empty($_SESSION['horde_auth']['userId'])) - ? $_SESSION['horde_auth']['userId'] - : false; + return empty($_SESSION['horde_auth']['userId']) + ? false + : $_SESSION['horde_auth']['userId']; } /** @@ -664,16 +664,14 @@ class Horde_Auth /* Clear any existing info. */ self::clearAuth(); - $credentials = Horde_Secret::write(Horde_Secret::getKey('auth'), serialize($credentials)); - $browser = Horde_Browser::singleton(); $_SESSION['horde_auth'] = array( 'app' => $app_array, 'browser' => $browser->getAgentString(), 'change' => !empty($options['change']), - 'credentials' => $credentials, - 'driver' => ($app == 'horde') ? $GLOBALS['conf']['auth']['driver'] : $app, + 'credentials' => Horde_Secret::write(Horde_Secret::getKey('auth'), serialize($credentials)), + 'driver' => $GLOBALS['conf']['auth']['driver'], 'remoteAddr' => isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : null, 'timestamp' => time(), 'userId' => $userId diff --git a/framework/Auth/lib/Horde/Auth/Base.php b/framework/Auth/lib/Horde/Auth/Base.php index e1b6f3a2d..e4f08cb5d 100644 --- a/framework/Auth/lib/Horde/Auth/Base.php +++ b/framework/Auth/lib/Horde/Auth/Base.php @@ -43,7 +43,11 @@ abstract class Horde_Auth_Base * * @var array */ - protected $_credentials = array(); + protected $_credentials = array( + 'credentials' => array(), + 'params' => array('change' => false), + 'userId' => '' + ); /** * Constructor. @@ -83,11 +87,8 @@ abstract class Horde_Auth_Base /* Store the credentials being checked so that subclasses can modify * them if necessary. */ - $this->_credentials = array( - 'credentials' => $credentials, - 'params' => array('change' => false), - 'userId' => $userId - ); + $this->_credentials['credentials'] = $credentials; + $this->_credentials['userId'] = $userId; try { $this->_authenticate($userId, $credentials); @@ -201,14 +202,6 @@ abstract class Horde_Auth_Base */ public function transparent() { - /* Reset the credentials being checked so that subclasses can modify - * them if necessary. */ - $this->_credentials = array( - 'credentials' => array(), - 'params' => array('change' => false), - 'userId' => '' - ); - if ($this->_transparent()) { return Horde_Auth::setAuth( $this->_credentials['userId'], -- 2.11.0