From: Gunnar Wrobel
Date: Wed, 1 Dec 2010 21:01:13 +0000 (+0100) Subject: Allow the drivers to rewrite the login credentials again. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=43feccd880b87c458d653243f3f800f9e4e99539;p=horde.git Allow the drivers to rewrite the login credentials again. --- diff --git a/framework/Auth/lib/Horde/Auth/Base.php b/framework/Auth/lib/Horde/Auth/Base.php index c1fe00872..63ed92567 100644 --- a/framework/Auth/lib/Horde/Auth/Base.php +++ b/framework/Auth/lib/Horde/Auth/Base.php @@ -106,8 +106,9 @@ abstract class Horde_Auth_Base $userId = trim($userId); try { + $this->_credentials['userId'] = $userId; $this->_authenticate($userId, $credentials); - $this->setCredential('userId', $userId); + $this->setCredential('userId', $this->_credentials['userId']); $this->setCredential('credentials', $credentials); return true; } catch (Horde_Auth_Exception $e) { diff --git a/framework/Auth/test/Horde/Auth/Unit/KolabTest.php b/framework/Auth/test/Horde/Auth/Unit/KolabTest.php index 703dfe124..7ad0c0131 100644 --- a/framework/Auth/test/Horde/Auth/Unit/KolabTest.php +++ b/framework/Auth/test/Horde/Auth/Unit/KolabTest.php @@ -77,4 +77,19 @@ class Horde_Auth_Unit_KolabTest extends Horde_Auth_TestCase $this->assertEquals(Horde_Auth::REASON_FAILED, $e->getCode()); } } + + public function testUidRewrite() + { + $this->kolab->expects($this->once()) + ->method('connect') + ->with('user', array('password' => 'password')) + ->will($this->returnValue(null)); + $this->kolab->expects($this->once()) + ->method('getMail') + ->will($this->returnValue('user@example.com')); + $this->driver->authenticate('user', array('password' => 'password')); + $this->assertEquals( + 'user@example.com', $this->driver->getCredential('userId') + ); + } } \ No newline at end of file