Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
added extra validation, verification and unit tests for issue ZF-7289
Browse files Browse the repository at this point in the history
git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@22613 44c647ce-9c0f-0410-b52a-842ac1e357ba
  • Loading branch information
dragonbe authored and weierophinney committed Jul 22, 2010
1 parent c79afc4 commit 48f458a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Adapter/DbTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,17 @@ public function authenticate()
return $authResult;
}

if (true === $this->getAmbiguityIdentity()) {
$validIdentities = array ();
$zendAuthCredentialMatchColumn = $this->_zendDb->foldCase('zend_auth_credential_match');
foreach ($resultIdentities as $identity) {
if (1 === (int) $identity[$zendAuthCredentialMatchColumn]) {
$validIdentities[] = $identity;
}
}
$resultIdentities = $validIdentities;
}

$authResult = $this->_authenticateValidateResult(array_shift($resultIdentities));
return $authResult;
}
Expand Down
3 changes: 3 additions & 0 deletions test/Adapter/DbTableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,9 @@ public function testEqualUsernamesDifferentPasswordShouldAuthenticateWhenFlagIsS
$this->assertTrue($result->isValid());
$this->assertEquals('my_username', $result->getIdentity());

$this->_adapter = null;
$this->_setupAuthAdapter();

// test if user 2 can authenticate
$this->_adapter->setIdentity('my_username')
->setCredential('my_otherpass')
Expand Down

0 comments on commit 48f458a

Please sign in to comment.