You are here

public function AuthenticationManager::authenticate in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Authentication/AuthenticationManager.php \Drupal\Core\Authentication\AuthenticationManager::authenticate()
  2. 10 core/lib/Drupal/Core/Authentication/AuthenticationManager.php \Drupal\Core\Authentication\AuthenticationManager::authenticate()

Authenticates the user.

Parameters

\Symfony\Component\HttpFoundation\Request|null $request: The request object.

Return value

\Drupal\Core\Session\AccountInterface|null AccountInterface - in case of a successful authentication. NULL - in case where authentication failed.

Overrides AuthenticationProviderInterface::authenticate

File

core/lib/Drupal/Core/Authentication/AuthenticationManager.php, line 47

Class

AuthenticationManager
Manager for authentication.

Namespace

Drupal\Core\Authentication

Code

public function authenticate(Request $request) {
  $provider_id = $this
    ->getProvider($request);
  $provider = $this->authCollector
    ->getProvider($provider_id);
  if ($provider) {
    return $provider
      ->authenticate($request);
  }
  return NULL;
}