/** * Validate that the record in the result set is indeed a record * that matched the identity provided to this adapter. * * * @access protected * @param array $resultIdentities * @return Result */ protected function validateResult($resultIdentities) { if (count($resultIdentities) < 1) { $this->_authenticateResultInfo['code'] = Result::FAILURE_IDENTITY_NOT_FOUND; $this->_authenticateResultInfo['messages'][] = 'A record with the supplied identity could not be found.'; return $this->authenticateCreateAuthResult(); } elseif (count($resultIdentities) > 1) { $this->_authenticateResultInfo['code'] = Result::FAILURE_IDENTITY_AMBIGUOUS; $this->_authenticateResultInfo['messages'][] = 'More than one record matches the supplied identity.'; return $this->authenticateCreateAuthResult(); } elseif (count($resultIdentities) == 1) { $resultIdentity = $resultIdentities[0]; $password = $resultIdentity->{$this->_credentialColumn}; if (!User::verifyPassword($this->_credential, $password)) { $this->_authenticateResultInfo['code'] = Result::FAILURE_CREDENTIAL_INVALID; $this->_authenticateResultInfo['messages'][] = 'Supplied credential is invalid.'; } else { $this->_authenticateResultInfo['code'] = Result::SUCCESS; $this->_authenticateResultInfo['identity'] = $this->_identity; $this->_authenticateResultInfo['messages'][] = 'Authentication successful.'; } } else { $this->_authenticateResultInfo['code'] = Result::FAILURE_UNCATEGORIZED; } return $this->authenticateCreateAuthResult(); }