getUserFromSession example

if (!$applies && $request->query->has('check_logged_in')) {
      $domain = ltrim(ini_get('session.cookie_domain'), '.') ?: $request->getHttpHost();
      $this->messenger->addMessage($this->t('To log in to this site, your browser must accept cookies from the domain %domain.', ['%domain' => $domain]), 'error');
    }
    return $applies;
  }

  /** * {@inheritdoc} */
  public function authenticate(Request $request) {
    return $this->getUserFromSession($request->getSession());
  }

  /** * Returns the UserSession object for the given session. * * @param \Symfony\Component\HttpFoundation\Session\SessionInterface $session * The session. * * @return \Drupal\Core\Session\AccountInterface|null * The UserSession object for the current user, or NULL if this is an * anonymous session. */
Home | Imprint | This part of the site doesn't use cookies.