accountManager = $accountManager; $this->moduleManager = $moduleManager; } public static function getSubscribedEvents() { return [ KernelEvents::CONTROLLER => 'onKernelController', ]; } public function onKernelController(ControllerEvent $event) { $controller = $event->getController(); if (is_array($controller)) { $controller = $controller[0]; } if (!$controller instanceof ClientIdSecuredControllerInterface) { return; } $request = $event->getRequest(); if ($request->isMethod('post')) { $clientId = $request->request->get('clientId'); } else { $clientId = $request->query->get('clientId'); } if (empty($clientId)) { throw new AccessDeniedHttpException('ClientId required'); } if (!Uuid::isValid($clientId)) { throw new AccessDeniedHttpException('ClientId is not valid'); } $account = $this->accountManager->findOneBy(['clientId' => $clientId]); if (null === $account) { throw new AccessDeniedHttpException('ClientId not found'); } $this->moduleManager->setAccount($account); } }