diff --git a/Module.php b/Module.php
index d0b7d49a6bd26a951c5c9edfbdd47be731633042..66d741736b3ebcd1bb55315688b74d98a08f9cf4 100644
--- a/Module.php
+++ b/Module.php
@@ -90,7 +90,7 @@ class Module implements AutoloaderProviderInterface, ConfigProviderInterface, Se
      */
     private function reconfigureRoutesForAuth(ServiceLocatorInterface $sl)
     {
-        /* @var $router \Zend\Mvc\Router\Http\TreeRouteStack */
+        /* @var $router \Zend\Router\Http\TreeRouteStack */
         $router = $sl->get('router');
 
         // si l'auth CAS est activée, modif de la route de connexion pour zapper le formulaire d'auth maison.
diff --git a/src/UnicaenAuth/Assertion/AbstractAssertion.php b/src/UnicaenAuth/Assertion/AbstractAssertion.php
index 5fa454f64bdd9f3082397ae60e2df1356ee8055b..cd2eb9d23fd8e3c8b5e433ce1186784d13a3e3d9 100644
--- a/src/UnicaenAuth/Assertion/AbstractAssertion.php
+++ b/src/UnicaenAuth/Assertion/AbstractAssertion.php
@@ -5,7 +5,7 @@ namespace UnicaenAuth\Assertion;
 use BjyAuthorize\Service\Authorize;
 use UnicaenAuth\Service\Traits\UserContextServiceAwareTrait;
 use Zend\Mvc\Application;
-use Zend\Mvc\Controller\Plugin\FlashMessenger;
+use Zend\Mvc\Plugin\FlashMessenger\FlashMessenger;
 use Zend\Mvc\MvcEvent;
 use Zend\Permissions\Acl\Acl;
 use Zend\Permissions\Acl\Assertion\AssertionInterface;
diff --git a/src/UnicaenAuth/Authentication/Adapter/AbstractFactory.php b/src/UnicaenAuth/Authentication/Adapter/AbstractFactory.php
index d5ce3734895e54b34a65aa6f602008f194ccd5df..c028f574b12f8eb0744e2ba464517ede89dc2b5a 100644
--- a/src/UnicaenAuth/Authentication/Adapter/AbstractFactory.php
+++ b/src/UnicaenAuth/Authentication/Adapter/AbstractFactory.php
@@ -2,6 +2,7 @@
 
 namespace UnicaenAuth\Authentication\Adapter;
 
+use Interop\Container\ContainerInterface;
 use UnicaenApp\Exception\LogicException;
 use Zend\EventManager\EventManager;
 use Zend\EventManager\EventManagerAwareInterface;
@@ -15,28 +16,22 @@ use Zend\ServiceManager\ServiceLocatorInterface;
  */
 class AbstractFactory implements AbstractFactoryInterface
 {
-    /**
-     * Determine if we can create a service with name
-     *
-     * @param ServiceLocatorInterface $serviceLocator
-     * @param $name
-     * @param $requestedName
-     * @return bool
-     */
     public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
     {
-        return strpos($requestedName, __NAMESPACE__) === 0 && class_exists($requestedName);
+        return $this->canCreate($serviceLocator, $requestedName);
     }
 
-    /**
-     * Create service with name
-     *
-     * @param ServiceLocatorInterface $serviceLocator
-     * @param $name
-     * @param $requestedName
-     * @return \ZfcUser\Authentication\Adapter\AbstractAdapter
-     */
     public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
+    {
+        return $this->__invoke($serviceLocator, $requestedName);
+    }
+
+    public function canCreate(ContainerInterface $container, $requestedName)
+    {
+        return strpos($requestedName, __NAMESPACE__) === 0 && class_exists($requestedName);
+    }
+
+    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
     {
         switch ($requestedName) {
             case __NAMESPACE__ . '\Ldap':
@@ -61,9 +56,9 @@ class AbstractFactory implements AbstractFactoryInterface
 
         if ($adapter instanceof EventManagerAwareInterface) {
             /** @var EventManager $eventManager */
-            $eventManager = $serviceLocator->get('event_manager');
+            $eventManager = $container->get('event_manager');
             $adapter->setEventManager($eventManager);
-            $userService = $serviceLocator->get('unicaen-auth_user_service'); /* @var $userService \UnicaenAuth\Service\User */
+            $userService = $container->get('unicaen-auth_user_service'); /* @var $userService \UnicaenAuth\Service\User */
             $eventManager->attach('userAuthenticated', [$userService, 'userAuthenticated'], 100);
         }
 
diff --git a/src/UnicaenAuth/Authentication/Adapter/Cas.php b/src/UnicaenAuth/Authentication/Adapter/Cas.php
index d1a68de53418b8b1cfa0f4cd148a5447d338a892..c73494908927b696b331977739b005843f92f432 100644
--- a/src/UnicaenAuth/Authentication/Adapter/Cas.php
+++ b/src/UnicaenAuth/Authentication/Adapter/Cas.php
@@ -12,7 +12,7 @@ use Zend\Authentication\Result as AuthenticationResult;
 use Zend\EventManager\EventManager;
 use Zend\EventManager\EventManagerAwareInterface;
 use Zend\EventManager\EventManagerInterface;
-use Zend\Mvc\Router\Http\TreeRouteStack;
+use Zend\Router\Http\TreeRouteStack;
 use Zend\ServiceManager\ServiceLocatorAwareTrait;
 use ZfcUser\Authentication\Adapter\AbstractAdapter;
 use ZfcUser\Authentication\Adapter\AdapterChainEvent as AuthEvent;
diff --git a/src/UnicaenAuth/Authentication/AuthenticationServiceFactory.php b/src/UnicaenAuth/Authentication/AuthenticationServiceFactory.php
index a4e448cc6086db7a692a2a2b9819766970f2c0cd..a7d905750a6a6558e7e40fdd94b4a1de5a396a7f 100644
--- a/src/UnicaenAuth/Authentication/AuthenticationServiceFactory.php
+++ b/src/UnicaenAuth/Authentication/AuthenticationServiceFactory.php
@@ -2,9 +2,10 @@
 
 namespace UnicaenAuth\Authentication;
 
+use Interop\Container\ContainerInterface;
+use Zend\Authentication\AuthenticationService;
 use Zend\ServiceManager\FactoryInterface;
 use Zend\ServiceManager\ServiceLocatorInterface;
-use Zend\Authentication\AuthenticationService;
 
 /**
  * Description of AuthenticationServiceFactory
@@ -13,17 +14,16 @@ use Zend\Authentication\AuthenticationService;
  */
 class AuthenticationServiceFactory implements FactoryInterface
 {
-    /**
-     * Create service
-     *
-     * @param ServiceLocatorInterface $serviceLocator
-     * @return AuthenticationService
-     */
     public function createService(ServiceLocatorInterface $serviceLocator)
+    {
+        return $this->__invoke($serviceLocator, '?');
+    }
+
+    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
     {
         return new AuthenticationService(
-            $serviceLocator->get('UnicaenAuth\Authentication\Storage\Chain'),
-            $serviceLocator->get('ZfcUser\Authentication\Adapter\AdapterChain')
+            $container->get('UnicaenAuth\Authentication\Storage\Chain'),
+            $container->get('ZfcUser\Authentication\Adapter\AdapterChain')
         );
     }
 }
\ No newline at end of file
diff --git a/src/UnicaenAuth/Authentication/RedirectCallback.php b/src/UnicaenAuth/Authentication/RedirectCallback.php
index a31bb379884b6e74dae8e73326e5f8c871126fdf..c0c48f9518bd5efe774727e89e33aaa3a7e8c2c0 100644
--- a/src/UnicaenAuth/Authentication/RedirectCallback.php
+++ b/src/UnicaenAuth/Authentication/RedirectCallback.php
@@ -5,8 +5,8 @@ namespace UnicaenAuth\Authentication;
 use Zend\Http\PhpEnvironment\Request;
 use Zend\Http\PhpEnvironment\Response;
 use Zend\Mvc\Application;
-use Zend\Mvc\Router\Exception;
-use Zend\Mvc\Router\RouteInterface;
+use Zend\Router\Exception;
+use Zend\Router\RouteInterface;
 use ZfcUser\Options\ModuleOptions;
 
 /**
diff --git a/src/UnicaenAuth/Authentication/RedirectCallbackFactory.php b/src/UnicaenAuth/Authentication/RedirectCallbackFactory.php
index 76359f280485d7ae18552ec91a5070530a5df790..e4e5a97c94fea2d61d87f08d3b8d78bd4fb85faa 100644
--- a/src/UnicaenAuth/Authentication/RedirectCallbackFactory.php
+++ b/src/UnicaenAuth/Authentication/RedirectCallbackFactory.php
@@ -2,30 +2,29 @@
 
 namespace UnicaenAuth\Authentication;
 
+use Interop\Container\ContainerInterface;
 use Zend\Mvc\Application;
-use Zend\Mvc\Router\RouteInterface;
+use Zend\Router\RouteInterface;
 use Zend\ServiceManager\FactoryInterface;
 use Zend\ServiceManager\ServiceLocatorInterface;
 use ZfcUser\Options\ModuleOptions;
 
 class RedirectCallbackFactory implements FactoryInterface
 {
-    /**
-     * Create service
-     *
-     * @param ServiceLocatorInterface $serviceLocator
-     * @return mixed
-     */
     public function createService(ServiceLocatorInterface $serviceLocator)
+    { return $this->__invoke($serviceLocator, '?');
+    }
+
+    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
     {
         /* @var RouteInterface $router */
-        $router = $serviceLocator->get('Router');
+        $router = $container->get('Router');
 
         /* @var Application $application */
-        $application = $serviceLocator->get('Application');
+        $application = $container->get('Application');
 
         /* @var ModuleOptions $options */
-        $options = $serviceLocator->get('zfcuser_module_options');
+        $options = $container->get('zfcuser_module_options');
 
         return new RedirectCallback($application, $router, $options);
     }
diff --git a/src/UnicaenAuth/Authentication/Storage/ChainServiceFactory.php b/src/UnicaenAuth/Authentication/Storage/ChainServiceFactory.php
index 02fbd70ee4a0532749427c7ca83deb86be0a7314..09193f5e66ebf892409051e489d4d7e9293ca280 100644
--- a/src/UnicaenAuth/Authentication/Storage/ChainServiceFactory.php
+++ b/src/UnicaenAuth/Authentication/Storage/ChainServiceFactory.php
@@ -2,6 +2,7 @@
 
 namespace UnicaenAuth\Authentication\Storage;
 
+use Interop\Container\ContainerInterface;
 use UnicaenAuth\Options\ModuleOptions;
 use Zend\ServiceManager\FactoryInterface;
 use Zend\ServiceManager\ServiceLocatorInterface;
@@ -21,18 +22,17 @@ class ChainServiceFactory implements FactoryInterface
 
     protected $storages = [];
 
-    /**
-     * Create service
-     *
-     * @param ServiceLocatorInterface $serviceLocator
-     * @return mixed
-     */
     public function createService(ServiceLocatorInterface $serviceLocator)
+    {
+        return $this->__invoke($serviceLocator, '?');
+    }
+
+    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
     {
         $chain = new Chain();
 
         /** @var ModuleOptions $options */
-        $options = $serviceLocator->get('unicaen-auth_module_options');
+        $options = $container->get('unicaen-auth_module_options');
 
         // retrait du fournisseur Ldap si l'auth LDAP est désactivée
         if (isset($options->getLdap()['enabled']) && ! $options->getLdap()['enabled']) {
@@ -43,7 +43,7 @@ class ChainServiceFactory implements FactoryInterface
         krsort($storages);
 
         foreach ($storages as $priority => $name) {
-            $storage = $serviceLocator->get($name);
+            $storage = $container->get($name);
             $chain->getEventManager()->attach('read', [$storage, 'read'], $priority);
             $chain->getEventManager()->attach('write', [$storage, 'write'], $priority);
             $chain->getEventManager()->attach('clear', [$storage, 'clear'], $priority);
diff --git a/src/UnicaenAuth/Mouchard/MouchardCompleterAuthFactory.php b/src/UnicaenAuth/Mouchard/MouchardCompleterAuthFactory.php
index bbbeeca7b52f4d3e23190b50f98433fc63c09ec3..714ecf03a947e721b95c04b20fa16ded7a12f1c7 100644
--- a/src/UnicaenAuth/Mouchard/MouchardCompleterAuthFactory.php
+++ b/src/UnicaenAuth/Mouchard/MouchardCompleterAuthFactory.php
@@ -2,6 +2,7 @@
 
 namespace UnicaenAuth\Mouchard;
 
+use Interop\Container\ContainerInterface;
 use Zend\ServiceManager\FactoryInterface;
 use Zend\ServiceManager\ServiceLocatorInterface;
 
@@ -12,17 +13,16 @@ use Zend\ServiceManager\ServiceLocatorInterface;
  */
 class MouchardCompleterAuthFactory implements FactoryInterface
 {
-    /**
-     * Create service
-     *
-     * @param ServiceLocatorInterface $serviceLocator
-     * @return MouchardCompleterAuth
-     */
     public function createService(ServiceLocatorInterface $serviceLocator)
+    {
+        return $this->__invoke($serviceLocator);
+    }
+
+    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
     {
         $mouchardCompleterAuth = new MouchardCompleterAuth();
 
-        $serviceUserContext = $serviceLocator->get('UnicaenAuth\Service\UserContext');
+        $serviceUserContext = $container->get('UnicaenAuth\Service\UserContext');
         $mouchardCompleterAuth->setServiceUserContext($serviceUserContext);
 
         return $mouchardCompleterAuth;
diff --git a/src/UnicaenAuth/Options/ModuleOptionsFactory.php b/src/UnicaenAuth/Options/ModuleOptionsFactory.php
index dd7e1a86c125d6e118c294a924c61435fb0f7946..a03a0509087af075b64f10d9dba293bc69401034 100644
--- a/src/UnicaenAuth/Options/ModuleOptionsFactory.php
+++ b/src/UnicaenAuth/Options/ModuleOptionsFactory.php
@@ -2,6 +2,7 @@
 
 namespace UnicaenAuth\Options;
 
+use Interop\Container\ContainerInterface;
 use Zend\ServiceManager\FactoryInterface;
 use Zend\ServiceManager\ServiceLocatorInterface;
 
@@ -12,15 +13,14 @@ use Zend\ServiceManager\ServiceLocatorInterface;
  */
 class ModuleOptionsFactory implements FactoryInterface
 {
-    /**
-     * Create service
-     *
-     * @param ServiceLocatorInterface $serviceLocator
-     * @return mixed
-     */
     public function createService(ServiceLocatorInterface $serviceLocator)
     {
-        $config       = $serviceLocator->get('Configuration');
+        return $this->__invoke($serviceLocator, '?');
+    }
+
+    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
+    {
+        $config       = $container->get('Configuration');
         $moduleConfig = isset($config['unicaen-auth']) ? $config['unicaen-auth'] : [];
         $moduleConfig = array_merge($config['zfcuser'], $moduleConfig);
 
diff --git a/src/UnicaenAuth/Provider/Identity/BasicServiceFactory.php b/src/UnicaenAuth/Provider/Identity/BasicServiceFactory.php
index 298c2b6a60727c02542bf4018c30bda911335a66..b7c7212c16e780ef905352928869fb62a03939d1 100644
--- a/src/UnicaenAuth/Provider/Identity/BasicServiceFactory.php
+++ b/src/UnicaenAuth/Provider/Identity/BasicServiceFactory.php
@@ -2,6 +2,7 @@
 
 namespace UnicaenAuth\Provider\Identity;
 
+use Interop\Container\ContainerInterface;
 use Zend\ServiceManager\FactoryInterface;
 use Zend\ServiceManager\ServiceLocatorInterface;
 
@@ -17,8 +18,13 @@ class BasicServiceFactory implements FactoryInterface
      */
     public function createService(ServiceLocatorInterface $serviceLocator)
     {
-        $user              = $serviceLocator->get('zfcuser_user_service');
-        $config            = $serviceLocator->get('BjyAuthorize\Config');
+        return $this->__invoke($serviceLocator, '?');
+    }
+
+    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
+    {
+        $user              = $container->get('zfcuser_user_service');
+        $config            = $container->get('BjyAuthorize\Config');
         $identityProvider  = new Basic($user->getAuthService());
 
         $identityProvider->setDefaultRole($config['default_role']);
diff --git a/src/UnicaenAuth/Provider/Identity/ChainServiceFactory.php b/src/UnicaenAuth/Provider/Identity/ChainServiceFactory.php
index eca7b942da95301f124a804835eb47fcce796d12..98ba90226e926d896b06e2a0c7503580391615c6 100644
--- a/src/UnicaenAuth/Provider/Identity/ChainServiceFactory.php
+++ b/src/UnicaenAuth/Provider/Identity/ChainServiceFactory.php
@@ -2,6 +2,7 @@
 
 namespace UnicaenAuth\Provider\Identity;
 
+use Interop\Container\ContainerInterface;
 use Zend\ServiceManager\FactoryInterface;
 use Zend\ServiceManager\ServiceLocatorInterface;
 
@@ -12,21 +13,20 @@ use Zend\ServiceManager\ServiceLocatorInterface;
  */
 class ChainServiceFactory implements FactoryInterface
 {
-    /**
-     * Create service
-     *
-     * @param ServiceLocatorInterface $serviceLocator
-     * @return mixed
-     */
     public function createService(ServiceLocatorInterface $serviceLocator)
+    {
+        return $this->__invoke($serviceLocator, '?');
+    }
+
+    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
     {
         $chain = new Chain();
-        $chain->setServiceLocator($serviceLocator);
+        $chain->setServiceLocator($container);
 
-        $providers = $this->computeProviders($serviceLocator);
+        $providers = $this->computeProviders($container);
 
         foreach ($providers as $priority => $name) {
-            $provider = $serviceLocator->get($name);
+            $provider = $container->get($name);
             $chain->getEventManager()->attach('getIdentityRoles', [$provider, 'injectIdentityRoles'], $priority);
         }
 
diff --git a/src/UnicaenAuth/Provider/Identity/DbServiceFactory.php b/src/UnicaenAuth/Provider/Identity/DbServiceFactory.php
index a326639d8d78e3ce161381f813744f627d87760a..4ce3d5c8fa5685fa74539c157e518d808f777f77 100644
--- a/src/UnicaenAuth/Provider/Identity/DbServiceFactory.php
+++ b/src/UnicaenAuth/Provider/Identity/DbServiceFactory.php
@@ -2,6 +2,7 @@
 
 namespace UnicaenAuth\Provider\Identity;
 
+use Interop\Container\ContainerInterface;
 use UnicaenApp\Options\ModuleOptions;
 use Zend\Ldap\Ldap;
 use Zend\ServiceManager\FactoryInterface;
@@ -19,18 +20,23 @@ class DbServiceFactory implements FactoryInterface
      */
     public function createService(ServiceLocatorInterface $serviceLocator)
     {
-        $user             = $serviceLocator->get('zfcuser_user_service');
+        return $this->__invoke($serviceLocator, '?');
+    }
+
+    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
+    {
+        $user             = $container->get('zfcuser_user_service');
         $identityProvider = new Db($user->getAuthService());
 
-        $unicaenAppOptions = $serviceLocator->get('unicaen-app_module_options');
+        $unicaenAppOptions = $container->get('unicaen-app_module_options');
         /* @var $unicaenAppOptions ModuleOptions */
 
         $ldap = new Ldap($unicaenAppOptions->getLdap()['connection']['default']['params']);
         $identityProvider->setLdap($ldap);
 
-        $identityProvider->setServiceRole($serviceLocator->get('UnicaenAuth\Service\Role'));
+        $identityProvider->setServiceRole($container->get('UnicaenAuth\Service\Role'));
 
-        $config            = $serviceLocator->get('BjyAuthorize\Config');
+        $config            = $container->get('BjyAuthorize\Config');
         $identityProvider->setDefaultRole($config['default_role']);
         $identityProvider->setAuthenticatedRole($config['authenticated_role']);
 
diff --git a/src/UnicaenAuth/Provider/Identity/LdapServiceFactory.php b/src/UnicaenAuth/Provider/Identity/LdapServiceFactory.php
index 3209e8690bab08d3c8e1f37de37e049297b749dc..68a2849cb0a87d87d61dc824aad8abd167d7b635 100644
--- a/src/UnicaenAuth/Provider/Identity/LdapServiceFactory.php
+++ b/src/UnicaenAuth/Provider/Identity/LdapServiceFactory.php
@@ -2,9 +2,9 @@
 
 namespace UnicaenAuth\Provider\Identity;
 
+use Interop\Container\ContainerInterface;
 use Zend\ServiceManager\FactoryInterface;
 use Zend\ServiceManager\ServiceLocatorInterface;
-use UnicaenAuth\Acl\NamedRole;
 
 /**
  * LDAP identity provider factory
@@ -19,10 +19,15 @@ class LdapServiceFactory implements FactoryInterface
      */
     public function createService(ServiceLocatorInterface $serviceLocator)
     {
-        $config                 = $serviceLocator->get('BjyAuthorize\Config');
-        $user                   = $serviceLocator->get('zfcuser_user_service');
+        return $this->__invoke($serviceLocator, '?');
+    }
+
+    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
+    {
+        $config                 = $container->get('BjyAuthorize\Config');
+        $user                   = $container->get('zfcuser_user_service');
         $simpleIdentityProvider = new Ldap($user->getAuthService());
-        
+
         $simpleIdentityProvider->setDefaultRole($config['default_role']);
         $simpleIdentityProvider->setAuthenticatedRole($config['authenticated_role']);
 
diff --git a/src/UnicaenAuth/Provider/Role/ConfigServiceFactory.php b/src/UnicaenAuth/Provider/Role/ConfigServiceFactory.php
index 158b1e3a6776d0a6af4478e280f30e4eb6442145..7b00b786f0f0bfa6fb8decac7a0af6a65bf8096f 100644
--- a/src/UnicaenAuth/Provider/Role/ConfigServiceFactory.php
+++ b/src/UnicaenAuth/Provider/Role/ConfigServiceFactory.php
@@ -3,6 +3,7 @@
 namespace UnicaenAuth\Provider\Role;
 
 use BjyAuthorize\Exception\InvalidArgumentException;
+use Interop\Container\ContainerInterface;
 use Zend\ServiceManager\FactoryInterface;
 use Zend\ServiceManager\ServiceLocatorInterface;
 
@@ -15,23 +16,26 @@ class ConfigServiceFactory implements FactoryInterface
 {
     /**
      * {@inheritDoc}
-     *
-     * @return \BjyAuthorize\Provider\Role\Config
      */
     public function createService(ServiceLocatorInterface $serviceLocator)
     {
-        $config = $serviceLocator->get('BjyAuthorize\Config');
+        return $this->__invoke($serviceLocator, '?');
+    }
+
+    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
+    {
+        $config = $container->get('BjyAuthorize\Config');
 
         if (! isset($config['role_providers']['UnicaenAuth\Provider\Role\Config'])) {
             throw new InvalidArgumentException(
                 'Config for "UnicaenAuth\Provider\Role\Config" not set'
             );
         }
-        
+
         $providerConfig = $config['role_providers']['UnicaenAuth\Provider\Role\Config'];
-        
+
         /* @var $mapper \UnicaenApp\Mapper\Ldap\Group */
-        $mapper = $serviceLocator->get('ldap_group_mapper');
+        $mapper = $container->get('ldap_group_mapper');
 
         $service = new Config($mapper, $providerConfig);
 
diff --git a/src/UnicaenAuth/Provider/Role/DbRoleServiceFactory.php b/src/UnicaenAuth/Provider/Role/DbRoleServiceFactory.php
index ab238ca040b0336fcfdbc68a1784044eb8c86b21..43902e9a33eff93a38f611e90f52daff984be3e8 100644
--- a/src/UnicaenAuth/Provider/Role/DbRoleServiceFactory.php
+++ b/src/UnicaenAuth/Provider/Role/DbRoleServiceFactory.php
@@ -2,7 +2,7 @@
 
 namespace UnicaenAuth\Provider\Role;
 
-use BjyAuthorize\Exception\InvalidArgumentException;
+use Interop\Container\ContainerInterface;
 use UnicaenAuth\Service\RoleService;
 use Zend\ServiceManager\FactoryInterface;
 use Zend\ServiceManager\ServiceLocatorInterface;
@@ -14,12 +14,15 @@ class DbRoleServiceFactory implements FactoryInterface
 {
     /**
      * {@inheritDoc}
-     *
-     * @return DbRole
      */
     public function createService(ServiceLocatorInterface $serviceLocator)
     {
-        $serviceRole = $serviceLocator->get('UnicaenAuth\Service\Role');
+        return $this->__invoke($serviceLocator, '?');
+    }
+
+    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
+    {
+        $serviceRole = $container->get('UnicaenAuth\Service\Role');
         /* @var $serviceRole RoleService */
 
         return new DbRole($serviceRole->getRepo());
diff --git a/src/UnicaenAuth/Provider/Role/UsernameServiceFactory.php b/src/UnicaenAuth/Provider/Role/UsernameServiceFactory.php
index fdfdc2aad21b779bf1c7f3327b305fa80a06f316..d3afce2f233b09f8604fff1c856e8f5e55b9872e 100644
--- a/src/UnicaenAuth/Provider/Role/UsernameServiceFactory.php
+++ b/src/UnicaenAuth/Provider/Role/UsernameServiceFactory.php
@@ -2,6 +2,7 @@
 
 namespace UnicaenAuth\Provider\Role;
 
+use Interop\Container\ContainerInterface;
 use Zend\ServiceManager\FactoryInterface;
 use Zend\ServiceManager\ServiceLocatorInterface;
 
@@ -12,26 +13,25 @@ use Zend\ServiceManager\ServiceLocatorInterface;
  */
 class UsernameServiceFactory implements FactoryInterface
 {
-    /**
-     * Create service
-     *
-     * @param ServiceLocatorInterface $serviceLocator
-     * @return Username
-     */
     public function createService(ServiceLocatorInterface $serviceLocator)
     {
-        $config = $serviceLocator->get('BjyAuthorize\Config');
+        return $this->__invoke($serviceLocator, '?');
+    }
+
+    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
+    {
+        $config = $container->get('BjyAuthorize\Config');
 
         if (! isset($config['role_providers']['UnicaenAuth\Provider\Role\Username'])) {
-            throw new InvalidArgumentException(
+            throw new \InvalidArgumentException(
                 'Config for "UnicaenAuth\Provider\Role\Username" not set'
             );
         }
 
         $providerConfig = $config['role_providers']['UnicaenAuth\Provider\Role\Username'];
-        
-        $authService = $serviceLocator->get('zfcuser_auth_service'); /* @var $authService \Zend\Authentication\AuthenticationService */
-        
+
+        $authService = $container->get('zfcuser_auth_service'); /* @var $authService \Zend\Authentication\AuthenticationService */
+
         return new Username($authService, $providerConfig);
     }
 }
\ No newline at end of file
diff --git a/src/UnicaenAuth/Service/AuthorizeServiceFactory.php b/src/UnicaenAuth/Service/AuthorizeServiceFactory.php
index 14b7857cc93d06890879e84219030a4c489e1c2d..8f8e82f82e765f6ae30c8b86e0f06ba187c05b3c 100644
--- a/src/UnicaenAuth/Service/AuthorizeServiceFactory.php
+++ b/src/UnicaenAuth/Service/AuthorizeServiceFactory.php
@@ -8,6 +8,7 @@
 
 namespace UnicaenAuth\Service;
 
+use Interop\Container\ContainerInterface;
 use Zend\ServiceManager\FactoryInterface;
 use Zend\ServiceManager\ServiceLocatorInterface;
 
@@ -20,11 +21,13 @@ class AuthorizeServiceFactory implements FactoryInterface
 {
     /**
      * {@inheritDoc}
-     *
-     * @return \Application\Service\Authorize
      */
     public function createService(ServiceLocatorInterface $serviceLocator)
     {
-        return new AuthorizeService($serviceLocator->get('BjyAuthorize\Config'), $serviceLocator);
+    }
+
+    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
+    {
+        return new AuthorizeService($container->get('BjyAuthorize\Config'), $container);
     }
 }
diff --git a/src/UnicaenAuth/Service/PrivilegeServiceFactory.php b/src/UnicaenAuth/Service/PrivilegeServiceFactory.php
index 04271e3b7121d866e302cba9ece5d006218d2639..0a7fa32ec340da1caf15f8bc9d3cc2836e304eac 100644
--- a/src/UnicaenAuth/Service/PrivilegeServiceFactory.php
+++ b/src/UnicaenAuth/Service/PrivilegeServiceFactory.php
@@ -2,6 +2,7 @@
 
 namespace UnicaenAuth\Service;
 
+use Interop\Container\ContainerInterface;
 use UnicaenAuth\Entity\Db\Privilege;
 use Zend\ServiceManager\FactoryInterface;
 use Zend\ServiceManager\ServiceLocatorInterface;
@@ -10,7 +11,12 @@ class PrivilegeServiceFactory implements FactoryInterface
 {
     public function createService(ServiceLocatorInterface $serviceLocator)
     {
-        $config = $serviceLocator->get('Config');
+        return $this->__invoke($serviceLocator, '?');
+    }
+
+    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
+    {
+        $config = $container->get('Config');
 
         if (! isset($config['unicaen-auth']['privilege_entity_class'])) {
 //            throw new InvalidArgumentException("La classe de l'entité privilège n'a pas été trouvée dans la config");
diff --git a/src/UnicaenAuth/Service/RoleServiceFactory.php b/src/UnicaenAuth/Service/RoleServiceFactory.php
index 74c4057c8d3d7bf455a4459f060d828453e3e84a..436b97c5c0521a763788f673aee4f87ce77b29be 100644
--- a/src/UnicaenAuth/Service/RoleServiceFactory.php
+++ b/src/UnicaenAuth/Service/RoleServiceFactory.php
@@ -2,6 +2,7 @@
 
 namespace UnicaenAuth\Service;
 
+use Interop\Container\ContainerInterface;
 use UnicaenAuth\Entity\Db\Role;
 use Zend\ServiceManager\FactoryInterface;
 use Zend\ServiceManager\ServiceLocatorInterface;
@@ -10,7 +11,12 @@ class RoleServiceFactory implements FactoryInterface
 {
     public function createService(ServiceLocatorInterface $serviceLocator)
     {
-        $config = $serviceLocator->get('Config');
+        return $this->__invoke($serviceLocator, '?');
+    }
+
+    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
+    {
+        $config = $container->get('Config');
 
         if (! isset($config['unicaen-auth']['role_entity_class'])) {
             $config['unicaen-auth']['role_entity_class'] = Role::class;
diff --git a/src/UnicaenAuth/Service/ShibService.php b/src/UnicaenAuth/Service/ShibService.php
index df7b7ff4ed2bb6fbfc9ca21c30b598c2506bd3be..d5831ae7f7cfc96f46b5c5c963b8b4ba0fcd0a35 100644
--- a/src/UnicaenAuth/Service/ShibService.php
+++ b/src/UnicaenAuth/Service/ShibService.php
@@ -8,7 +8,7 @@ use InvalidArgumentException;
 use UnicaenApp\Exception\LogicException;
 use UnicaenApp\Exception\RuntimeException;
 use UnicaenAuth\Entity\Shibboleth\ShibUser;
-use Zend\Mvc\Router\Http\TreeRouteStack;
+use Zend\Router\Http\TreeRouteStack;
 use Zend\Session\Container;
 
 /**
diff --git a/src/UnicaenAuth/Service/UserAwareInitializer.php b/src/UnicaenAuth/Service/UserAwareInitializer.php
index 0fb7ee8c3fe31838704a3edf7b11d4d925181c7c..13db3fbbb6ed4c06e044ae2b7763b8c43484f191 100644
--- a/src/UnicaenAuth/Service/UserAwareInitializer.php
+++ b/src/UnicaenAuth/Service/UserAwareInitializer.php
@@ -2,12 +2,11 @@
 
 namespace UnicaenAuth\Service;
 
+use Interop\Container\ContainerInterface;
+use UnicaenAuth\Entity\Ldap\People;
 use Zend\ServiceManager\InitializerInterface;
 use Zend\ServiceManager\ServiceLocatorInterface;
-use UnicaenAuth\Service\DbUserAwareInterface;
-use UnicaenAuth\Service\LdapUserAwareInterface;
 use ZfcUser\Entity\UserInterface;
-use UnicaenAuth\Entity\Ldap\People;
 
 /**
  * Initialisateur chargé d'injecter l'utilisateur courant dans les services en ayant besoin.
@@ -26,34 +25,33 @@ class UserAwareInitializer implements InitializerInterface
     {
         return $instance instanceof DbUserAwareInterface || $instance instanceof LdapUserAwareInterface;
     }
-    
-    /**
-     * Initialize
-     *
-     * @param mixed $instance
-     * @param ServiceLocatorInterface $serviceLocator
-     */
+
     public function initialize($instance, ServiceLocatorInterface $serviceLocator)
+    {
+        $this->__invoke($serviceLocator, $instance);
+    }
+
+    public function __invoke(ContainerInterface $container, $instance)
     {
         // test d'éligibilité à faire au plus tôt pour éviter l'erreur
         // 'Circular dependency for LazyServiceLoader was found for instance Zend\Authentication\AuthenticationService'
         if (!$this->canInitialize($instance)) {
             return;
         }
-        
-        $authenticationService = $serviceLocator->get('Zend\Authentication\AuthenticationService');
+
+        $authenticationService = $container->get('Zend\Authentication\AuthenticationService');
         if (!$authenticationService->hasIdentity()) {
             return;
         }
 
         $identity = $authenticationService->getIdentity();
-        
+
         if ($instance instanceof DbUserAwareInterface) {
             if (isset($identity['db']) && $identity['db'] instanceof UserInterface) {
                 $instance->setDbUser($identity['db']);
             }
         }
-        
+
         if ($instance instanceof LdapUserAwareInterface) {
             if (isset($identity['ldap']) && $identity['ldap'] instanceof People) {
                 $instance->setLdapUser($identity['ldap']);
diff --git a/src/UnicaenAuth/Service/UserMapperFactory.php b/src/UnicaenAuth/Service/UserMapperFactory.php
index 83159382b12dc40e1ddfdc59174df56b0cb3f2c2..b2ceff2b9debba257d9fed342e79b1d786edd3ae 100644
--- a/src/UnicaenAuth/Service/UserMapperFactory.php
+++ b/src/UnicaenAuth/Service/UserMapperFactory.php
@@ -3,25 +3,25 @@
 namespace UnicaenAuth\Service;
 
 use Doctrine\ORM\EntityManagerInterface;
+use Interop\Container\ContainerInterface;
 use UnicaenAuth\Options\ModuleOptions;
 use Zend\ServiceManager\FactoryInterface;
 use Zend\ServiceManager\ServiceLocatorInterface;
 
 class UserMapperFactory implements FactoryInterface
 {
-    /**
-     * Create service
-     *
-     * @param ServiceLocatorInterface $serviceLocator
-     * @return UserMapper
-     */
     public function createService(ServiceLocatorInterface $serviceLocator)
+    {
+        return $this->__invoke($serviceLocator, '?');
+    }
+
+    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
     {
         /** @var EntityManagerInterface $em */
-        $em = $serviceLocator->get('zfcuser_doctrine_em');
+        $em = $container->get('zfcuser_doctrine_em');
 
         /** @var ModuleOptions $options */
-        $options = $serviceLocator->get('zfcuser_module_options');
+        $options = $container->get('zfcuser_module_options');
 
         return new UserMapper($em, $options);
     }
diff --git a/src/UnicaenAuth/View/Helper/UserConnectionFactory.php b/src/UnicaenAuth/View/Helper/UserConnectionFactory.php
index ae064c469f1a5b95ca6d3e5fbd5dc49f71fb0cc7..5f3372a2f073adb9f170d971ccf2309560c91fc9 100644
--- a/src/UnicaenAuth/View/Helper/UserConnectionFactory.php
+++ b/src/UnicaenAuth/View/Helper/UserConnectionFactory.php
@@ -2,6 +2,7 @@
 
 namespace UnicaenAuth\View\Helper;
 
+use Interop\Container\ContainerInterface;
 use Zend\ServiceManager\FactoryInterface;
 use Zend\ServiceManager\ServiceLocatorInterface;
 
@@ -12,16 +13,15 @@ use Zend\ServiceManager\ServiceLocatorInterface;
  */
 class UserConnectionFactory implements FactoryInterface
 {
-    /**
-     * Create service
-     *
-     * @param ServiceLocatorInterface $helperPluginManager
-     * @return UserConnection
-     */
     public function createService(ServiceLocatorInterface $helperPluginManager)
     {
-        $authUserContext = $helperPluginManager->getServiceLocator()->get('authUserContext');
-        
+        return $this->__invoke($helperPluginManager, '?');
+    }
+
+    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
+    {
+        $authUserContext = $container->get('authUserContext');
+
         return new UserConnection($authUserContext);
     }
 }
\ No newline at end of file
diff --git a/src/UnicaenAuth/View/Helper/UserCurrentFactory.php b/src/UnicaenAuth/View/Helper/UserCurrentFactory.php
index e8642f6f4dc54b3d312da25e1aff594806e8070c..845135e7d57c9d40a75b727d54364fb052b9f6c6 100644
--- a/src/UnicaenAuth/View/Helper/UserCurrentFactory.php
+++ b/src/UnicaenAuth/View/Helper/UserCurrentFactory.php
@@ -2,6 +2,7 @@
 
 namespace UnicaenAuth\View\Helper;
 
+use Interop\Container\ContainerInterface;
 use Zend\ServiceManager\FactoryInterface;
 use Zend\ServiceManager\ServiceLocatorInterface;
 
@@ -12,16 +13,15 @@ use Zend\ServiceManager\ServiceLocatorInterface;
  */
 class UserCurrentFactory implements FactoryInterface
 {
-    /**
-     * Create service
-     *
-     * @param ServiceLocatorInterface $helperPluginManager
-     * @return UserCurrent
-     */
     public function createService(ServiceLocatorInterface $helperPluginManager)
     {
-        $authUserContext = $helperPluginManager->getServiceLocator()->get('authUserContext');
-        
+        return $this->__invoke($helperPluginManager, '?');
+    }
+
+    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
+    {
+        $authUserContext = $container->get('authUserContext');
+
         return new UserCurrent($authUserContext);
     }
 }
\ No newline at end of file
diff --git a/src/UnicaenAuth/View/Helper/UserInfoFactory.php b/src/UnicaenAuth/View/Helper/UserInfoFactory.php
index 5852ec572cf22aa789b1ec0023a562f824311162..d52e50d3f41e6566ad5d53cea45ff4fe4f2bdf68 100644
--- a/src/UnicaenAuth/View/Helper/UserInfoFactory.php
+++ b/src/UnicaenAuth/View/Helper/UserInfoFactory.php
@@ -2,6 +2,7 @@
 
 namespace UnicaenAuth\View\Helper;
 
+use Interop\Container\ContainerInterface;
 use Zend\ServiceManager\FactoryInterface;
 use Zend\ServiceManager\ServiceLocatorInterface;
 
@@ -12,21 +13,20 @@ use Zend\ServiceManager\ServiceLocatorInterface;
  */
 class UserInfoFactory implements FactoryInterface
 {
-    /**
-     * Create service
-     *
-     * @param ServiceLocatorInterface $helperPluginManager
-     * @return UserInfo
-     */
     public function createService(ServiceLocatorInterface $helperPluginManager)
     {
-        $serviceLocator  = $helperPluginManager->getServiceLocator();
+        return $this->__invoke($helperPluginManager, '?');
+    }
+
+    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
+    {
+        $serviceLocator  = $container;
         $authUserContext = $serviceLocator->get('authUserContext');
         $mapper          = $serviceLocator->get('ldap_structure_mapper');
 
         $helper = new UserInfo($authUserContext);
         $helper->setMapperStructure($mapper);
-        
+
         return $helper;
     }
 }
\ No newline at end of file
diff --git a/src/UnicaenAuth/View/Helper/UserProfileFactory.php b/src/UnicaenAuth/View/Helper/UserProfileFactory.php
index 05e7015f353415b70948824e47f566e00d4a14bf..7b8c423c9a7c4f73a00d4637f9363d545c1fdc1a 100644
--- a/src/UnicaenAuth/View/Helper/UserProfileFactory.php
+++ b/src/UnicaenAuth/View/Helper/UserProfileFactory.php
@@ -2,6 +2,7 @@
 
 namespace UnicaenAuth\View\Helper;
 
+use Interop\Container\ContainerInterface;
 use Zend\ServiceManager\FactoryInterface;
 use Zend\ServiceManager\ServiceLocatorInterface;
 
@@ -12,15 +13,14 @@ use Zend\ServiceManager\ServiceLocatorInterface;
  */
 class UserProfileFactory implements FactoryInterface
 {
-    /**
-     * Create service
-     *
-     * @param ServiceLocatorInterface $helperPluginManager
-     * @return UserProfile
-     */
     public function createService(ServiceLocatorInterface $helperPluginManager)
     {
-        $serviceLocator  = $helperPluginManager->getServiceLocator();
+        return $this->__invoke($helperPluginManager, '?');
+    }
+
+    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
+    {
+        $serviceLocator  = $container;
         $authUserContext = $serviceLocator->get('authUserContext');
 
         return new UserProfile($authUserContext);
diff --git a/src/UnicaenAuth/View/Helper/UserStatusFactory.php b/src/UnicaenAuth/View/Helper/UserStatusFactory.php
index 7427c95dec90ba09c914514d2c9475487731ecef..cbcad7c71d4ceba75541a8433aada775b4c6e8b2 100644
--- a/src/UnicaenAuth/View/Helper/UserStatusFactory.php
+++ b/src/UnicaenAuth/View/Helper/UserStatusFactory.php
@@ -2,6 +2,7 @@
 
 namespace UnicaenAuth\View\Helper;
 
+use Interop\Container\ContainerInterface;
 use Zend\ServiceManager\FactoryInterface;
 use Zend\ServiceManager\ServiceLocatorInterface;
 
@@ -12,16 +13,15 @@ use Zend\ServiceManager\ServiceLocatorInterface;
  */
 class UserStatusFactory implements FactoryInterface
 {
-    /**
-     * Create service
-     *
-     * @param ServiceLocatorInterface $helperPluginManager
-     * @return UserStatus
-     */
     public function createService(ServiceLocatorInterface $helperPluginManager)
     {
-        $userContext = $helperPluginManager->getServiceLocator()->get('authUserContext');
-        
+        return $this->__invoke($helperPluginManager, '?');
+    }
+
+    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
+    {
+        $userContext = $container->get('authUserContext');
+
         return new UserStatus($userContext);
     }
 }
\ No newline at end of file
diff --git a/tests/UnicaenAuthTest/Authentication/Adapter/CasTest.php b/tests/UnicaenAuthTest/Authentication/Adapter/CasTest.php
index 1bdb35a83baad027eb05b3a3c5101a306451c67f..f7343fa0afa0c12ab2b246134469d289d8e526c8 100644
--- a/tests/UnicaenAuthTest/Authentication/Adapter/CasTest.php
+++ b/tests/UnicaenAuthTest/Authentication/Adapter/CasTest.php
@@ -56,7 +56,7 @@ class CasTest extends PHPUnit_Framework_TestCase
                                return $moduleOptions;
                            }
                            if ('router' === $serviceName) {
-                               $router = new \Zend\Mvc\Router\Http\TreeRouteStack();
+                               $router = new \Zend\Router\Http\TreeRouteStack();
                                $router->setBaseUrl('/appli')->setRequestUri(new \Zend\Uri\Http('/request'));
                                return $router;
                            }