Fix auth with application driver (transparent auth was unnecessarily
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 22 Jul 2009 03:39:28 +0000 (21:39 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 22 Jul 2009 03:39:28 +0000 (21:39 -0600)
erasing auth credentials)

framework/Auth/lib/Horde/Auth.php
framework/Auth/lib/Horde/Auth/Base.php

index ca3a392..11ae5fd 100644 (file)
@@ -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
index e1b6f3a..e4f08cb 100644 (file)
@@ -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'],