use for compatibility res.locals.api_key instead of res.locals.apikeyToken

This commit is contained in:
Eneko Lakasta 2018-02-15 15:19:09 +01:00
parent 140441b777
commit fc420c2c0f
3 changed files with 3 additions and 4 deletions

View File

@ -59,7 +59,7 @@ function isValidApiKey(apikey) {
// NOTE: authorized is expected to be 0 or 1 (integer) // NOTE: authorized is expected to be 0 or 1 (integer)
// //
AuthApi.prototype.authorizedByAPIKey = function(user, res, callback) { AuthApi.prototype.authorizedByAPIKey = function(user, res, callback) {
const apikeyToken = res.locals.apikeyToken; const apikeyToken = res.locals.api_key;
if ( ! apikeyToken ) { if ( ! apikeyToken ) {
return callback(null, false); // no api key, no authorization... return callback(null, false); // no api key, no authorization...

View File

@ -31,7 +31,7 @@ PgConnection.prototype.setDBAuth = function(username, params, apikeyType, callba
return callback(); return callback();
}); });
} else if (apikeyType === 'regular') { } else if (apikeyType === 'regular') {
this.metadataBackend.getApikey(username, params.apikeyToken, (err, apikey) => { this.metadataBackend.getApikey(username, params.api_key, (err, apikey) => {
if (err) { if (err) {
return callback(err); return callback(err);
} }

View File

@ -3,7 +3,6 @@
const getApikeyTokenFromRequest = require('../lib/get_api_key_token_from_request'); const getApikeyTokenFromRequest = require('../lib/get_api_key_token_from_request');
module.exports = () => function apikeyTokenMiddleware(req, res, next) { module.exports = () => function apikeyTokenMiddleware(req, res, next) {
res.locals.apikeyToken = getApikeyTokenFromRequest(req); res.locals.api_key = getApikeyTokenFromRequest(req);
return next(); return next();
}; };