PassportInterface.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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\Authenticator\Passport;
  11. use Symfony\Component\Security\Core\Exception\BadCredentialsException;
  12. use Symfony\Component\Security\Http\Authenticator\Passport\Badge\BadgeInterface;
  13. /**
  14. * A Passport contains all security-related information that needs to be
  15. * validated during authentication.
  16. *
  17. * A passport badge can be used to add any additional information to the
  18. * passport.
  19. *
  20. * @author Wouter de Jong <wouter@wouterj.nl>
  21. *
  22. * @experimental in 5.2
  23. */
  24. interface PassportInterface
  25. {
  26. /**
  27. * Adds a new security badge.
  28. *
  29. * A passport can hold only one instance of the same security badge.
  30. * This method replaces the current badge if it is already set on this
  31. * passport.
  32. *
  33. * @return $this
  34. */
  35. public function addBadge(BadgeInterface $badge): self;
  36. public function hasBadge(string $badgeFqcn): bool;
  37. public function getBadge(string $badgeFqcn): ?BadgeInterface;
  38. /**
  39. * Checks if all badges are marked as resolved.
  40. *
  41. * @throws BadCredentialsException when a badge is not marked as resolved
  42. */
  43. public function checkIfCompletelyResolved(): void;
  44. }