Comparing version 2.2.1 to 2.2.2
@@ -57,2 +57,10 @@ // Load modules | ||
var resource = options.resource || ''; | ||
if (resource && | ||
resource[0] !== '/') { | ||
var url = Url.parse(resource, false); | ||
resource = url.path; // Includes query | ||
} | ||
var normalized = 'hawk.' + exports.headerVersion + '.' + type + '\n' + | ||
@@ -62,3 +70,3 @@ options.ts + '\n' + | ||
(options.method || '').toUpperCase() + '\n' + | ||
(options.resource || '') + '\n' + | ||
resource + '\n' + | ||
options.host.toLowerCase() + '\n' + | ||
@@ -65,0 +73,0 @@ options.port + '\n' + |
{ | ||
"name": "hawk", | ||
"description": "HTTP Hawk Authentication Scheme", | ||
"version": "2.2.1", | ||
"version": "2.2.2", | ||
"author": "Eran Hammer <eran@hueniverse.com> (http://hueniverse.com)", | ||
@@ -6,0 +6,0 @@ "contributors": [], |
@@ -100,2 +100,42 @@ // Load modules | ||
it('generates a header then successfully parse it (absolute request uri)', function (done) { | ||
var req = { | ||
method: 'POST', | ||
url: 'http://example.com:8080/resource/4?filter=a', | ||
headers: { | ||
host: 'example.com:8080', | ||
'content-type': 'text/plain;x=y' | ||
} | ||
}; | ||
var payload = 'some not so random text'; | ||
credentialsFunc('123456', function (err, credentials) { | ||
var reqHeader = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] }); | ||
req.headers.authorization = reqHeader.field; | ||
Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) { | ||
expect(err).to.not.exist; | ||
expect(credentials.user).to.equal('steve'); | ||
expect(artifacts.ext).to.equal('some-app-data'); | ||
expect(Hawk.server.authenticatePayload(payload, credentials, artifacts, req.headers['content-type'])).to.equal(true); | ||
var res = { | ||
headers: { | ||
'content-type': 'text/plain' | ||
} | ||
}; | ||
res.headers['server-authorization'] = Hawk.server.header(credentials, artifacts, { payload: 'some reply', contentType: 'text/plain', ext: 'response-specific' }); | ||
expect(res.headers['server-authorization']).to.exist; | ||
expect(Hawk.client.authenticate(res, credentials, artifacts, { payload: 'some reply' })).to.equal(true); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
it('generates a header then successfully parse it (no server header options)', function (done) { | ||
@@ -102,0 +142,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
335767
4517