Fix error message on missing requested signature

We don't really distinguish between missing or non-authorizing
signature. And that's fine. See #170
This commit is contained in:
Sandro Santilli 2014-03-03 18:13:06 +01:00
parent 40a254922a
commit 30eb939dc7
3 changed files with 4 additions and 8 deletions

View File

@ -4,7 +4,7 @@
Enhancements:
- Set statsd prefix for all endpoints
- Raise 403 forbidden on attempt to access map tiles waiving
- Respond with a permission denied on attempt to access map tiles waiving
signature of someone who had not left any (#170)
1.8.4 -- 2014-03-03

View File

@ -654,11 +654,7 @@ module.exports = function(){
}
// if signer name was given, return no authorization
err = new Error("No authorization left by '"
+ req.params.signer + "' on map '"
+ req.params.token + "'");
err.http_status = 403;
callback(err);
callback(null, false);
return;
}

View File

@ -138,10 +138,10 @@ suite('multilayer', function() {
headers: {host: 'localhost' },
encoding: 'binary'
}, {}, function(res) {
assert.equal(res.statusCode, 403, res.statusCode + ':' + res.body);
assert.equal(res.statusCode, 401, res.statusCode + ':' + res.body);
var parsed = JSON.parse(res.body);
var msg = parsed.error; // TODO: should it be "errors" ?
assert.ok(msg.match(/no authorization left/i), msg);
assert.ok(msg.match(/permission denied/i), msg);
next(err);
});
},