LoginLinkHandlerInterface.php 1005 B

123456789101112131415161718192021222324252627282930313233343536
  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\LoginLink;
  11. use Symfony\Component\HttpFoundation\Request;
  12. use Symfony\Component\Security\Core\User\UserInterface;
  13. /**
  14. * A class that is able to create and handle "magic" login links.
  15. *
  16. * @author Ryan Weaver <ryan@symfonycasts.com>
  17. * @experimental in 5.2
  18. */
  19. interface LoginLinkHandlerInterface
  20. {
  21. /**
  22. * Generate a link that can be used to authenticate as the given user.
  23. */
  24. public function createLoginLink(UserInterface $user): LoginLinkDetails;
  25. /**
  26. * Validates if this request contains a login link and returns the associated User.
  27. *
  28. * Throw InvalidLoginLinkExceptionInterface if the link is invalid.
  29. */
  30. public function consumeLoginLink(Request $request): UserInterface;
  31. }