use for compatibility res.locals.api_key instead of res.locals.apikeyToken
This commit is contained in:
parent
140441b777
commit
fc420c2c0f
@ -59,7 +59,7 @@ function isValidApiKey(apikey) {
|
||||
// NOTE: authorized is expected to be 0 or 1 (integer)
|
||||
//
|
||||
AuthApi.prototype.authorizedByAPIKey = function(user, res, callback) {
|
||||
const apikeyToken = res.locals.apikeyToken;
|
||||
const apikeyToken = res.locals.api_key;
|
||||
|
||||
if ( ! apikeyToken ) {
|
||||
return callback(null, false); // no api key, no authorization...
|
||||
|
@ -31,7 +31,7 @@ PgConnection.prototype.setDBAuth = function(username, params, apikeyType, callba
|
||||
return callback();
|
||||
});
|
||||
} else if (apikeyType === 'regular') {
|
||||
this.metadataBackend.getApikey(username, params.apikeyToken, (err, apikey) => {
|
||||
this.metadataBackend.getApikey(username, params.api_key, (err, apikey) => {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
@ -3,7 +3,6 @@
|
||||
const getApikeyTokenFromRequest = require('../lib/get_api_key_token_from_request');
|
||||
|
||||
module.exports = () => function apikeyTokenMiddleware(req, res, next) {
|
||||
res.locals.apikeyToken = getApikeyTokenFromRequest(req);
|
||||
|
||||
res.locals.api_key = getApikeyTokenFromRequest(req);
|
||||
return next();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user