Version 1
[yaffs-website] / web / core / lib / Drupal / Core / Authentication / AuthenticationProviderFilterInterface.php
diff --git a/web/core/lib/Drupal/Core/Authentication/AuthenticationProviderFilterInterface.php b/web/core/lib/Drupal/Core/Authentication/AuthenticationProviderFilterInterface.php
new file mode 100644 (file)
index 0000000..9970e17
--- /dev/null
@@ -0,0 +1,35 @@
+<?php
+
+namespace Drupal\Core\Authentication;
+
+use Symfony\Component\HttpFoundation\Request;
+
+/**
+ * Restrict authentication methods to a subset of the site.
+ *
+ * Some authentication methods should not be available throughout a whole site.
+ * For instance, there are good reasons to restrict insecure methods like HTTP
+ * basic authentication or a URL token authentication method to API-only
+ * routes.
+ */
+interface AuthenticationProviderFilterInterface {
+
+  /**
+   * Checks whether the authentication method is allowed on a given route.
+   *
+   * While authentication itself is run before routing, this method is called
+   * after routing, hence RouteMatch is available and can be used to inspect
+   * route options.
+   *
+   * @param \Symfony\Component\HttpFoundation\Request $request
+   *   The request.
+   * @param bool $authenticated
+   *   Whether or not the request is authenticated.
+   *
+   * @return bool
+   *   TRUE if an authentication method is allowed on the request, otherwise
+   *   FALSE.
+   */
+  public function appliesToRoutedRequest(Request $request, $authenticated);
+
+}