You are here

AccessTokenValue.php in Simple OAuth (OAuth2) & OpenID Connect 8

File

src/AccessTokenValue.php
View source
<?php

namespace Drupal\simple_oauth;

use Drupal\Component\Serialization\Json;
use Drupal\Component\Utility\Crypt;
use Drupal\Core\Site\Settings;
class AccessTokenValue implements AccessTokenValueInterface {

  /**
   * The entity values to digest.
   *
   * @var array
   */
  protected $values;

  /**
   * {@inheritdoc}
   */
  public function getValues() {
    return $this->values;
  }

  /**
   * {@inheritdoc}
   */
  public function setValues($values) {
    $this->values = $values;
  }

  /**
   * {@inheritdoc}
   */
  public static function createFromValues(array $values) {
    $token_value = new static();
    $token_value
      ->setValues($values);
    return $token_value;
  }

  /**
   * {@inheritdoc}
   */
  public function digest() {
    return Crypt::hmacBase64(Json::encode($this
      ->getValues()), Settings::getHashSalt());
  }

}

Classes

Namesort descending Description
AccessTokenValue