Commit f40a5f90 authored by Bertrand Gauthier's avatar Bertrand Gauthier

Adapter d'auth Shib : l'enregistrement de l'utilisateur authentifié dans la BDD avait sauté !

parent 3779fd51
Pipeline #8958 passed with stage
in 18 seconds
......@@ -5,6 +5,7 @@ namespace UnicaenAuth\Authentication\Adapter;
use UnicaenAuth\Controller\AuthController;
use UnicaenAuth\Options\Traits\ModuleOptionsAwareTrait;
use UnicaenAuth\Service\Traits\ShibServiceAwareTrait;
use UnicaenAuth\Service\User;
use Zend\Authentication\AuthenticationService;
use Zend\Authentication\Exception\UnexpectedValueException;
use Zend\Authentication\Result as AuthenticationResult;
......@@ -59,6 +60,19 @@ class Shib extends AbstractAdapter
$this->router = $router;
}
/**
* @var User
*/
private $userService;
/**
* @param User $userService
*/
public function setUserService(User $userService)
{
$this->userService = $userService;
}
/**
* Réalise l'authentification.
*
......@@ -118,6 +132,9 @@ class Shib extends AbstractAdapter
$this->getStorage()->write($storage);
$e->setCode(AuthenticationResult::SUCCESS)
->setMessages(['Authentication successful.']);
/* @var $userService User */
$this->userService->userAuthenticated($shibUser);
}
/**
......
......@@ -5,6 +5,7 @@ namespace UnicaenAuth\Authentication\Adapter;
use Interop\Container\ContainerInterface;
use UnicaenAuth\Options\ModuleOptions;
use UnicaenAuth\Service\ShibService;
use UnicaenAuth\Service\User;
use Zend\Authentication\AuthenticationService;
use Zend\Authentication\Storage\Session;
use Zend\Router\RouteInterface;
......@@ -45,6 +46,10 @@ class ShibAdapterFactory
$router = $container->get('router');
$adapter->setRouter($router);
/** @var User $userService */
$userService = $container->get('unicaen-auth_user_service');
$adapter->setUserService($userService);
$options = array_merge(
$container->get('zfcuser_module_options')->toArray(),
$container->get('unicaen-auth_module_options')->toArray());
......
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