public function __invoke(AuthenticationEvent $e)
 {
     $result = $e->getResult();
     if ($result->isValid()) {
         $this->sessionManager->writeClose();
     }
 }
 /**
  * @param AdapterInterface|null $adapter
  * @return AuthResult
  */
 public function authenticate(AdapterInterface $adapter = null)
 {
     $event = new AuthenticationEvent();
     $event->setTarget($this);
     if (!$adapter) {
         $adapter = $this->adapter;
     }
     if ($adapter) {
         $event->setAdapter($adapter);
     }
     $eventManager = new EventManager();
     $eventManager->setIdentifiers(get_class($this));
     $eventManager->trigger($event);
     return $event->getResult();
 }
 public function __invoke(AuthenticationEvent $e)
 {
     $e->setResult($this->authService->authenticate($e->getAdapter()));
 }