Skip to content

Commit

Permalink
Merge pull request 1EdTech#46 from packbackbooks/dependabot/composer/…
Browse files Browse the repository at this point in the history
…firebase/php-jwt-tw-5.2or-tw-6.0

Update firebase/php-jwt requirement from ^5.2 to ^5.2 || ^6.0
  • Loading branch information
dbhynds authored Apr 12, 2022
2 parents d521301 + f5e59f7 commit 135b4e1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require __DIR__.'/vendor/autoload.php';

return (new \MattAllan\LaravelCodeStyle\Config())
return (new \Jubeki\LaravelCodeStyle\Config())
->setFinder(
\PhpCsFixer\Finder::create()
->exclude(['bootstrap', 'docker', 'public', 'resources', 'storage'])
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
}
],
"require": {
"firebase/php-jwt": "^5.2",
"firebase/php-jwt": "^5.5|^6.0",
"guzzlehttp/guzzle": "^7.0",
"phpseclib/phpseclib": "^2.0"
},
"require-dev": {
"matt-allan/laravel-code-style": "dev-main",
"jubeki/laravel-code-style": "^1.0",
"mockery/mockery": "^1.4",
"nesbot/carbon": "^2.43",
"phpunit/phpunit": "^9.5"
Expand Down
16 changes: 9 additions & 7 deletions src/LtiMessageLaunch.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,13 +286,15 @@ private function getPublicKey()
foreach ($publicKeySet['keys'] as $key) {
if ($key['kid'] == $this->jwt['header']['kid']) {
try {
return openssl_pkey_get_details(
JWK::parseKeySet([
'keys' => [$key],
])[$key['kid']]
);
$keySet = JWK::parseKeySet([
'keys' => [$key],
]);
} catch (\Exception $e) {
return false;
// Do nothing
}

if (isset($keySet[$key['kid']])) {
return $keySet[$key['kid']];
}
}
}
Expand Down Expand Up @@ -385,7 +387,7 @@ private function validateJwtSignature()

// Validate JWT signature
try {
JWT::decode($this->request['id_token'], $public_key['key'], ['RS256']);
JWT::decode($this->request['id_token'], $public_key, ['RS256']);
} catch (ExpiredException $e) {
// Error validating signature.
throw new LtiException(static::ERR_INVALID_SIGNATURE);
Expand Down

0 comments on commit 135b4e1

Please sign in to comment.