hawk
Advanced tools
Comparing version 0.14.0 to 0.15.0
@@ -0,0 +0,0 @@ // Load modules |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ // Load modules |
@@ -0,0 +0,0 @@ // Load modules |
@@ -0,0 +0,0 @@ // Export sub-modules |
@@ -77,2 +77,5 @@ // Load modules | ||
attributes.hash returned in the authenticate callback. | ||
host: optional host name override. Only used when passed a node request object. | ||
port: optional port override. Only used when passed a node request object. | ||
} | ||
@@ -294,3 +297,3 @@ | ||
* Arguments and options are the same as authenticate() with the exception that the only supported options are: | ||
* 'hostHeaderName', 'localtimeOffsetMsec' | ||
* 'hostHeaderName', 'localtimeOffsetMsec', 'host', 'port' | ||
*/ | ||
@@ -297,0 +300,0 @@ |
@@ -81,8 +81,10 @@ // Load modules | ||
} | ||
// Obtain host and port information | ||
var host = exports.parseHost(req, options.hostHeaderName); | ||
if (!host) { | ||
return new Error('Invalid Host header'); | ||
if (!options.host || !options.port) { | ||
var host = exports.parseHost(req, options.hostHeaderName); | ||
if (!host) { | ||
return new Error('Invalid Host header'); | ||
} | ||
} | ||
@@ -93,4 +95,4 @@ | ||
url: req.url, | ||
host: host.name, | ||
port: host.port, | ||
host: options.host || host.name, | ||
port: options.port || host.port, | ||
authorization: req.headers.authorization, | ||
@@ -97,0 +99,0 @@ contentType: req.headers['content-type'] || '' |
{ | ||
"name": "hawk", | ||
"description": "HTTP Hawk Authentication Scheme", | ||
"version": "0.14.0", | ||
"version": "0.15.0", | ||
"author": "Eran Hammer <eran@hueniverse.com> (http://hueniverse.com)", | ||
@@ -6,0 +6,0 @@ "contributors": [], |
@@ -6,3 +6,3 @@ ![hawk Logo](https://raw.github.com/hueniverse/hawk/master/images/hawk.png) | ||
Current version: **0.14** | ||
Current version: **0.15** | ||
@@ -9,0 +9,0 @@ [![Build Status](https://secure.travis-ci.org/hueniverse/hawk.png)](http://travis-ci.org/hueniverse/hawk) |
@@ -0,0 +0,0 @@ // Load modules |
@@ -0,0 +0,0 @@ // Load modules |
@@ -0,0 +0,0 @@ // Load modules |
@@ -0,0 +0,0 @@ // Load modules |
@@ -0,0 +0,0 @@ // Load modules |
@@ -0,0 +0,0 @@ // Load modules |
@@ -47,3 +47,3 @@ // Load modules | ||
port: 8080, | ||
authorization: 'Hawk id="1", ts="1353788437", nonce="k3j4h2", mac="zy79QQ5/EYFmQqutVnYb73gAc/U=", ext="hello"', | ||
authorization: 'Hawk id="1", ts="1353788437", nonce="k3j4h2", mac="zy79QQ5/EYFmQqutVnYb73gAc/U=", ext="hello"' | ||
}; | ||
@@ -66,3 +66,3 @@ | ||
port: 8000, | ||
authorization: 'Hawk id="dh37fgj492je", ts="1353832234", nonce="j4h3g2", mac="m8r1rHbXN6NgO+KIIhjO7sFRyd78RNGVUwehe8Cp2dU=", ext="some-app-data"', | ||
authorization: 'Hawk id="dh37fgj492je", ts="1353832234", nonce="j4h3g2", mac="m8r1rHbXN6NgO+KIIhjO7sFRyd78RNGVUwehe8Cp2dU=", ext="some-app-data"' | ||
}; | ||
@@ -78,2 +78,40 @@ | ||
it('should parse a valid authentication header (host override)', function (done) { | ||
var req = { | ||
method: 'GET', | ||
url: '/resource/4?filter=a', | ||
headers: { | ||
host: 'example1.com:8080', | ||
authorization: 'Hawk id="1", ts="1353788437", nonce="k3j4h2", mac="zy79QQ5/EYFmQqutVnYb73gAc/U=", ext="hello"' | ||
} | ||
}; | ||
Hawk.server.authenticate(req, credentialsFunc, { host: 'example.com', localtimeOffsetMsec: 1353788437000 - Hawk.utils.now() }, function (err, credentials, artifacts) { | ||
expect(err).to.not.exist; | ||
expect(credentials.user).to.equal('steve'); | ||
done(); | ||
}); | ||
}); | ||
it('should parse a valid authentication header (host port override)', function (done) { | ||
var req = { | ||
method: 'GET', | ||
url: '/resource/4?filter=a', | ||
headers: { | ||
host: 'example1.com:80', | ||
authorization: 'Hawk id="1", ts="1353788437", nonce="k3j4h2", mac="zy79QQ5/EYFmQqutVnYb73gAc/U=", ext="hello"' | ||
} | ||
}; | ||
Hawk.server.authenticate(req, credentialsFunc, { host: 'example.com', port: 8080, localtimeOffsetMsec: 1353788437000 - Hawk.utils.now() }, function (err, credentials, artifacts) { | ||
expect(err).to.not.exist; | ||
expect(credentials.user).to.equal('steve'); | ||
done(); | ||
}); | ||
}); | ||
it('should parse a valid authentication header (POST with payload)', function (done) { | ||
@@ -86,3 +124,3 @@ | ||
port: 8080, | ||
authorization: 'Hawk id="123456", ts="1357926341", nonce="1AwuJD", hash="qAiXIVv+yjDATneWxZP2YCTa9aHRgQdnH9b3Wc+o3dg=", ext="some-app-data", mac="UeYcj5UoTVaAWXNvJfLVia7kU3VabxCqrccXP8sUGC4="', | ||
authorization: 'Hawk id="123456", ts="1357926341", nonce="1AwuJD", hash="qAiXIVv+yjDATneWxZP2YCTa9aHRgQdnH9b3Wc+o3dg=", ext="some-app-data", mac="UeYcj5UoTVaAWXNvJfLVia7kU3VabxCqrccXP8sUGC4="' | ||
}; | ||
@@ -105,3 +143,3 @@ | ||
port: 8000, | ||
authorization: 'Hawk id="dh37fgj492je", ts="1353832234", nonce="j4h3g2", mac="m8r1rHbXN6NgO+KIIhjO7sFRyd78RNGVUwehe8Cp2dU=", ext="some-app-data"', | ||
authorization: 'Hawk id="dh37fgj492je", ts="1353832234", nonce="j4h3g2", mac="m8r1rHbXN6NgO+KIIhjO7sFRyd78RNGVUwehe8Cp2dU=", ext="some-app-data"' | ||
}; | ||
@@ -124,3 +162,3 @@ | ||
port: 8080, | ||
authorization: 'Hawk id="123456", ts="1362337299", nonce="UzmxSs", ext="some-app-data", mac="wnNUxchvvryMH2RxckTdZ/gY3ijzvccx4keVvELC61w="', | ||
authorization: 'Hawk id="123456", ts="1362337299", nonce="UzmxSs", ext="some-app-data", mac="wnNUxchvvryMH2RxckTdZ/gY3ijzvccx4keVvELC61w="' | ||
}; | ||
@@ -155,3 +193,3 @@ | ||
port: 8080, | ||
authorization: 'Hawk id="123", ts="1353788437", nonce="k3j4h2", mac="bXx7a7p1h9QYQNZ8x7QhvDQym8ACgab4m3lVSFn4DBw=", ext="hello"', | ||
authorization: 'Hawk id="123", ts="1353788437", nonce="k3j4h2", mac="bXx7a7p1h9QYQNZ8x7QhvDQym8ACgab4m3lVSFn4DBw=", ext="hello"' | ||
}; | ||
@@ -158,0 +196,0 @@ |
@@ -0,0 +0,0 @@ // Load modules |
@@ -0,0 +0,0 @@ // Load modules |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
3469
280534