You are here

interface TfaContextInterface in Two-factor Authentication (TFA) 8

Provide context for the current login attempt.

Hierarchy

Expanded class hierarchy of TfaContextInterface

All classes that implement TfaContextInterface

File

src/TfaContextInterface.php, line 13

Namespace

Drupal\tfa
View source
interface TfaContextInterface {

  /**
   * TfaContextInterface constructor.
   *
   * @param \Drupal\tfa\TfaValidationPluginManager $tfa_validation_manager
   *   The plugin manager for TFA validation plugins.
   * @param \Drupal\tfa\TfaLoginPluginManager $tfa_plugin_manager
   *   The plugin manager for TFA login plugins.
   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
   *   The configuration service.
   * @param \Drupal\user\UserInterface $user
   *   The user currently attempting to log in.
   * @param \Drupal\user\UserDataInterface $user_data
   *   The user data service.
   * @param \Symfony\Component\HttpFoundation\Request $request
   *   The current request.
   */
  public function __construct(TfaValidationPluginManager $tfa_validation_manager, TfaLoginPluginManager $tfa_plugin_manager, ConfigFactoryInterface $config_factory, UserInterface $user, UserDataInterface $user_data, Request $request);

  /**
   * Get the user object.
   *
   * @return \Drupal\user\UserInterface
   *   The entity object of the user attempting to log in.
   */
  public function getUser();

  /**
   * Is TFA enabled and configured?
   *
   * @return bool
   *   Whether or not the TFA module is configured for use.
   */
  public function isModuleSetup();

  /**
   * Check whether $this->getUser() is required to use TFA.
   *
   * @return bool
   *   TRUE if $this->getUser() is required to use TFA.
   */
  public function isTfaRequired();

  /**
   * Check whether the Validation Plugin is set and ready for use.
   *
   * @return bool
   *   TRUE if Validation Plugin exists and is ready for use.
   */
  public function isReady();

  /**
   * Remaining number of allowed logins without setting up TFA.
   *
   * @return int|false
   *   FALSE if users are never allowed to log in without setting up TFA.
   *   The remaining number of times $this->getUser() may log in without setting
   *   up TFA.
   */
  public function remainingSkips();

  /**
   * Increment the count of $this->getUser() logins without setting up TFA.
   */
  public function hasSkipped();

  /**
   * Whether at least one plugin allows authentication.
   *
   * If any plugin returns TRUE then authentication is not interrupted by TFA.
   *
   * @return bool
   *   TRUE if login allowed otherwise FALSE.
   */
  public function pluginAllowsLogin();

  /**
   * Wrapper for user_login_finalize().
   */
  public function doUserLogin();

}

Members

Namesort descending Modifiers Type Description Overrides
TfaContextInterface::doUserLogin public function Wrapper for user_login_finalize(). 1
TfaContextInterface::getUser public function Get the user object. 1
TfaContextInterface::hasSkipped public function Increment the count of $this->getUser() logins without setting up TFA. 1
TfaContextInterface::isModuleSetup public function Is TFA enabled and configured? 1
TfaContextInterface::isReady public function Check whether the Validation Plugin is set and ready for use. 1
TfaContextInterface::isTfaRequired public function Check whether $this->getUser() is required to use TFA. 1
TfaContextInterface::pluginAllowsLogin public function Whether at least one plugin allows authentication. 1
TfaContextInterface::remainingSkips public function Remaining number of allowed logins without setting up TFA. 1
TfaContextInterface::__construct public function TfaContextInterface constructor. 1