You are here

interface UsersJwtKeyRepositoryInterface in JSON Web Token Authentication (JWT) 8

Interface UsersJwtKeyRepositoryInterface

This extends \ArrayAccess so that the repository service can be passed as the $key argument to \Firebase\JWT\JWT::decode().

Hierarchy

Expanded class hierarchy of UsersJwtKeyRepositoryInterface

All classes that implement UsersJwtKeyRepositoryInterface

5 files declare their use of UsersJwtKeyRepositoryInterface
KeyListController.php in modules/users_jwt/src/Controller/KeyListController.php
UsersGenerateKeyForm.php in modules/users_jwt/src/Form/UsersGenerateKeyForm.php
UsersJwtAuth.php in modules/users_jwt/src/Authentication/Provider/UsersJwtAuth.php
UsersKeyDeleteForm.php in modules/users_jwt/src/Form/UsersKeyDeleteForm.php
UsersKeyForm.php in modules/users_jwt/src/Form/UsersKeyForm.php

File

modules/users_jwt/src/UsersJwtKeyRepositoryInterface.php, line 11

Namespace

Drupal\users_jwt
View source
interface UsersJwtKeyRepositoryInterface extends \ArrayAccess {

  /**
   * Get a user key by key ID.
   *
   * @param string $id
   *   The unique ID of the key.
   *
   * @return \Drupal\users_jwt\UsersKey|null
   *   Key data object, or NULL if no matching key was found.
   */
  public function getKey($id) : ?UsersKey;

  /**
   * Save a key for a user account.
   *
   * @param int $uid
   *   The user account ID the data is associated with.
   * @param string $id
   *   The unique name of the key.
   * @param string $alg
   *   The JWT algorithm to use. e.g. 'RS256'.
   * @param string $pubkey
   *   The value to store.
   *
   * @return \Drupal\users_jwt\UsersKey
   *   The values of the key that were saved.
   *
   * @throws \InvalidArgumentException If the $id is empty or used by another user (i.e. not unique).
   */
  public function saveKey($uid, $id, $alg, $pubkey) : UsersKey;

  /**
   * Delete one key.
   *
   * @param string $id
   *   The key ID.
   */
  public function deleteKey($id);

  /**
   * Delete all keys for one user.
   *
   * @param int $uid
   *   The user ID.
   */
  public function deleteUsersKeys($uid);

  /**
   * Return all keys for one user.
   *
   * @param int $uid
   *   The user ID.
   *
   * @return array
   *   The key objects, indexed by key ID.
   */
  public function getUsersKeys($uid) : array;

  /**
   * Get options for supported algorithms.
   *
   * @return \Drupal\Core\StringTranslation\TranslatableMarkup[]
   *   Keys are JWT alg options, value is localized string object.
   */
  public function algorithmOptions() : array;

  /**
   * Extends \ArrayAccess::offsetGet().
   *
   * @param string $id
   *   A key ID.
   *
   * @return string|null
   *   The public key for a key ID, or null if there is no such key.
   */
  public function offsetGet($id);

}

Members

Namesort descending Modifiers Type Description Overrides
UsersJwtKeyRepositoryInterface::algorithmOptions public function Get options for supported algorithms. 1
UsersJwtKeyRepositoryInterface::deleteKey public function Delete one key. 1
UsersJwtKeyRepositoryInterface::deleteUsersKeys public function Delete all keys for one user. 1
UsersJwtKeyRepositoryInterface::getKey public function Get a user key by key ID. 1
UsersJwtKeyRepositoryInterface::getUsersKeys public function Return all keys for one user. 1
UsersJwtKeyRepositoryInterface::offsetGet public function Extends \ArrayAccess::offsetGet(). 1
UsersJwtKeyRepositoryInterface::saveKey public function Save a key for a user account. 1