/** * Validate the identity returned from the database. * * Overrides the Zend implementation to provide user IDs, not usernames * upon successful validation. * * @param array $resultIdentity * @todo Should this instead override _authenticateCreateAuthResult()? */ protected function _authenticateValidateResult($resultIdentity) { $authResult = parent::_authenticateValidateResult($resultIdentity); if (!$authResult->isValid()) { return $authResult; } // This auth result uses the username as the identity, what we need // instead is the user ID. $correctResult = new Zend_Auth_Result($authResult->getCode(), $this->_resultRow['id'], $authResult->getMessages()); return $correctResult; }
protected function _authenticateValidateResult($resultIdentity) { if ($resultIdentity['domain_user']) { $ldap = new Base_Ldap(); if (!$ldap->checkUserInLdap($this->_identity, $this->_credential)) { $this->_authenticateResultInfo['code'] = Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID; $this->_authenticateResultInfo['messages'][] = 'Supplied credential is invalid.'; return $this->_authenticateCreateAuthResult(); } unset($resultIdentity[$zendAuthCredentialMatchColumn]); $this->_resultRow = $resultIdentity; $this->_authenticateResultInfo['code'] = Zend_Auth_Result::SUCCESS; $this->_authenticateResultInfo['messages'][] = 'Authentication successful.'; return $this->_authenticateCreateAuthResult(); } else { return parent::_authenticateValidateResult($resultIdentity); } }