From 06d9620f31dd0c2308149252ff07e77806f28dd7 Mon Sep 17 00:00:00 2001
From: Bertrand Gauthier <bertrand.gauthier@unicaen.fr>
Date: Thu, 29 Mar 2018 09:37:24 +0200
Subject: [PATCH] =?UTF-8?q?Correction=20:=20appel=20de=20userAuthenticated?=
 =?UTF-8?q?()=20=C3=A0=20la=20main=20plut=C3=B4t=20que=20via=20l'event=20m?=
 =?UTF-8?q?anager?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/UnicaenAuth/Authentication/Adapter/Cas.php | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/UnicaenAuth/Authentication/Adapter/Cas.php b/src/UnicaenAuth/Authentication/Adapter/Cas.php
index 98d563a..7655441 100644
--- a/src/UnicaenAuth/Authentication/Adapter/Cas.php
+++ b/src/UnicaenAuth/Authentication/Adapter/Cas.php
@@ -94,7 +94,12 @@ class Cas extends AbstractAdapter implements ServiceManagerAwareInterface, Event
         $e->setCode(AuthenticationResult::SUCCESS)
           ->setMessages(['Authentication successful.']);
 
-        $this->getEventManager()->trigger('userAuthenticated', $e);
+        // recherche de l'individu dans l'annuaire LDAP, il existe forcément puisque l'auth CAS a réussi.
+        $ldapPeople = $this->getLdapPeopleMapper()->findOneByUsername($identity);
+
+        /* @var $userService User */
+        $userService = $this->getServiceManager()->get('unicaen-auth_user_service');
+        $userService->userAuthenticated($ldapPeople);
     }
 
     /**
-- 
GitLab