You are here

public function GALoginHotpValidation::__construct in Google Authenticator login 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

1 call to GALoginHotpValidation::__construct()
GALoginHotpSetup::__construct in src/Plugin/TfaSetup/GALoginHotpSetup.php
Constructs a new Tfa plugin object.
1 method overrides GALoginHotpValidation::__construct()
GALoginHotpSetup::__construct in src/Plugin/TfaSetup/GALoginHotpSetup.php
Constructs a new Tfa plugin object.

File

src/Plugin/TfaValidation/GALoginHotpValidation.php, line 86

Class

GALoginHotpValidation
HOTP validation class for performing HOTP validation.

Namespace

Drupal\ga_login\Plugin\TfaValidation

Code

public function __construct(array $configuration, $plugin_id, $plugin_definition, UserDataInterface $user_data, EncryptionProfileManagerInterface $encryption_profile_manager, EncryptServiceInterface $encrypt_service, ConfigFactoryInterface $config_factory, TimeInterface $time) {
  parent::__construct($configuration, $plugin_id, $plugin_definition, $user_data, $encryption_profile_manager, $encrypt_service);
  $this->auth = new \StdClass();
  $this->auth->otp = new Otp();
  $this->auth->ga = new GoogleAuthenticator();
  $plugin_settings = $config_factory
    ->get('tfa.settings')
    ->get('validation_plugin_settings');
  $settings = isset($plugin_settings['ga_login_hotp']) ? $plugin_settings['ga_login_hotp'] : [];
  $settings = array_replace([
    'counter_window' => 10,
    'site_name_prefix' => TRUE,
    'name_prefix' => 'TFA',
    'issuer' => 'Drupal',
  ], $settings);
  $this->counterWindow = $settings['counter_window'];
  $this->siteNamePrefix = $settings['site_name_prefix'];
  $this->namePrefix = $settings['name_prefix'];
  $this->issuer = $settings['issuer'];
  $this->alreadyAccepted = FALSE;
  $this->time = $time;
}