You are here

public function JWKFetcher::requestJwkX5c in Auth0 Single Sign On 8.2

Fetch x509 cert for RS256 token decoding.

Parameters

string $jwks_url URL to the JWKS.:

string|null $kid Key ID to use; returns first JWK if $kid is null or empty.:

Return value

string|null - Null if an x5c key could not be found for a key ID or if the JWKS is empty/invalid.

Deprecated

5.6.0, use $this->getKeys().

File

vendor/auth0/auth0-php/src/Helpers/JWKFetcher.php, line 108

Class

JWKFetcher
Class JWKFetcher.

Namespace

Auth0\SDK\Helpers

Code

public function requestJwkX5c($jwks_url, $kid = null) {
  $cache_key = $jwks_url . '|' . $kid;
  $x5c = $this->cache
    ->get($cache_key);
  if (!is_null($x5c)) {
    return $x5c;
  }
  $jwks = $this
    ->requestJwks($jwks_url);
  $jwk = $this
    ->findJwk($jwks, $kid);
  if ($this
    ->subArrayHasEmptyFirstItem($jwk, 'x5c')) {
    return null;
  }
  $x5c = $this
    ->convertCertToPem($jwk['x5c'][0]);
  $this->cache
    ->set($cache_key, $x5c);
  return $x5c;
}