please jshint
This commit is contained in:
parent
1e8c6e198c
commit
fc7e246704
@ -26,15 +26,15 @@ ApikeyAuth.prototype.verifyCredentials = function (callback) {
|
|||||||
|
|
||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isApiKeyFound(apikey)) {
|
if (isApiKeyFound(apikey)) {
|
||||||
if (!usernameMatches(apikey.user, this.username)) {
|
if (!usernameMatches(apikey.user, this.username)) {
|
||||||
const error = new Error('Forbidden');
|
const usernameError = new Error('Forbidden');
|
||||||
error.type = 'auth';
|
usernameError.type = 'auth';
|
||||||
error.subtype = 'api-key-username-mismatch';
|
usernameError.subtype = 'api-key-username-mismatch';
|
||||||
error.http_status = 403;
|
usernameError.http_status = 403;
|
||||||
|
|
||||||
return callback(error);
|
return callback(usernameError);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!apikey.grantsSql) {
|
if (!apikey.grantsSql) {
|
||||||
@ -46,12 +46,12 @@ ApikeyAuth.prototype.verifyCredentials = function (callback) {
|
|||||||
|
|
||||||
return callback(null, verifyRequest(this.apikey, this.apikey));
|
return callback(null, verifyRequest(this.apikey, this.apikey));
|
||||||
} else {
|
} else {
|
||||||
const error = new Error('Unauthorized');
|
const apiKeyNotFoundError = new Error('Unauthorized');
|
||||||
error.type = 'auth';
|
apiKeyNotFoundError.type = 'auth';
|
||||||
error.subtype = 'api-key-not-found';
|
apiKeyNotFoundError.subtype = 'api-key-not-found';
|
||||||
error.http_status = 401;
|
apiKeyNotFoundError.http_status = 401;
|
||||||
|
|
||||||
return callback(error);
|
return callback(apiKeyNotFoundError);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user