public function AuthenticationSubscriber::onKernelRequestAuthenticate in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/EventSubscriber/AuthenticationSubscriber.php \Drupal\Core\EventSubscriber\AuthenticationSubscriber::onKernelRequestAuthenticate()
Authenticates user on request.
Parameters
\Symfony\Component\HttpKernel\Event\RequestEvent $event: The request event.
See also
\Drupal\Core\Authentication\AuthenticationProviderInterface::authenticate()
File
- core/
lib/ Drupal/ Core/ EventSubscriber/ AuthenticationSubscriber.php, line 73
Class
- AuthenticationSubscriber
- Authentication subscriber.
Namespace
Drupal\Core\EventSubscriberCode
public function onKernelRequestAuthenticate(RequestEvent $event) {
if ($event
->isMainRequest()) {
$request = $event
->getRequest();
if ($this->authenticationProvider
->applies($request)) {
$account = $this->authenticationProvider
->authenticate($request);
if ($account) {
$this->accountProxy
->setAccount($account);
return;
}
}
}
}