2010-09-13 09:00:36 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class WebAuthAdapter implements Zend_Auth_Adapter_Interface
|
|
|
|
{
|
|
|
|
protected $_username;
|
|
|
|
protected $_password;
|
|
|
|
|
|
|
|
public function __construct($username,$password)
|
|
|
|
{
|
|
|
|
$this->_username = $username;
|
|
|
|
$this->_password = $password;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function authenticate()
|
|
|
|
{
|
|
|
|
//@todo faire une requête getInfosLogin
|
|
|
|
$usersPassword = array(
|
2010-09-27 07:24:42 +00:00
|
|
|
'mricois' => 'bj10sx',
|
|
|
|
'ylenaour' => 'bzh4231*',
|
|
|
|
'altisys' => 'fortest',
|
2010-10-18 13:35:36 +00:00
|
|
|
'oseo' => 'oseo',
|
2010-11-24 08:26:04 +00:00
|
|
|
'sbeaugrand' => 'Esoptron',
|
2010-09-13 09:00:36 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
//Login inexistant
|
|
|
|
if (!array_key_exists($this->_username, $usersPassword)) {
|
|
|
|
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND, $this->_username);
|
|
|
|
//Mot de pass incorrect
|
|
|
|
} elseif (array_key_exists($this->_username, $usersPassword) &&
|
|
|
|
$usersPassword[$this->_username] != $this->_password ) {
|
|
|
|
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, $this->_username);
|
|
|
|
//Ok tout est bon
|
|
|
|
} elseif (array_key_exists($this->_username, $usersPassword) &&
|
|
|
|
$usersPassword[$this->_username] == $this->_password ) {
|
|
|
|
return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $this->_username);
|
|
|
|
//...
|
|
|
|
} else {
|
|
|
|
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_UNCATEGORIZED, $this->_username);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|