public function GALoginTotpValidation::__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 GALoginTotpValidation::__construct()
- GALoginTotpSetup::__construct in src/
Plugin/ TfaSetup/ GALoginTotpSetup.php - Constructs a new Tfa plugin object.
1 method overrides GALoginTotpValidation::__construct()
- GALoginTotpSetup::__construct in src/
Plugin/ TfaSetup/ GALoginTotpSetup.php - Constructs a new Tfa plugin object.
File
- src/
Plugin/ TfaValidation/ GALoginTotpValidation.php, line 86
Class
- GALoginTotpValidation
- TOTP validation class for performing TOTP validation.
Namespace
Drupal\ga_login\Plugin\TfaValidationCode
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();
// Allow codes within tolerance range of 2 * 30 second units.
$plugin_settings = $config_factory
->get('tfa.settings')
->get('validation_plugin_settings');
$settings = isset($plugin_settings['ga_login_totp']) ? $plugin_settings['ga_login_totp'] : [];
$settings = array_replace([
'time_skew' => 2,
'site_name_prefix' => TRUE,
'name_prefix' => 'TFA',
'issuer' => 'Drupal',
], $settings);
$this->timeSkew = $settings['time_skew'];
$this->siteNamePrefix = $settings['site_name_prefix'];
$this->namePrefix = $settings['name_prefix'];
$this->issuer = $settings['issuer'];
$this->alreadyAccepted = FALSE;
$this->time = $time;
}