You are here

public function TfaTrustedBrowser::__construct in Two-factor Authentication (TFA) 8

Constructs a new Tfa plugin object.

Parameters

array $configuration: The plugin configuration.

string $plugin_id: The plugin id.

mixed $plugin_definition: The plugin definition.

\Drupal\user\UserDataInterface $user_data: User data object to store user specific information.

\Drupal\encrypt\EncryptionProfileManagerInterface $encryption_profile_manager: Encryption profile manager.

\Drupal\encrypt\EncryptServiceInterface $encrypt_service: Encryption service.

Overrides TfaBasePlugin::__construct

File

src/Plugin/TfaLogin/TfaTrustedBrowser.php, line 51

Class

TfaTrustedBrowser
Trusted browser validation class.

Namespace

Drupal\tfa\Plugin\TfaLogin

Code

public function __construct(array $configuration, $plugin_id, $plugin_definition, UserDataInterface $user_data, EncryptionProfileManagerInterface $encryption_profile_manager, EncryptServiceInterface $encrypt_service) {
  parent::__construct($configuration, $plugin_id, $plugin_definition, $user_data, $encryption_profile_manager, $encrypt_service);
  $config = \Drupal::config('tfa.settings');
  $this->cookieName = $config
    ->get('cookie_name') ?: 'TFA';

  // Expiration defaults to 30 days.
  $this->expiration = $config
    ->get('trust_cookie_expiration') ?: 86400 * 30;
  $this->userData = $user_data;
}