You are here

public function AnonymousCsrfTokenGenerator::__construct in Anonymous CSRF Token 2.x

Constructs the token generator.

Parameters

\Drupal\Core\PrivateKey $private_key: The private key service.

\Drupal\Core\Session\MetadataBag $session_metadata: The session metadata bag.

\Symfony\Component\HttpFoundation\Session\SessionInterface $session: The session.

\Drupal\Core\Config\ConfigFactoryInterface $config_factory: The factory for configuration objects.

\Drupal\Core\Session\AccountProxyInterface $account_proxy: The account proxy.

Overrides CsrfTokenGenerator::__construct

File

src/Access/AnonymousCsrfTokenGenerator.php, line 54

Class

AnonymousCsrfTokenGenerator
Class AnonymousCsrfTokenGenerator.

Namespace

Drupal\anonymous_token\Access

Code

public function __construct(PrivateKey $private_key, MetadataBag $session_metadata, SessionInterface $session, ConfigFactoryInterface $config_factory, AccountProxyInterface $account_proxy) {
  parent::__construct($private_key, $session_metadata);
  $this->session = $session;
  $this->config = $config_factory
    ->get('anonymous_token.settings');
  $this->currentUser = $account_proxy;
}