Commit bcd2532e authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Merge branch 'zf-3.x' of https://git.unicaen.fr/lib/unicaen/auth into zf-3.x

parents cb8b152d 853ef257
Pipeline #4021 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 as AuthEvent;
use ZfcUser\Authentication\Adapter\ChainableAdapter; use ZfcUser\Authentication\Adapter\ChainableAdapter;
/** /**
...@@ -78,12 +78,15 @@ class Cas extends AbstractAdapter implements EventManagerAwareInterface ...@@ -78,12 +78,15 @@ class Cas extends AbstractAdapter implements EventManagerAwareInterface
/** /**
* Réalise l'authentification. * Réalise l'authentification.
* *
* @param Event $e * @param EventInterface $e
* @throws UnexpectedValueException * @throws UnexpectedValueException
* @see ChainableAdapter * @see ChainableAdapter
*/ */
public function authenticate(Event $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(); $e = $e->getTarget();
// if ($e->getIdentity()) { // if ($e->getIdentity()) {
......
...@@ -6,9 +6,8 @@ use Interop\Container\ContainerInterface; ...@@ -6,9 +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 as AuthEvent;
use ZfcUser\Options\AuthenticationOptionsInterface;
/** /**
* Adpater d'authentification à partir de la base de données. * Adpater d'authentification à partir de la base de données.
...@@ -40,13 +39,16 @@ class Db extends \ZfcUser\Authentication\Adapter\Db implements ServiceLocatorAwa ...@@ -40,13 +39,16 @@ class Db extends \ZfcUser\Authentication\Adapter\Db implements ServiceLocatorAwa
/** /**
* Authentification. * Authentification.
* *
* @param AuthEvent|\Zend\EventManager\Event $e * @param EventInterface $e
* @return boolean * @return boolean
*/ */
public function authenticate(\Zend\EventManager\Event $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().
if ($e->getTarget()->getIdentity()) { if ($e->getTarget()->getIdentity()) {
return; return true;
} }
try { try {
...@@ -60,10 +62,10 @@ class Db extends \ZfcUser\Authentication\Adapter\Db implements ServiceLocatorAwa ...@@ -60,10 +62,10 @@ class Db extends \ZfcUser\Authentication\Adapter\Db implements ServiceLocatorAwa
} }
/** /**
* @param AuthenticationOptionsInterface $options * @param \ZfcUser\Options\ModuleOptions $options
* @return self * @return self
*/ */
public function setOptions(AuthenticationOptionsInterface $options) public function setOptions(\ZfcUser\Options\ModuleOptions $options)
{ {
$this->options = $options; $this->options = $options;
return $this; return $this;
......
...@@ -10,6 +10,7 @@ use Zend\Authentication\Adapter\Ldap as LdapAuthAdapter; ...@@ -10,6 +10,7 @@ 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;
...@@ -78,14 +79,17 @@ class Ldap extends AbstractAdapter implements EventManagerAwareInterface ...@@ -78,14 +79,17 @@ class Ldap extends AbstractAdapter implements EventManagerAwareInterface
/** /**
* *
* @param Event $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(Event $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(); $e = $e->getTarget();
if ($this->isSatisfied()) { if ($this->isSatisfied()) {
......
...@@ -2,27 +2,27 @@ ...@@ -2,27 +2,27 @@
namespace UnicaenAuth\Controller; namespace UnicaenAuth\Controller;
use Interop\Container\ContainerInterface;
use UnicaenAuth\Service\ShibService; use UnicaenAuth\Service\ShibService;
use UnicaenAuth\Service\User as UserService; use UnicaenAuth\Service\User as UserService;
use Zend\Authentication\AuthenticationService; use Zend\Authentication\AuthenticationService;
use Zend\Mvc\Controller\ControllerManager;
class AuthControllerFactory class AuthControllerFactory
{ {
/** /**
* @param ControllerManager $cm * @param ContainerInterface $container
* @return AuthController * @return AuthController
*/ */
public function __invoke(ControllerManager $cm) public function __invoke(ContainerInterface $container)
{ {
/** @var ShibService $shibService */ /** @var ShibService $shibService */
$shibService = $cm->get(ShibService::class); $shibService = $container->get(ShibService::class);
/* @var $userService UserService */ /* @var $userService UserService */
$userService = $cm->get('unicaen-auth_user_service'); $userService = $container->get('unicaen-auth_user_service');
/** @var AuthenticationService $authService */ /** @var AuthenticationService $authService */
$authService = $cm->get('zfcuser_auth_service'); $authService = $container->get('zfcuser_auth_service');
$controller = new AuthController(); $controller = new AuthController();
$controller->setShibService($shibService); $controller->setShibService($shibService);
......
...@@ -2,25 +2,25 @@ ...@@ -2,25 +2,25 @@
namespace UnicaenAuth\Controller; namespace UnicaenAuth\Controller;
use Interop\Container\ContainerInterface;
use UnicaenAuth\Form\Droits\RoleForm; use UnicaenAuth\Form\Droits\RoleForm;
use UnicaenAuth\Service\PrivilegeService; use UnicaenAuth\Service\PrivilegeService;
use UnicaenAuth\Service\RoleService; use UnicaenAuth\Service\RoleService;
use Zend\Mvc\Controller\ControllerManager;
class DroitsControllerFactory class DroitsControllerFactory
{ {
/** /**
* @param ControllerManager $cm * @param ContainerInterface $container
* @return DroitsController * @return DroitsController
*/ */
public function __invoke(ControllerManager $cm) public function __invoke(ContainerInterface $container)
{ {
/** @var RoleService $serviceRole */ /** @var RoleService $serviceRole */
$serviceRole = $cm->get('UnicaenAuth\Service\Role'); $serviceRole = $container->get('UnicaenAuth\Service\Role');
/** @var RoleForm $formDroitsRole */ /** @var RoleForm $formDroitsRole */
$formDroitsRole = $cm->get('FormElementManager')->get('UnicaenAuth\Form\Droits\Role'); $formDroitsRole = $container->get('FormElementManager')->get('UnicaenAuth\Form\Droits\Role');
/** @var PrivilegeService $servicePrivilege */ /** @var PrivilegeService $servicePrivilege */
$servicePrivilege = $cm->get('UnicaenAuth\Service\Privilege'); $servicePrivilege = $container->get('UnicaenAuth\Service\Privilege');
$controller = new DroitsController(); $controller = new DroitsController();
$controller->setServiceRole($serviceRole); $controller->setServiceRole($serviceRole);
......
...@@ -2,39 +2,39 @@ ...@@ -2,39 +2,39 @@
namespace UnicaenAuth\Controller; namespace UnicaenAuth\Controller;
use Interop\Container\ContainerInterface;
use UnicaenApp\Mapper\Ldap\People as LdapPeopleMapper; use UnicaenApp\Mapper\Ldap\People as LdapPeopleMapper;
use UnicaenAuth\Options\ModuleOptions; use UnicaenAuth\Options\ModuleOptions;
use UnicaenAuth\Service\ShibService; use UnicaenAuth\Service\ShibService;
use UnicaenAuth\Service\UserContext; use UnicaenAuth\Service\UserContext;
use Zend\Authentication\AuthenticationService; use Zend\Authentication\AuthenticationService;
use Zend\Mvc\Controller\ControllerManager;
use ZfcUser\Mapper\UserInterface as UserMapper; use ZfcUser\Mapper\UserInterface as UserMapper;
class UtilisateurControllerFactory class UtilisateurControllerFactory
{ {
/** /**
* @param ControllerManager $cm * @param ContainerInterface $container
* @return UtilisateurController * @return UtilisateurController
*/ */
public function __invoke(ControllerManager $cm) public function __invoke(ContainerInterface $container)
{ {
/** @var UserMapper $mapper */ /** @var UserMapper $mapper */
$userMapper = $cm->get('zfcuser_user_mapper'); $userMapper = $container->get('zfcuser_user_mapper');
/** @var AuthenticationService $authenticationService */ /** @var AuthenticationService $authenticationService */
$authenticationService = $cm->get(AuthenticationService::class); $authenticationService = $container->get(AuthenticationService::class);
/** @var ModuleOptions $options */ /** @var ModuleOptions $options */
$options = $cm->get('unicaen-auth_module_options'); $options = $container->get('unicaen-auth_module_options');
/** @var ShibService $shibService */ /** @var ShibService $shibService */
$shibService = $cm->get(ShibService::class); $shibService = $container->get(ShibService::class);
/** @var UserContext $userContextService */ /** @var UserContext $userContextService */
$userContextService = $cm->get('AuthUserContext'); $userContextService = $container->get('AuthUserContext');
/** @var LdapPeopleMapper $mapper */ /** @var LdapPeopleMapper $mapper */
$ldapPeopleMapper = $cm->get('ldap_people_mapper'); $ldapPeopleMapper = $container->get('ldap_people_mapper');
$controller = new UtilisateurController(); $controller = new UtilisateurController();
$controller->setLdapPeopleMapper($ldapPeopleMapper); $controller->setLdapPeopleMapper($ldapPeopleMapper);
......
Supports Markdown
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