Version 1
[yaffs-website] / web / core / modules / rest / tests / modules / rest_test / src / Authentication / Provider / TestAuthGlobal.php
diff --git a/web/core/modules/rest/tests/modules/rest_test/src/Authentication/Provider/TestAuthGlobal.php b/web/core/modules/rest/tests/modules/rest_test/src/Authentication/Provider/TestAuthGlobal.php
new file mode 100644 (file)
index 0000000..8ca9174
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+
+namespace Drupal\rest_test\Authentication\Provider;
+
+use Drupal\Core\Authentication\AuthenticationProviderInterface;
+use Symfony\Component\HttpFoundation\Request;
+
+/**
+ * Global authentication provider for testing purposes.
+ */
+class TestAuthGlobal implements AuthenticationProviderInterface {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function applies(Request $request) {
+    return $request->headers->has('REST-test-auth-global');
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function authenticate(Request $request) {
+    return NULL;
+  }
+
+}