Exceptions

Exception

Symfony\Component\HttpKernel\Exception\ UnauthorizedHttpException

  1.         /**
  2.          * @var Customer|null
  3.          */
  4.         $customer $this->entityManager->getRepository(Customer::class)->getCustomerByToken($token);
  5.         if (!$customer) {
  6.             throw new UnauthorizedHttpException('Not authorized');
  7.         }
  8.         return $customer;
  9.     }
TokenAuth->getCustomerByToken() in src/Controller/API/ReleaseController.php (line 26)
  1.      * Testing connection with update service
  2.      */
  3.     #[Route('/check_connection'name'release.connection')]
  4.     public function checkConnectionAction()
  5.     {
  6.         $project $this->tokenAuth->getCustomerByToken();
  7.         return new JsonResponse(['connection' => true]);
  8.     }
  9.     /**
in vendor/symfony/http-kernel/HttpKernel.php -> checkConnectionAction (line 163)
  1.         $this->dispatcher->dispatch($eventKernelEvents::CONTROLLER_ARGUMENTS);
  2.         $controller $event->getController();
  3.         $arguments $event->getArguments();
  4.         // call controller
  5.         $response $controller(...$arguments);
  6.         // view
  7.         if (!$response instanceof Response) {
  8.             $event = new ViewEvent($this$request$type$response);
  9.             $this->dispatcher->dispatch($eventKernelEvents::VIEW);
  1.     {
  2.         $request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
  3.         $this->requestStack->push($request);
  4.         try {
  5.             return $this->handleRaw($request$type);
  6.         } catch (\Exception $e) {
  7.             if ($e instanceof RequestExceptionInterface) {
  8.                 $e = new BadRequestHttpException($e->getMessage(), $e);
  9.             }
  10.             if (false === $catch) {
  1.         $this->boot();
  2.         ++$this->requestStackSize;
  3.         $this->resetServices true;
  4.         try {
  5.             return $this->getHttpKernel()->handle($request$type$catch);
  6.         } finally {
  7.             --$this->requestStackSize;
  8.         }
  9.     }
Kernel->handle(object(Request)) in public/index.php (line 34)
  1.     Request::setTrustedHosts(explode(','$trustedHosts));
  2. }
  3. $kernel = new Kernel($env$debug);
  4. $request Request::createFromGlobals();
  5. $response $kernel->handle($request);
  6. $response->send();
  7. $kernel->terminate($request$response);

Stack Trace

UnauthorizedHttpException
Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException:

  at src/Auth/TokenAuth.php:30
  at App\Auth\TokenAuth->getCustomerByToken()
     (src/Controller/API/ReleaseController.php:26)
  at App\Controller\API\ReleaseController->checkConnectionAction()
     (vendor/symfony/http-kernel/HttpKernel.php:163)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
     (vendor/symfony/http-kernel/HttpKernel.php:75)
  at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
     (vendor/symfony/http-kernel/Kernel.php:202)
  at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
     (public/index.php:34)