Version 1
[yaffs-website] / web / core / modules / locale / tests / modules / early_translation_test / src / Auth.php
1 <?php
2
3 namespace Drupal\early_translation_test;
4
5 use Drupal\Core\Authentication\AuthenticationProviderInterface;
6 use Drupal\Core\Entity\EntityManagerInterface;
7 use Symfony\Component\HttpFoundation\Request;
8
9 /**
10  * Test authentication provider.
11  */
12 class Auth implements AuthenticationProviderInterface {
13
14   /**
15    * The user storage.
16    *
17    * @var \Drupal\user\UserStorageInterface
18    */
19   protected $userStorage;
20
21   /**
22    * Constructs an authentication provider object.
23    *
24    * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
25    *   The entity manager service.
26    */
27   public function __construct(EntityManagerInterface $entity_manager) {
28     // Authentication providers are called early during in the bootstrap.
29     // Getting the user storage used to result in a circular reference since
30     // translation involves a call to \Drupal\locale\LocaleLookup that tries to
31     // get the user roles.
32     // @see https://www.drupal.org/node/2241461
33     $this->userStorage = $entity_manager->getStorage('user');
34   }
35
36   /**
37    * {@inheritdoc}
38    */
39   public function applies(Request $request) {
40     return FALSE;
41   }
42
43   /**
44    * {@inheritdoc}
45    */
46   public function authenticate(Request $request) {
47     return NULL;
48   }
49
50 }