You are here

public function TokenGetter::setTokenFromRequest in Access unpublished 8

Set the token from the current request.

Parameters

\Symfony\Component\HttpKernel\Event\GetResponseEvent $event: The request event.

File

src/TokenGetter.php, line 62

Class

TokenGetter
Service to handle the current token.

Namespace

Drupal\access_unpublished

Code

public function setTokenFromRequest(GetResponseEvent $event) {
  $tokenKey = $this->config
    ->get('hash_key');
  if ($event
    ->getRequest()->query
    ->has($tokenKey)) {
    $this
      ->setToken($event
      ->getRequest()->query
      ->get($tokenKey));
  }
}