Commit 85d1e8a6 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Corrections nécessaires pour utiliser zf-commons/zfc-user ^3.0 (qui en fait...

Corrections nécessaires pour utiliser zf-commons/zfc-user ^3.0 (qui en fait diffère de la branche 3.x)
parent 12a32560
Pipeline #4009 passed with stage
in 20 seconds
...@@ -9,12 +9,12 @@ use UnicaenAuth\Service\User; ...@@ -9,12 +9,12 @@ use UnicaenAuth\Service\User;
use Zend\Authentication\Exception\UnexpectedValueException; use Zend\Authentication\Exception\UnexpectedValueException;
use Zend\Authentication\Result as AuthenticationResult; use Zend\Authentication\Result as AuthenticationResult;
use Zend\EventManager\Event; use Zend\EventManager\Event;
use Zend\EventManager\EventInterface;
use Zend\EventManager\EventManager; use Zend\EventManager\EventManager;
use Zend\EventManager\EventManagerAwareInterface; use Zend\EventManager\EventManagerAwareInterface;
use Zend\EventManager\EventManagerInterface; use Zend\EventManager\EventManagerInterface;
use Zend\Router\Http\TreeRouteStack; use Zend\Router\Http\TreeRouteStack;
use ZfcUser\Authentication\Adapter\AbstractAdapter; use ZfcUser\Authentication\Adapter\AbstractAdapter;
use ZfcUser\Authentication\Adapter\AdapterChainEvent;
use ZfcUser\Authentication\Adapter\ChainableAdapter; use ZfcUser\Authentication\Adapter\ChainableAdapter;
/** /**
...@@ -78,12 +78,17 @@ class Cas extends AbstractAdapter implements EventManagerAwareInterface ...@@ -78,12 +78,17 @@ class Cas extends AbstractAdapter implements EventManagerAwareInterface
/** /**
* Réalise l'authentification. * Réalise l'authentification.
* *
* @param AdapterChainEvent $e * @param EventInterface $e
* @throws UnexpectedValueException * @throws UnexpectedValueException
* @see ChainableAdapter * @see ChainableAdapter
*/ */
public function authenticate(AdapterChainEvent $e) public function authenticate(EventInterface $e)
{ {
// NB: Dans la version 3.0.0 de zf-commons/zfc-user, cette méthode prend un EventInterface.
// Mais dans la branche 3.x, c'est un AdapterChainEvent !
// Si un jour c'est un AdapterChainEvent qui est attendu, plus besoin de faire $e->getTarget().
$e = $e->getTarget();
// if ($e->getIdentity()) { // if ($e->getIdentity()) {
// return; // return;
// } // }
......
...@@ -6,8 +6,8 @@ use Interop\Container\ContainerInterface; ...@@ -6,8 +6,8 @@ use Interop\Container\ContainerInterface;
use UnicaenApp\ServiceManager\ServiceLocatorAwareInterface; use UnicaenApp\ServiceManager\ServiceLocatorAwareInterface;
use UnicaenApp\ServiceManager\ServiceLocatorAwareTrait; use UnicaenApp\ServiceManager\ServiceLocatorAwareTrait;
use UnicaenAuth\Options\ModuleOptions; use UnicaenAuth\Options\ModuleOptions;
use Zend\EventManager\EventInterface;
use Zend\ServiceManager\Exception\ServiceNotFoundException; use Zend\ServiceManager\Exception\ServiceNotFoundException;
use ZfcUser\Authentication\Adapter\AdapterChainEvent;
/** /**
* Adpater d'authentification à partir de la base de données. * Adpater d'authentification à partir de la base de données.
...@@ -39,12 +39,15 @@ class Db extends \ZfcUser\Authentication\Adapter\Db implements ServiceLocatorAwa ...@@ -39,12 +39,15 @@ class Db extends \ZfcUser\Authentication\Adapter\Db implements ServiceLocatorAwa
/** /**
* Authentification. * Authentification.
* *
* @param AdapterChainEvent $e * @param EventInterface $e
* @return boolean * @return boolean
*/ */
public function authenticate(AdapterChainEvent $e) public function authenticate(EventInterface $e)
{ {
if ($e->getIdentity()) { // NB: Dans la version 3.0.0 de zf-commons/zfc-user, cette méthode prend un EventInterface.
// Mais dans la branche 3.x, c'est un AdapterChainEvent !
// Si un jour c'est un AdapterChainEvent qui est attendu, plus besoin de faire $e->getTarget().
if ($e->getTarget()->getIdentity()) {
return true; return true;
} }
......
...@@ -10,11 +10,11 @@ use Zend\Authentication\Adapter\Ldap as LdapAuthAdapter; ...@@ -10,11 +10,11 @@ use Zend\Authentication\Adapter\Ldap as LdapAuthAdapter;
use Zend\Authentication\Exception\ExceptionInterface; use Zend\Authentication\Exception\ExceptionInterface;
use Zend\Authentication\Result as AuthenticationResult; use Zend\Authentication\Result as AuthenticationResult;
use Zend\EventManager\Event; use Zend\EventManager\Event;
use Zend\EventManager\EventInterface;
use Zend\EventManager\EventManager; use Zend\EventManager\EventManager;
use Zend\EventManager\EventManagerAwareInterface; use Zend\EventManager\EventManagerAwareInterface;
use Zend\EventManager\EventManagerInterface; use Zend\EventManager\EventManagerInterface;
use ZfcUser\Authentication\Adapter\AbstractAdapter; use ZfcUser\Authentication\Adapter\AbstractAdapter;
use ZfcUser\Authentication\Adapter\AdapterChainEvent;
use ZfcUser\Authentication\Adapter\ChainableAdapter; use ZfcUser\Authentication\Adapter\ChainableAdapter;
/** /**
...@@ -79,14 +79,19 @@ class Ldap extends AbstractAdapter implements EventManagerAwareInterface ...@@ -79,14 +79,19 @@ class Ldap extends AbstractAdapter implements EventManagerAwareInterface
/** /**
* *
* @param AdapterChainEvent $e * @param EventInterface $e
* @return boolean * @return boolean
* @throws \Zend\Authentication\Adapter\Exception\ExceptionInterface * @throws \Zend\Authentication\Adapter\Exception\ExceptionInterface
* @throws \Zend\Ldap\Exception\LdapException * @throws \Zend\Ldap\Exception\LdapException
* @see ChainableAdapter * @see ChainableAdapter
*/ */
public function authenticate(AdapterChainEvent $e) public function authenticate(EventInterface $e)
{ {
// NB: Dans la version 3.0.0 de zf-commons/zfc-user, cette méthode prend un EventInterface.
// Mais dans la branche 3.x, c'est un AdapterChainEvent !
// Si un jour c'est un AdapterChainEvent qui est attendu, plus besoin de faire $e->getTarget().
$e = $e->getTarget();
if ($this->isSatisfied()) { if ($this->isSatisfied()) {
try { try {
$storage = $this->getStorage()->read(); $storage = $this->getStorage()->read();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment