AuthenticationProviderInterface.php 926 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace Drupal\Core\Authentication;
  3. use Symfony\Component\HttpFoundation\Request;
  4. /**
  5. * Interface for authentication providers.
  6. */
  7. interface AuthenticationProviderInterface {
  8. /**
  9. * Checks whether suitable authentication credentials are on the request.
  10. *
  11. * @param \Symfony\Component\HttpFoundation\Request $request
  12. * The request object.
  13. *
  14. * @return bool
  15. * TRUE if authentication credentials suitable for this provider are on the
  16. * request, FALSE otherwise.
  17. */
  18. public function applies(Request $request);
  19. /**
  20. * Authenticates the user.
  21. *
  22. * @param \Symfony\Component\HttpFoundation\Request|null $request
  23. * The request object.
  24. *
  25. * @return \Drupal\Core\Session\AccountInterface|null
  26. * AccountInterface - in case of a successful authentication.
  27. * NULL - in case where authentication failed.
  28. */
  29. public function authenticate(Request $request);
  30. }