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
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -9,12 +9,12 @@ use UnicaenAuth\Service\User;
use Zend\Authentication\Exception\UnexpectedValueException;
use Zend\Authentication\Result as AuthenticationResult;
use Zend\EventManager\Event;
use Zend\EventManager\EventInterface;
use Zend\EventManager\EventManager;
use Zend\EventManager\EventManagerAwareInterface;
use Zend\EventManager\EventManagerInterface;
use Zend\Router\Http\TreeRouteStack;
use ZfcUser\Authentication\Adapter\AbstractAdapter;
use ZfcUser\Authentication\Adapter\AdapterChainEvent;
use ZfcUser\Authentication\Adapter\ChainableAdapter;

/**
@@ -78,12 +78,17 @@ class Cas extends AbstractAdapter implements EventManagerAwareInterface
    /**
     * Réalise l'authentification.
     *
     * @param AdapterChainEvent $e
     * @param EventInterface $e
     * @throws UnexpectedValueException
     * @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()) {
//            return;
//        }
+7 −4
Original line number Diff line number Diff line
@@ -6,8 +6,8 @@ use Interop\Container\ContainerInterface;
use UnicaenApp\ServiceManager\ServiceLocatorAwareInterface;
use UnicaenApp\ServiceManager\ServiceLocatorAwareTrait;
use UnicaenAuth\Options\ModuleOptions;
use Zend\EventManager\EventInterface;
use Zend\ServiceManager\Exception\ServiceNotFoundException;
use ZfcUser\Authentication\Adapter\AdapterChainEvent;

/**
 * Adpater d'authentification à partir de la base de données.
@@ -39,12 +39,15 @@ class Db extends \ZfcUser\Authentication\Adapter\Db implements ServiceLocatorAwa
    /**
     * Authentification.
     *
     * @param AdapterChainEvent $e
     * @param EventInterface $e
     * @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;
        }
        
+8 −3
Original line number Diff line number Diff line
@@ -10,11 +10,11 @@ use Zend\Authentication\Adapter\Ldap as LdapAuthAdapter;
use Zend\Authentication\Exception\ExceptionInterface;
use Zend\Authentication\Result as AuthenticationResult;
use Zend\EventManager\Event;
use Zend\EventManager\EventInterface;
use Zend\EventManager\EventManager;
use Zend\EventManager\EventManagerAwareInterface;
use Zend\EventManager\EventManagerInterface;
use ZfcUser\Authentication\Adapter\AbstractAdapter;
use ZfcUser\Authentication\Adapter\AdapterChainEvent;
use ZfcUser\Authentication\Adapter\ChainableAdapter;

/**
@@ -79,14 +79,19 @@ class Ldap extends AbstractAdapter implements EventManagerAwareInterface

    /**
     *
     * @param AdapterChainEvent $e
     * @param EventInterface $e
     * @return boolean
     * @throws \Zend\Authentication\Adapter\Exception\ExceptionInterface
     * @throws \Zend\Ldap\Exception\LdapException
     * @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()) {
            try {
                $storage = $this->getStorage()->read();