src/Pumukit/CoreBundle/Controller/AuthController.php line 20

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Pumukit\CoreBundle\Controller;
  4. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  5. use Symfony\Component\HttpFoundation\RedirectResponse;
  6. use Symfony\Component\HttpFoundation\Request;
  7. use Symfony\Component\HttpFoundation\Session\SessionInterface;
  8. use Symfony\Component\Routing\Annotation\Route;
  9. class AuthController extends AbstractController implements WebTVControllerInterface
  10. {
  11.     /**
  12.      * @Route("/auth", name="pumukit_auth")
  13.      */
  14.     public function changeAction(Request $requestSessionInterface $session): RedirectResponse
  15.     {
  16.         if (!$session->has('target_path')) {
  17.             $referer $request->headers->get('referer''/');
  18.             $session->set('target_path'$request->query->get('referer'$referer));
  19.         }
  20.         if (!$this->isGranted('IS_AUTHENTICATED_FULLY')) {
  21.             throw $this->createAccessDeniedException('Unable to access this page!');
  22.         }
  23.         $targetUrl $session->get('target_path');
  24.         $session->remove('target_path');
  25.         return $this->redirect($targetUrl);
  26.     }
  27. }