You are here

public function Storage::setJti in OAuth2 Server 7

File

lib/Drupal/oauth2_server/Storage.php, line 279

Class

Storage
Provides Drupal storage (through the underlying Entity API) for the library.

Namespace

Drupal\oauth2_server

Code

public function setJti($client_key, $subject, $audience, $expires, $jti) {
  $client = oauth2_server_client_load($client_key);
  if (!$client) {

    // The client_key should be validated prior to this method being called,
    // but the library doesn't do that currently.
    return;
  }

  // The audience is not stored because it's always previously validated
  // to match the server's token endpoint url. Therefore, it is redundant.
  db_insert('oauth2_server_jti')
    ->fields(array(
    'client_id' => $client->client_id,
    'subject' => $subject,
    'jti' => $jti,
    'expires' => $expires,
  ))
    ->execute();
}