hapi-auth-bearer-mw
Advanced tools
Comparing version 1.1.1 to 1.2.1
@@ -34,3 +34,3 @@ (function() { | ||
var _ref, _ref1; | ||
return (_ref = internals.identityStore) != null ? (_ref1 = _ref.methods) != null ? _ref1.users : void 0 : void 0; | ||
return (_ref = internals.hapiUserStoreMultiTenant) != null ? (_ref1 = _ref.methods) != null ? _ref1.users : void 0 : void 0; | ||
}; | ||
@@ -102,15 +102,19 @@ Hoek.assert(_.isFunction(internals.oauthAuth, "No oauth auth accessible.")); | ||
authenticate: function(request, reply) { | ||
var authorization, createCallback, parts, req; | ||
var accessToken, authorization, createCallback, parts, req; | ||
req = request.raw.req; | ||
authorization = req.headers.authorization; | ||
if (!authorization) { | ||
return reply(boom.unauthorized(null, "Bearer")); | ||
accessToken = request.query['access_token']; | ||
if (!accessToken) { | ||
authorization = req.headers.authorization; | ||
if (!authorization) { | ||
return reply(boom.unauthorized(null, "Bearer")); | ||
} | ||
parts = authorization.split(/\s+/); | ||
if (parts.length !== 2) { | ||
return reply(boom.badRequest("Bad HTTP authentication header format")); | ||
} | ||
if (parts[0] && parts[0].toLowerCase() !== "bearer") { | ||
return reply(boom.unauthorized(null, "Bearer")); | ||
} | ||
accessToken = parts[1]; | ||
} | ||
parts = authorization.split(/\s+/); | ||
if (parts.length !== 2) { | ||
return reply(boom.badRequest("Bad HTTP authentication header format")); | ||
} | ||
if (parts[0] && parts[0].toLowerCase() !== "bearer") { | ||
return reply(boom.unauthorized(null, "Bearer")); | ||
} | ||
createCallback = function(token) { | ||
@@ -137,3 +141,3 @@ return function(err, credentials) { | ||
}; | ||
return internals.validateFunc(parts[1], createCallback(parts[1])); | ||
return internals.validateFunc(accessToken, createCallback(accessToken)); | ||
} | ||
@@ -140,0 +144,0 @@ }; |
{ | ||
"name": "hapi-auth-bearer-mw", | ||
"version": "1.1.1", | ||
"version": "1.2.1", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
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
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
397050
10906
0