AuthenticationCollectorInterface.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace Drupal\Core\Authentication;
  3. /**
  4. * Interface for collectors of registered authentication providers.
  5. */
  6. interface AuthenticationCollectorInterface {
  7. /**
  8. * Adds a provider to the array of registered providers.
  9. *
  10. * @param \Drupal\Core\Authentication\AuthenticationProviderInterface $provider
  11. * The provider object.
  12. * @param string $provider_id
  13. * Identifier of the provider.
  14. * @param int $priority
  15. * (optional) The provider's priority.
  16. * @param bool $global
  17. * (optional) TRUE if the provider is to be applied globally on all routes.
  18. * Defaults to FALSE.
  19. */
  20. public function addProvider(AuthenticationProviderInterface $provider, $provider_id, $priority = 0, $global = FALSE);
  21. /**
  22. * Returns whether a provider is considered global.
  23. *
  24. * @param string $provider_id
  25. * The provider ID.
  26. *
  27. * @return bool
  28. * TRUE if the provider is global, FALSE otherwise.
  29. *
  30. * @see \Drupal\Core\Authentication\AuthenticationCollectorInterface::addProvider
  31. */
  32. public function isGlobal($provider_id);
  33. /**
  34. * Returns an authentication provider.
  35. *
  36. * @param string $provider_id
  37. * The provider ID.
  38. *
  39. * @return \Drupal\Core\Authentication\AuthenticationProviderInterface|null
  40. * The authentication provider which matches the ID.
  41. */
  42. public function getProvider($provider_id);
  43. /**
  44. * Returns the sorted array of authentication providers.
  45. *
  46. * @return \Drupal\Core\Authentication\AuthenticationProviderInterface[]
  47. * An array of authentication provider objects.
  48. */
  49. public function getSortedProviders();
  50. }