You are here

public function TfaBasePlugin::__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 PluginBase::__construct

2 calls to TfaBasePlugin::__construct()
TfaRecoveryCode::__construct in src/Plugin/TfaValidation/TfaRecoveryCode.php
Constructs a new Tfa plugin object.
TfaTrustedBrowser::__construct in src/Plugin/TfaLogin/TfaTrustedBrowser.php
Constructs a new Tfa plugin object.
2 methods override TfaBasePlugin::__construct()
TfaRecoveryCode::__construct in src/Plugin/TfaValidation/TfaRecoveryCode.php
Constructs a new Tfa plugin object.
TfaTrustedBrowser::__construct in src/Plugin/TfaLogin/TfaTrustedBrowser.php
Constructs a new Tfa plugin object.

File

src/Plugin/TfaBasePlugin.php, line 101

Class

TfaBasePlugin
Base plugin class.

Namespace

Drupal\tfa\Plugin

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);

  // Default code length is 6.
  $this->codeLength = 6;
  $this->isValid = FALSE;

  // User Data service to store user-based data in key value pairs.
  $this->userData = $user_data;

  // Encryption profile manager and service.
  $encryptionProfileId = \Drupal::config('tfa.settings')
    ->get('encryption');
  $this->encryptionProfile = $encryption_profile_manager
    ->getEncryptionProfile($encryptionProfileId);
  $this->encryptService = $encrypt_service;
  $this->uid = $this->configuration['uid'];
}