You are here

interface KeyAuthInterface in Key auth 8

Interface KeyAuthInterface.

Hierarchy

Expanded class hierarchy of KeyAuthInterface

All classes that implement KeyAuthInterface

3 files declare their use of KeyAuthInterface
DisallowKeyAuthRequests.php in src/PageCache/DisallowKeyAuthRequests.php
KeyAuth.php in src/Authentication/Provider/KeyAuth.php
UserKeyAuthForm.php in src/Form/UserKeyAuthForm.php

File

src/KeyAuthInterface.php, line 11

Namespace

Drupal\key_auth
View source
interface KeyAuthInterface {

  /**
   * Get the key provided in the current request.
   *
   * @param \Symfony\Component\HttpFoundation\Request $request
   *   The current request.
   *
   * @return string|false
   *   The API key provided in the request, or FALSE if there was not one.
   */
  public function getKey(Request $request);

  /**
   * Load the user associated with a given key.
   *
   * @param string $key
   *   The API key to match to a user.
   *
   * @return \Drupal\user\Entity\User|null
   *   The matching user entity, or NULL if there was no match.
   */
  public function getUserByKey($key);

  /**
   * Determine if a user has access to use key authentication.
   *
   * @param \Drupal\user\UserInterface $user
   *   The user being authenticated.
   *
   * @return bool
   *   TRUE if the user has access, otherwise FALSE.
   */
  public function access(UserInterface $user);

  /**
   * Generate a new unique key.
   *
   * @return string
   *   An API key.
   */
  public function generateKey();

}

Members

Namesort descending Modifiers Type Description Overrides
KeyAuthInterface::access public function Determine if a user has access to use key authentication. 1
KeyAuthInterface::generateKey public function Generate a new unique key. 1
KeyAuthInterface::getKey public function Get the key provided in the current request. 1
KeyAuthInterface::getUserByKey public function Load the user associated with a given key. 1