vendor/symfony/security-http/Firewall/AuthenticatorManagerListener.php line 40

Open in your IDE?
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Security\Http\Firewall;
  11. use Symfony\Component\HttpFoundation\Request;
  12. use Symfony\Component\HttpKernel\Event\RequestEvent;
  13. use Symfony\Component\Security\Http\Authentication\AuthenticatorManagerInterface;
  14. /**
  15. * Firewall authentication listener that delegates to the authenticator system.
  16. *
  17. * @author Wouter de Jong <wouter@wouterj.nl>
  18. */
  19. class AuthenticatorManagerListener extends AbstractListener
  20. {
  21. private $authenticatorManager;
  22. public function __construct(AuthenticatorManagerInterface $authenticationManager)
  23. {
  24. $this->authenticatorManager = $authenticationManager;
  25. }
  26. public function supports(Request $request): ?bool
  27. {
  28. return $this->authenticatorManager->supports($request);
  29. }
  30. public function authenticate(RequestEvent $event): void
  31. {
  32. $request = $event->getRequest();
  33. $response = $this->authenticatorManager->authenticateRequest($request);
  34. if (null === $response) {
  35. return;
  36. }
  37. $event->setResponse($response);
  38. }
  39. }