Skip to content
Snippets Groups Projects
Commit 8aef1cb6 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

L'adapter d'authentification Db a été supprimé à tort, il est nécessaire car...

L'adapter d'authentification Db a été supprimé à tort, il est nécessaire car il empêche l'auth de planter si aucune table "user" n'existe.
parent 7f45653a
No related branches found
No related tags found
No related merge requests found
......@@ -53,7 +53,7 @@ $zfcuserSettings = array(
*/
'auth_adapters' => array(
300 => 'UnicaenAuth\Authentication\Adapter\Ldap', // notifié en 1er
200 => 'ZfcUser\Authentication\Adapter\Db', // ensuite (si échec d'authentification Ldap)
200 => 'UnicaenAuth\Authentication\Adapter\Db', // ensuite (si échec d'authentification Ldap)
100 => 'UnicaenAuth\Authentication\Adapter\Cas', // ensuite (si échec d'authentification Db)
),
);
......
<?php
namespace UnicaenAuth\Authentication\Adapter;
use PDOException;
use UnicaenAuth\Options\ModuleOptions;
use Zend\ServiceManager\ServiceManager;
use Zend\ServiceManager\ServiceManagerAwareInterface;
use ZfcUser\Authentication\Adapter\AdapterChainEvent as AuthEvent;
use ZfcUser\Options\AuthenticationOptionsInterface;
/**
* Db authentication adpater with sesame password check.
*
* @author Bertrand GAUTHIER <bertrand.gauthier@unicaen.fr>
*/
class Db extends \ZfcUser\Authentication\Adapter\Db implements ServiceManagerAwareInterface
{
/**
* @var ServiceManager
*/
protected $serviceManager;
/**
* Authentification.
*
* @param AuthEvent $e
* @return boolean
*/
public function authenticate(AuthEvent $e)
{
try {
$result = parent::authenticate($e);
}
catch (PDOException $e) {
return false;
}
return $result;
}
/**
* @param ModuleOptions $options
* @return self
*/
public function setOptions(AuthenticationOptionsInterface $options)
{
$this->options = $options;
return $this;
}
/**
* @return ModuleOptions
*/
public function getOptions()
{
if (!$this->options instanceof ModuleOptions) {
$this->setOptions($this->getServiceManager()->get('unicaen-auth_module_options'));
}
return $this->options;
}
/**
* Get service manager
*
* @return ServiceManager
*/
public function getServiceManager()
{
return $this->serviceManager;
}
/**
* Set service manager
*
* @param ServiceManager $serviceManager
* @return self
*/
public function setServiceManager(ServiceManager $serviceManager)
{
$this->serviceManager = $serviceManager;
return $this;
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment