Skip to content

Commit

Permalink
Merge pull request #111 from apigee/b134672029-2
Browse files Browse the repository at this point in the history
B134672029
  • Loading branch information
theganyo authored Jun 7, 2019
2 parents b8dadd5 + b12df97 commit 5b861d9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 11 additions & 7 deletions oauthv2/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,17 @@ module.exports.init = function(config, logger, stats) {
}
} else {
debug('token not found in cache');
if (keys) {
debug('using jwk');
var pem = getPEM(decodedToken, keys);
isValid = JWS.verifyJWT(oauthtoken, pem, acceptField);
} else {
debug('validating jwt');
isValid = JWS.verifyJWT(oauthtoken, config.public_key, acceptField);
try {
if (keys) {
debug('using jwk');
var pem = getPEM(decodedToken, keys);
isValid = JWS.verifyJWT(oauthtoken, pem, acceptField);
} else {
debug('validating jwt');
isValid = JWS.verifyJWT(oauthtoken, config.public_key, acceptField);
}
} catch (error) {
console.warn('error parsing jwt: ' + oauthtoken);
}
}
if (!isValid) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "microgateway-plugins",
"version": "2.5.38",
"version": "2.5.39",
"description": "Plugins for Apige Edge Microgateway",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 5b861d9

Please sign in to comment.