Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: Add support for ES256 algorithm #256

Merged
merged 10 commits into from
Feb 24, 2020
Merged

RFC: Add support for ES256 algorithm #256

merged 10 commits into from
Feb 24, 2020

Conversation

bshaffer
Copy link
Collaborator

@bshaffer bshaffer commented Nov 5, 2019

Allows verification of EC256 algorithm (see #251).

example:

$http = new GuzzleHttp\Client();
$response = $http->request('GET', 'https://www.gstatic.com/iap/verify/public_key', []);

// Create an array of keys from the gstatic URL
$keys = json_decode((string) $response->getBody(), true);

// Validate the signature using the key set and ES256 algorithm.
try {
    $jwt = FirebaseJWT::decode($jwt, $keys, ['ES256']);
} catch (\Exception $e) {
    return print("Failed to validate JWT: " . $e->getMessage() . PHP_EOL);
}

// Token contains issuer, audience, etc.
assert($jwt->iss == 'https://cloud.google.com/iap');
assert($jwt->aud == $expected_audience);

@bshaffer bshaffer changed the title RFC: Add support for EC256 algorithm RFC: Add support for ES256 algorithm Feb 12, 2020
@bshaffer
Copy link
Collaborator Author

Actually implements support for #239

@bshaffer bshaffer merged commit 4566062 into master Feb 24, 2020
@bshaffer bshaffer deleted the add-ec256 branch February 24, 2020 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants