Skip to content

Commit a17e98d

Browse files
committed
Merge branch 'master' of github.com:hapijs/hapi
2 parents 8c8d811 + 47b82a3 commit a17e98d

3 files changed

Lines changed: 41 additions & 4 deletions

File tree

‎lib/auth.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ internals.Auth.prototype._authenticate = function (request, next) {
340340
// Injection bypass
341341

342342
if (request.auth.credentials) {
343-
return validate(null, 'bypass', { credentials: request.auth.credentials });
343+
return validate(null, 'bypass', { credentials: request.auth.credentials, artifacts: request.auth.artifacts });
344344
}
345345

346346
// Authenticate

‎package.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@
5050
"wreck": "5.x.x"
5151
},
5252
"scripts": {
53-
"test": "node node_modules/lab/bin/lab -a code -t 100 -L",
54-
"test-tap": "node node_modules/lab/bin/lab -a code -r tap -o tests.tap",
55-
"test-cov-html": "node node_modules/lab/bin/lab -a code -r html -o coverage.html",
53+
"test": "lab -a code -t 100 -L",
54+
"test-tap": "lab -a code -r tap -o tests.tap",
55+
"test-cov-html": "lab -a code -r html -o coverage.html",
5656
"changelog": "mdchangelog --no-prologue --no-orphan-issues --overwrite --order-milestones semver --order-issues closed_at --dependents --remote hapijs/hapi --same-org --timeout 120000"
5757
},
5858
"license": "BSD-3-Clause"

‎test/auth.js‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,6 +1106,43 @@ describe('authentication', function () {
11061106
done();
11071107
});
11081108
});
1109+
1110+
it('passes the options.artifacts object, even with an auth filter', function (done) {
1111+
1112+
var server = new Hapi.Server();
1113+
server.connection();
1114+
server.auth.scheme('custom', internals.implementation);
1115+
server.auth.strategy('default', 'custom', true, { users: { steve: {} } });
1116+
server.route({
1117+
method: 'GET',
1118+
path: '/',
1119+
config: {
1120+
handler: function (request, reply) {
1121+
1122+
return reply(request.auth.artifacts);
1123+
},
1124+
auth: 'default'
1125+
}
1126+
});
1127+
1128+
var options = {
1129+
url: '/',
1130+
headers: { authorization: 'Custom steve' },
1131+
credentials: { foo: 'bar' },
1132+
artifacts: { bar: 'baz' }
1133+
};
1134+
1135+
server.inject(options, function (res) {
1136+
1137+
expect(res.statusCode).to.equal(200);
1138+
expect(res.result.bar).to.equal('baz');
1139+
done();
1140+
});
1141+
1142+
1143+
1144+
});
1145+
11091146
});
11101147

11111148
describe('payload()', function () {

0 commit comments

Comments
 (0)