From 05eb180d21aed3c9f0982d045317ac9793cb94d4 Mon Sep 17 00:00:00 2001 From: Nandan Sridhar Date: Fri, 17 May 2019 10:10:23 -0700 Subject: [PATCH 1/2] fix for b132970272 --- npm-shrinkwrap.json | 2 +- oauth/index.js | 2 +- oauthv2/index.js | 2 +- package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 07c97a7..28ac14a 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,5 +1,5 @@ { "name": "microgateway-plugins", - "version": "2.5.35", + "version": "2.5.36", "lockfileVersion": 1 } diff --git a/oauth/index.js b/oauth/index.js index 03e175d..8d8cd58 100644 --- a/oauth/index.js +++ b/oauth/index.js @@ -283,7 +283,7 @@ module.exports.init = function(config, logger, stats) { req.headers['x-authorization-claims'] = new Buffer(JSON.stringify(authClaims)).toString('base64'); if (apiKey) { - var cacheControl = req.headers['cache-control']; + var cacheControl = req.headers['cache-control'] || 'no-cache'; if (cacheKey || (!cacheControl || (cacheControl && cacheControl.indexOf('no-cache') < 0))) { // caching is allowed // default to now (in seconds) + 30m if not set decodedToken.exp = decodedToken.exp || +(((Date.now() / 1000) + 1800).toFixed(0)); diff --git a/oauthv2/index.js b/oauthv2/index.js index c738b79..bb036eb 100644 --- a/oauthv2/index.js +++ b/oauthv2/index.js @@ -330,4 +330,4 @@ function sendError(req, res, next, logger, stats, code, message) { stats.incrementStatusCount(res.statusCode); next(code, message); return code; -} \ No newline at end of file +} diff --git a/package.json b/package.json index 2eb02be..6a18a27 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "microgateway-plugins", - "version": "2.5.35", + "version": "2.5.36", "description": "Plugins for Apige Edge Microgateway", "main": "index.js", "scripts": { From 77530a3e6c6d0e1a4c2e85b28e0f6e5032dd070c Mon Sep 17 00:00:00 2001 From: Nandan Sridhar Date: Fri, 17 May 2019 14:36:07 -0700 Subject: [PATCH 2/2] fix for b132970272 --- apikeys/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apikeys/index.js b/apikeys/index.js index 8730579..7fb20bd 100644 --- a/apikeys/index.js +++ b/apikeys/index.js @@ -66,7 +66,7 @@ module.exports.init = function(config, logger, stats) { } var exchangeApiKeyForToken = function(req, res, next, config, logger, stats, middleware, apiKey) { - var cacheControl = req.headers["cache-control"] || 'no-control'; + var cacheControl = req.headers["cache-control"] || 'no-cache'; if (cacheKey || (cacheControl && cacheControl.indexOf("no-cache") < 0)) { // caching is allowed cache.read(apiKey, function(err, value) { if (value) { @@ -193,7 +193,7 @@ module.exports.init = function(config, logger, stats) { req.headers["x-authorization-claims"] = new Buffer(JSON.stringify(authClaims)).toString("base64"); if (apiKey) { - var cacheControl = req.headers["cache-control"]; + var cacheControl = req.headers["cache-control"] || "no-cache"; if (cacheKey || (cacheControl && cacheControl.indexOf("no-cache") < 0)) { // caching is toFixed // default to now (in seconds) + 30m if not set decodedToken.exp = decodedToken.exp || +(((Date.now() / 1000) + 1800).toFixed(0));