You are here

class UsersKey in JSON Web Token Authentication (JWT) 8

Class UsersKey

A simple data object.

Hierarchy

Expanded class hierarchy of UsersKey

3 files declare their use of UsersKey
UsersGenerateKeyForm.php in modules/users_jwt/src/Form/UsersGenerateKeyForm.php
UsersJwtAuth.php in modules/users_jwt/src/Authentication/Provider/UsersJwtAuth.php
UsersKeyForm.php in modules/users_jwt/src/Form/UsersKeyForm.php

File

modules/users_jwt/src/UsersKey.php, line 10

Namespace

Drupal\users_jwt
View source
class UsersKey {

  /**
   * The user ID.
   *
   * @var int
   */
  public $uid;

  /**
   * The key ID.
   *
   * @var string
   */
  public $id;

  /**
   * The key algorithm.
   *
   * @var string
   */
  public $alg;

  /**
   * The public key.
   *
   * @var string
   */
  public $pubkey;

  /**
   * UsersKey constructor.
   *
   * @param int $uid
   *   A user ID.
   * @param string $id
   *   A key ID.
   * @param string $alg
   *   A key algorithm like RS256.
   * @param string $pubkey
   *   The value of a public key, e.g. RSA or Ed25519.
   */
  public function __construct($uid = NULL, $id = NULL, $alg = NULL, $pubkey = NULL) {
    if ($uid) {
      $this->uid = (int) $uid;
    }
    if ($id) {
      $this->id = trim((string) $id);
    }
    if ($alg) {
      $this->alg = trim((string) $alg);
    }
    if ($pubkey) {
      $this->pubkey = trim((string) $pubkey);
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
UsersKey::$alg public property The key algorithm.
UsersKey::$id public property The key ID.
UsersKey::$pubkey public property The public key.
UsersKey::$uid public property The user ID.
UsersKey::__construct public function UsersKey constructor.