AuthenticationProviderFilterInterface.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace Drupal\Core\Authentication;
  3. use Symfony\Component\HttpFoundation\Request;
  4. /**
  5. * Restrict authentication methods to a subset of the site.
  6. *
  7. * Some authentication methods should not be available throughout a whole site.
  8. * For instance, there are good reasons to restrict insecure methods like HTTP
  9. * basic authentication or a URL token authentication method to API-only
  10. * routes.
  11. */
  12. interface AuthenticationProviderFilterInterface {
  13. /**
  14. * Checks whether the authentication method is allowed on a given route.
  15. *
  16. * While authentication itself is run before routing, this method is called
  17. * after routing, hence RouteMatch is available and can be used to inspect
  18. * route options.
  19. *
  20. * @param \Symfony\Component\HttpFoundation\Request $request
  21. * The request.
  22. * @param bool $authenticated
  23. * Whether or not the request is authenticated.
  24. *
  25. * @return bool
  26. * TRUE if an authentication method is allowed on the request, otherwise
  27. * FALSE.
  28. */
  29. public function appliesToRoutedRequest(Request $request, $authenticated);
  30. }