modif comtabilite
This commit is contained in:
+12
-15
@@ -116,11 +116,14 @@ module.exports = {
|
||||
}
|
||||
assert.object(options, 'options');
|
||||
assert.arrayOfString(options.headers, 'options.headers');
|
||||
assert.optionalNumber(options.clockSkew, 'options.clockSkew');
|
||||
assert.optionalFinite(options.clockSkew, 'options.clockSkew');
|
||||
|
||||
if (!request.headers.authorization)
|
||||
throw new MissingHeaderError('no authorization header present in ' +
|
||||
'the request');
|
||||
var authzHeaderName = options.authorizationHeaderName || 'authorization';
|
||||
|
||||
if (!request.headers[authzHeaderName]) {
|
||||
throw new MissingHeaderError('no ' + authzHeaderName + ' header ' +
|
||||
'present in the request');
|
||||
}
|
||||
|
||||
options.clockSkew = options.clockSkew || 300;
|
||||
|
||||
@@ -134,18 +137,10 @@ module.exports = {
|
||||
var parsed = {
|
||||
scheme: '',
|
||||
params: {},
|
||||
signingString: '',
|
||||
|
||||
get algorithm() {
|
||||
return this.params.algorithm.toUpperCase();
|
||||
},
|
||||
|
||||
get keyId() {
|
||||
return this.params.keyId;
|
||||
}
|
||||
signingString: ''
|
||||
};
|
||||
|
||||
var authz = request.headers.authorization;
|
||||
var authz = request.headers[authzHeaderName];
|
||||
for (i = 0; i < authz.length; i++) {
|
||||
var c = authz.charAt(i);
|
||||
|
||||
@@ -302,7 +297,7 @@ module.exports = {
|
||||
options.headers.forEach(function (hdr) {
|
||||
// Remember that we already checked any headers in the params
|
||||
// were in the request, so if this passes we're good.
|
||||
if (parsed.params.headers.indexOf(hdr) < 0)
|
||||
if (parsed.params.headers.indexOf(hdr.toLowerCase()) < 0)
|
||||
throw new MissingHeaderError(hdr + ' was not a signed header');
|
||||
});
|
||||
|
||||
@@ -312,6 +307,8 @@ module.exports = {
|
||||
' is not a supported algorithm');
|
||||
}
|
||||
|
||||
parsed.algorithm = parsed.params.algorithm.toUpperCase();
|
||||
parsed.keyId = parsed.params.keyId;
|
||||
return parsed;
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -387,7 +387,9 @@ module.exports = {
|
||||
assert.notStrictEqual(signature, '', 'empty signature produced');
|
||||
}
|
||||
|
||||
request.setHeader('Authorization', sprintf(AUTHZ_FMT,
|
||||
var authzHeaderName = options.authorizationHeaderName || 'Authorization';
|
||||
|
||||
request.setHeader(authzHeaderName, sprintf(AUTHZ_FMT,
|
||||
options.keyId,
|
||||
options.algorithm,
|
||||
options.headers.join(' '),
|
||||
|
||||
+17
-21
@@ -1,39 +1,34 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"http-signature@1.1.1",
|
||||
"/mnt/data/Sites/anissabensalah.net/user/themes/anissabensalah"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "http-signature@1.1.1",
|
||||
"_id": "http-signature@1.1.1",
|
||||
"_from": "http-signature@~1.2.0",
|
||||
"_id": "http-signature@1.2.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=",
|
||||
"_integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=",
|
||||
"_location": "/http-signature",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "http-signature@1.1.1",
|
||||
"raw": "http-signature@~1.2.0",
|
||||
"name": "http-signature",
|
||||
"escapedName": "http-signature",
|
||||
"rawSpec": "1.1.1",
|
||||
"rawSpec": "~1.2.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.1.1"
|
||||
"fetchSpec": "~1.2.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/request"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz",
|
||||
"_spec": "1.1.1",
|
||||
"_where": "/mnt/data/Sites/anissabensalah.net/user/themes/anissabensalah",
|
||||
"_resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
|
||||
"_shasum": "9aecd925114772f3d95b65a60abb8f7c18fbace1",
|
||||
"_spec": "http-signature@~1.2.0",
|
||||
"_where": "/home/kevin/Documents/Sites/anissabensalah.net/user/themes/anissabensalah/node_modules/request",
|
||||
"author": {
|
||||
"name": "Joyent, Inc"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/joyent/node-http-signature/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Mark Cavage",
|
||||
@@ -49,14 +44,15 @@
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"assert-plus": "^0.2.0",
|
||||
"assert-plus": "^1.0.0",
|
||||
"jsprim": "^1.2.2",
|
||||
"sshpk": "^1.7.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Reference implementation of Joyent's HTTP Signature scheme.",
|
||||
"devDependencies": {
|
||||
"node-uuid": "^1.4.1",
|
||||
"tap": "0.4.2"
|
||||
"tap": "0.4.2",
|
||||
"uuid": "^2.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8",
|
||||
@@ -77,5 +73,5 @@
|
||||
"scripts": {
|
||||
"test": "tap test/*.js"
|
||||
},
|
||||
"version": "1.1.1"
|
||||
"version": "1.2.0"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user