_username = $username; $this->_password = $password; if ($iponly){ $this->_password = 'iponly:'.$_SERVER['REMOTE_ADDR']; } $this->_checkIp = false; } public function authenticate() { $adressIp = $_SERVER['REMOTE_ADDR']; require_once 'Scores/WsScores.php'; $ws = new WsScores($this->_username, $this->_password); $InfosLogin = $ws->getInfosLogin($this->_username, $adressIp); $identity = new stdClass; $identity->username = $this->_username; $identity->password = $this->_password; // @todo : Hash ? $identity->email = $InfosLogin->result->email; $identity->profil = $InfosLogin->result->profil; $identity->pref = $InfosLogin->result->pref; $identity->droits = $InfosLogin->result->droits; $identity->droitsClients = $InfosLogin->result->droitsClients; $identity->nom = $InfosLogin->result->nom; $identity->prenom = $InfosLogin->result->prenom; $identity->tel = $InfosLogin->result->tel; $identity->fax = $InfosLogin->result->fax; $identity->mobile = $InfosLogin->result->mobile; $identity->id = $InfosLogin->result->id; $identity->idClient = $InfosLogin->result->idClient; $identity->reference = $InfosLogin->result->reference; $identity->nbReponses = $InfosLogin->result->nbReponses; $identity->typeScore = $InfosLogin->result->typeScore; $identity->timeout = (!empty($InfosLogin->result->timeout)) ? $InfosLogin->result->timeout : $this->_timeout; $identity->modeEdition = false; $logger = Zend_Registry::get('firebug'); $logger->log($identity, Zend_Log::DEBUG); if ($InfosLogin->error->errnum!=0){ return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, $identity); } elseif ($this->_username == $InfosLogin->result->login) { return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $identity); } else { return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_UNCATEGORIZED, $identity); } } }