Loading config/module.config.php +15 −14 Original line number Diff line number Diff line Loading @@ -149,22 +149,22 @@ return [ * You may omit the 'action' index to allow access to the entire controller */ 'BjyAuthorize\Guard\Controller' => [ ['controller' => 'index', 'action' => 'index', 'roles' => []], ['controller' => 'zfcuser', 'roles' => []], ['controller' => 'Application\Controller\Index', 'roles' => []], ['controller' => 'index', 'action' => 'index', 'roles' => 'guest'], ['controller' => 'zfcuser', 'roles' => 'guest'], ['controller' => 'Application\Controller\Index', 'roles' => 'guest'], ['controller' => 'UnicaenApp\Controller\Application', 'action' => 'etab', 'roles' => []], ['controller' => 'UnicaenApp\Controller\Application', 'action' => 'apropos', 'roles' => []], ['controller' => 'UnicaenApp\Controller\Application', 'action' => 'contact', 'roles' => []], ['controller' => 'UnicaenApp\Controller\Application', 'action' => 'plan', 'roles' => []], ['controller' => 'UnicaenApp\Controller\Application', 'action' => 'mentions-legales', 'roles' => []], ['controller' => 'UnicaenApp\Controller\Application', 'action' => 'informatique-et-libertes', 'roles' => []], ['controller' => 'UnicaenApp\Controller\Application', 'action' => 'refresh-session', 'roles' => []], ['controller' => 'UnicaenAuth\Controller\Utilisateur', 'action' => 'selectionner-profil', 'roles' => []], ['controller' => 'UnicaenApp\Controller\Application', 'action' => 'etab', 'roles' => 'guest'], ['controller' => 'UnicaenApp\Controller\Application', 'action' => 'apropos', 'roles' => 'guest'], ['controller' => 'UnicaenApp\Controller\Application', 'action' => 'contact', 'roles' => 'guest'], ['controller' => 'UnicaenApp\Controller\Application', 'action' => 'plan', 'roles' => 'guest'], ['controller' => 'UnicaenApp\Controller\Application', 'action' => 'mentions-legales', 'roles' => 'guest'], ['controller' => 'UnicaenApp\Controller\Application', 'action' => 'informatique-et-libertes', 'roles' => 'guest'], ['controller' => 'UnicaenApp\Controller\Application', 'action' => 'refresh-session', 'roles' => 'guest'], ['controller' => 'UnicaenAuth\Controller\Utilisateur', 'action' => 'selectionner-profil', 'roles' => 'guest'], ['controller' => 'UnicaenAuth\Controller\Auth', 'action' => 'shibboleth', 'roles' => []], ['controller' => 'UnicaenAuth\Controller\Auth', 'action' => 'requestPasswordReset', 'roles' => []], ['controller' => 'UnicaenAuth\Controller\Auth', 'action' => 'changePassword', 'roles' => []], ['controller' => 'UnicaenAuth\Controller\Auth', 'action' => 'shibboleth', 'roles' => 'guest'], ['controller' => 'UnicaenAuth\Controller\Auth', 'action' => 'requestPasswordReset', 'roles' => 'guest'], ['controller' => 'UnicaenAuth\Controller\Auth', 'action' => 'changePassword', 'roles' => 'guest'], ], ], ], Loading Loading @@ -427,6 +427,7 @@ return [ 'unicaen-auth_user_service' => 'UnicaenAuth\Service\User', // pour la compatibilité 'authUserContext' => 'UnicaenAuth\Service\UserContext', // pour la compatibilité 'AuthUserContext' => 'UnicaenAuth\Service\UserContext', // pour la compatibilité ], 'invokables' => [ 'UnicaenAuth\View\RedirectionStrategy' => 'UnicaenAuth\View\RedirectionStrategy', Loading src/UnicaenAuth/Authentication/Adapter/Cas.php +7 −4 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ use UnicaenAuth\Options\ModuleOptions; use UnicaenAuth\Service\User; use Zend\Authentication\Exception\UnexpectedValueException; use Zend\Authentication\Result as AuthenticationResult; use Zend\EventManager\Event; use Zend\EventManager\EventManager; use Zend\EventManager\EventManagerAwareInterface; use Zend\EventManager\EventManagerInterface; Loading Loading @@ -77,12 +78,14 @@ class Cas extends AbstractAdapter implements EventManagerAwareInterface /** * Réalise l'authentification. * * @param \Zend\EventManager\Event|AuthEvent $e * @param Event $e * @throws UnexpectedValueException * @see ChainableAdapter */ public function authenticate(\Zend\EventManager\Event $e) public function authenticate(Event $e) { $e = $e->getTarget(); // if ($e->getIdentity()) { // return; // } Loading Loading @@ -128,10 +131,10 @@ class Cas extends AbstractAdapter implements EventManagerAwareInterface /** * * @param AuthEvent $e * @param Event $e * @see ChainableAdapter */ public function logout(AuthEvent $e) public function logout(Event $e) { if (!$this->getOptions()->getCas()) { return; // NB: l'authentification CAS est désactivée ssi le tableau des options est vide Loading src/UnicaenAuth/Authentication/Adapter/Db.php +2 −2 Original line number Diff line number Diff line Loading @@ -45,14 +45,14 @@ class Db extends \ZfcUser\Authentication\Adapter\Db implements ServiceLocatorAwa */ public function authenticate(\Zend\EventManager\Event $e) { if ($e->getIdentity()) { if ($e->getTarget()->getIdentity()) { return; } try { $result = parent::authenticate($e); } catch (ServiceNotFoundException $e) { catch (ServiceNotFoundException $snfe) { return false; } Loading src/UnicaenAuth/Authentication/Adapter/Ldap.php +7 −5 Original line number Diff line number Diff line Loading @@ -14,7 +14,6 @@ use Zend\EventManager\EventManager; use Zend\EventManager\EventManagerAwareInterface; use Zend\EventManager\EventManagerInterface; use ZfcUser\Authentication\Adapter\AbstractAdapter; use ZfcUser\Authentication\Adapter\AdapterChainEvent as AuthEvent; use ZfcUser\Authentication\Adapter\ChainableAdapter; /** Loading Loading @@ -79,14 +78,16 @@ class Ldap extends AbstractAdapter implements EventManagerAwareInterface /** * * @param AuthEvent|\Zend\EventManager\Event $e * @param Event $e * @return boolean * @throws \Zend\Authentication\Adapter\Exception\ExceptionInterface * @throws \Zend\Ldap\Exception\LdapException * @see ChainableAdapter */ public function authenticate(\Zend\EventManager\Event $e) public function authenticate(Event $e) { $e = $e->getTarget(); if ($this->isSatisfied()) { try { $storage = $this->getStorage()->read(); Loading Loading @@ -197,10 +198,11 @@ class Ldap extends AbstractAdapter implements EventManagerAwareInterface // Obtenir le message LDAP // $msg = preg_replace('/\[0x\d* \((.*)\):/','$1', $event->getParam('result')->getMessages()[1]); $eventClasse = new Event('authentication.ldap.error'); $eventClasse->setTarget($this)->setParams([ $eventClasse->setTarget($this); $eventClasse->setParams([ 'result' => $result ]); $this->getEventManager()->trigger($eventClasse); $this->getEventManager()->triggerEvent($eventClasse); } $success = $result->isValid(); Loading src/UnicaenAuth/Authentication/Storage/Chain.php +6 −3 Original line number Diff line number Diff line Loading @@ -69,7 +69,8 @@ class Chain implements StorageInterface, EventManagerAwareInterface } $e = $this->getEvent(); $this->getEventManager()->trigger('read', $e); $e->setName('read'); $this->getEventManager()->triggerEvent($e); $identity = $e->getContents(); Loading @@ -95,8 +96,9 @@ class Chain implements StorageInterface, EventManagerAwareInterface $this->getStorage()->write($contents); $e = $this->getEvent(); $e->setName('write'); $e->setParams(compact('contents')); $this->getEventManager()->trigger('write', $e); $this->getEventManager()->triggerEvent($e); } /** Loading @@ -110,7 +112,8 @@ class Chain implements StorageInterface, EventManagerAwareInterface $this->getStorage()->clear(); $e = $this->getEvent(); $this->getEventManager()->trigger('clear', $e); $e->setName('clear'); $this->getEventManager()->triggerEvent($e); } /** Loading Loading
config/module.config.php +15 −14 Original line number Diff line number Diff line Loading @@ -149,22 +149,22 @@ return [ * You may omit the 'action' index to allow access to the entire controller */ 'BjyAuthorize\Guard\Controller' => [ ['controller' => 'index', 'action' => 'index', 'roles' => []], ['controller' => 'zfcuser', 'roles' => []], ['controller' => 'Application\Controller\Index', 'roles' => []], ['controller' => 'index', 'action' => 'index', 'roles' => 'guest'], ['controller' => 'zfcuser', 'roles' => 'guest'], ['controller' => 'Application\Controller\Index', 'roles' => 'guest'], ['controller' => 'UnicaenApp\Controller\Application', 'action' => 'etab', 'roles' => []], ['controller' => 'UnicaenApp\Controller\Application', 'action' => 'apropos', 'roles' => []], ['controller' => 'UnicaenApp\Controller\Application', 'action' => 'contact', 'roles' => []], ['controller' => 'UnicaenApp\Controller\Application', 'action' => 'plan', 'roles' => []], ['controller' => 'UnicaenApp\Controller\Application', 'action' => 'mentions-legales', 'roles' => []], ['controller' => 'UnicaenApp\Controller\Application', 'action' => 'informatique-et-libertes', 'roles' => []], ['controller' => 'UnicaenApp\Controller\Application', 'action' => 'refresh-session', 'roles' => []], ['controller' => 'UnicaenAuth\Controller\Utilisateur', 'action' => 'selectionner-profil', 'roles' => []], ['controller' => 'UnicaenApp\Controller\Application', 'action' => 'etab', 'roles' => 'guest'], ['controller' => 'UnicaenApp\Controller\Application', 'action' => 'apropos', 'roles' => 'guest'], ['controller' => 'UnicaenApp\Controller\Application', 'action' => 'contact', 'roles' => 'guest'], ['controller' => 'UnicaenApp\Controller\Application', 'action' => 'plan', 'roles' => 'guest'], ['controller' => 'UnicaenApp\Controller\Application', 'action' => 'mentions-legales', 'roles' => 'guest'], ['controller' => 'UnicaenApp\Controller\Application', 'action' => 'informatique-et-libertes', 'roles' => 'guest'], ['controller' => 'UnicaenApp\Controller\Application', 'action' => 'refresh-session', 'roles' => 'guest'], ['controller' => 'UnicaenAuth\Controller\Utilisateur', 'action' => 'selectionner-profil', 'roles' => 'guest'], ['controller' => 'UnicaenAuth\Controller\Auth', 'action' => 'shibboleth', 'roles' => []], ['controller' => 'UnicaenAuth\Controller\Auth', 'action' => 'requestPasswordReset', 'roles' => []], ['controller' => 'UnicaenAuth\Controller\Auth', 'action' => 'changePassword', 'roles' => []], ['controller' => 'UnicaenAuth\Controller\Auth', 'action' => 'shibboleth', 'roles' => 'guest'], ['controller' => 'UnicaenAuth\Controller\Auth', 'action' => 'requestPasswordReset', 'roles' => 'guest'], ['controller' => 'UnicaenAuth\Controller\Auth', 'action' => 'changePassword', 'roles' => 'guest'], ], ], ], Loading Loading @@ -427,6 +427,7 @@ return [ 'unicaen-auth_user_service' => 'UnicaenAuth\Service\User', // pour la compatibilité 'authUserContext' => 'UnicaenAuth\Service\UserContext', // pour la compatibilité 'AuthUserContext' => 'UnicaenAuth\Service\UserContext', // pour la compatibilité ], 'invokables' => [ 'UnicaenAuth\View\RedirectionStrategy' => 'UnicaenAuth\View\RedirectionStrategy', Loading
src/UnicaenAuth/Authentication/Adapter/Cas.php +7 −4 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ use UnicaenAuth\Options\ModuleOptions; use UnicaenAuth\Service\User; use Zend\Authentication\Exception\UnexpectedValueException; use Zend\Authentication\Result as AuthenticationResult; use Zend\EventManager\Event; use Zend\EventManager\EventManager; use Zend\EventManager\EventManagerAwareInterface; use Zend\EventManager\EventManagerInterface; Loading Loading @@ -77,12 +78,14 @@ class Cas extends AbstractAdapter implements EventManagerAwareInterface /** * Réalise l'authentification. * * @param \Zend\EventManager\Event|AuthEvent $e * @param Event $e * @throws UnexpectedValueException * @see ChainableAdapter */ public function authenticate(\Zend\EventManager\Event $e) public function authenticate(Event $e) { $e = $e->getTarget(); // if ($e->getIdentity()) { // return; // } Loading Loading @@ -128,10 +131,10 @@ class Cas extends AbstractAdapter implements EventManagerAwareInterface /** * * @param AuthEvent $e * @param Event $e * @see ChainableAdapter */ public function logout(AuthEvent $e) public function logout(Event $e) { if (!$this->getOptions()->getCas()) { return; // NB: l'authentification CAS est désactivée ssi le tableau des options est vide Loading
src/UnicaenAuth/Authentication/Adapter/Db.php +2 −2 Original line number Diff line number Diff line Loading @@ -45,14 +45,14 @@ class Db extends \ZfcUser\Authentication\Adapter\Db implements ServiceLocatorAwa */ public function authenticate(\Zend\EventManager\Event $e) { if ($e->getIdentity()) { if ($e->getTarget()->getIdentity()) { return; } try { $result = parent::authenticate($e); } catch (ServiceNotFoundException $e) { catch (ServiceNotFoundException $snfe) { return false; } Loading
src/UnicaenAuth/Authentication/Adapter/Ldap.php +7 −5 Original line number Diff line number Diff line Loading @@ -14,7 +14,6 @@ use Zend\EventManager\EventManager; use Zend\EventManager\EventManagerAwareInterface; use Zend\EventManager\EventManagerInterface; use ZfcUser\Authentication\Adapter\AbstractAdapter; use ZfcUser\Authentication\Adapter\AdapterChainEvent as AuthEvent; use ZfcUser\Authentication\Adapter\ChainableAdapter; /** Loading Loading @@ -79,14 +78,16 @@ class Ldap extends AbstractAdapter implements EventManagerAwareInterface /** * * @param AuthEvent|\Zend\EventManager\Event $e * @param Event $e * @return boolean * @throws \Zend\Authentication\Adapter\Exception\ExceptionInterface * @throws \Zend\Ldap\Exception\LdapException * @see ChainableAdapter */ public function authenticate(\Zend\EventManager\Event $e) public function authenticate(Event $e) { $e = $e->getTarget(); if ($this->isSatisfied()) { try { $storage = $this->getStorage()->read(); Loading Loading @@ -197,10 +198,11 @@ class Ldap extends AbstractAdapter implements EventManagerAwareInterface // Obtenir le message LDAP // $msg = preg_replace('/\[0x\d* \((.*)\):/','$1', $event->getParam('result')->getMessages()[1]); $eventClasse = new Event('authentication.ldap.error'); $eventClasse->setTarget($this)->setParams([ $eventClasse->setTarget($this); $eventClasse->setParams([ 'result' => $result ]); $this->getEventManager()->trigger($eventClasse); $this->getEventManager()->triggerEvent($eventClasse); } $success = $result->isValid(); Loading
src/UnicaenAuth/Authentication/Storage/Chain.php +6 −3 Original line number Diff line number Diff line Loading @@ -69,7 +69,8 @@ class Chain implements StorageInterface, EventManagerAwareInterface } $e = $this->getEvent(); $this->getEventManager()->trigger('read', $e); $e->setName('read'); $this->getEventManager()->triggerEvent($e); $identity = $e->getContents(); Loading @@ -95,8 +96,9 @@ class Chain implements StorageInterface, EventManagerAwareInterface $this->getStorage()->write($contents); $e = $this->getEvent(); $e->setName('write'); $e->setParams(compact('contents')); $this->getEventManager()->trigger('write', $e); $this->getEventManager()->triggerEvent($e); } /** Loading @@ -110,7 +112,8 @@ class Chain implements StorageInterface, EventManagerAwareInterface $this->getStorage()->clear(); $e = $this->getEvent(); $this->getEventManager()->trigger('clear', $e); $e->setName('clear'); $this->getEventManager()->triggerEvent($e); } /** Loading