You are here

public function JWKFetcherTest::getLocalJwks in Auth0 Single Sign On 8.2

Get a test JSON fixture instead of a remote one.

Parameters

string $domain Domain name of the JWKS.:

string $path Path to the JWKS.:

Return value

array

File

vendor/auth0/auth0-php/tests/Helpers/JWKFetcherTest.php, line 241

Class

JWKFetcherTest
Class JWKFetcherTest.

Namespace

Auth0\Tests\Helpers

Code

public function getLocalJwks($domain = '', $path = '') {

  // Normalize the domain to a file name.
  $domain = str_replace('https://', '', $domain);
  $domain = str_replace('http://', '', $domain);

  // Replace everything that isn't a letter, digit, or dash.
  $pattern = '/[^a-zA-Z1-9^-]/i';
  $file_append = preg_replace($pattern, '-', $domain) . preg_replace($pattern, '-', $path);

  // Get the test JSON file.
  $json_contents = file_get_contents(AUTH0_PHP_TEST_JSON_DIR . $file_append . '.json');
  return json_decode($json_contents, true);
}