3 namespace Drupal\early_translation_test;
5 use Drupal\Core\Authentication\AuthenticationProviderInterface;
6 use Drupal\Core\Entity\EntityManagerInterface;
7 use Symfony\Component\HttpFoundation\Request;
10 * Test authentication provider.
12 class Auth implements AuthenticationProviderInterface {
17 * @var \Drupal\user\UserStorageInterface
19 protected $userStorage;
22 * Constructs an authentication provider object.
24 * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
25 * The entity manager service.
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');
39 public function applies(Request $request) {
46 public function authenticate(Request $request) {