You are here

public static function Utility::getKeys in OAuth2 Server 8

Same name and namespace in other branches
  1. 2.0.x src/Utility.php \Drupal\oauth2_server\Utility::getKeys()

Returns the pair of private and public keys used to sign tokens.

Return value

array An array with the following keys:

  • private_key: The private key.
  • public_key: The public key certificate (PEM encoded X.509).

See also

oauth2_server_generate_keys()

3 calls to Utility::getKeys()
OAuth2Controller::certificates in src/Controller/OAuth2Controller.php
Certificates.
OAuth2Storage::getPrivateKey in src/OAuth2Storage.php
Get private key.
OAuth2Storage::getPublicKey in src/OAuth2Storage.php
Get public key.

File

src/Utility.php, line 96

Class

Utility
Contains utility methods for the OAuth2 Server.

Namespace

Drupal\oauth2_server

Code

public static function getKeys() {
  $keys = \Drupal::state()
    ->get('oauth2_server.keys', FALSE);
  if (!$keys) {
    $keys = static::generateKeys();
    \Drupal::state()
      ->set('oauth2_server.keys', $keys);
  }
  return $keys;
}