hapi-auth-bearer-mw
Advanced tools
Comparing version 1.3.1 to 1.3.2
@@ -64,6 +64,8 @@ (function() { | ||
credentials = { | ||
id: infoResult.actor.actorId, | ||
id: infoResult.actor.actorId.toString(), | ||
_id: infoResult.actor.actorId.toString(), | ||
clientId: infoResult.clientId, | ||
isValid: !!infoResult.isValid, | ||
isClientValid: !!infoResult.isClientValid, | ||
isAnonymous: false, | ||
scopes: scopes, | ||
@@ -75,33 +77,24 @@ scope: scopes, | ||
}; | ||
return internals.users().get(credentials.id, {}, function(err, user) { | ||
return internals.users().get(credentials.id, {}, function(err, userResult) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
credentials.name = user.username; | ||
credentials.user = user; | ||
if (_.isArray(user.roles)) { | ||
credentials.roles = user.roles; | ||
/* | ||
If user is not found, we need to return an unauthorized error | ||
*/ | ||
if (!userResult) { | ||
return cb(null, null); | ||
} | ||
if (_.isFunction(userResult.toObject)) { | ||
userResult = userResult.toObject(); | ||
} | ||
userResult._id = userResult._id.toString(); | ||
credentials.name = userResult.username; | ||
credentials.user = userResult; | ||
if (_.isArray(userResult.roles)) { | ||
credentials.roles = userResult.roles; | ||
} | ||
return cb(null, credentials); | ||
}); | ||
/* | ||
if (!info) { | ||
return cb(null, null); | ||
} | ||
info.isValid = !!(info.actor && info.actor.actorId && info.expiresIn); | ||
if (info.isValid) { | ||
user = { | ||
isServerToken: false, | ||
isActsAsActorId: false, | ||
username: info.actor.actorId, | ||
userId: info.actor.actorId, | ||
scopes: [] | ||
}; | ||
_.extend(user, info); | ||
user.scopes.push('user'); | ||
return cb(null, user); | ||
} else { | ||
return cb(null, null); | ||
*/ | ||
}); | ||
@@ -108,0 +101,0 @@ }; |
{ | ||
"name": "hapi-auth-bearer-mw", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"private": false, | ||
@@ -17,6 +17,6 @@ "main": "lib/index.js", | ||
"boom": ">=2.5.1", | ||
"underscore": ">=1.6.0" | ||
"underscore": ">=1.7.0" | ||
}, | ||
"peerDependencies": { | ||
"hapi": ">=6.5.0" | ||
"hapi": ">=6.5.0 <8" | ||
}, | ||
@@ -23,0 +23,0 @@ "devDependencies": { |
@@ -8,2 +8,3 @@ [![Build Status](https://travis-ci.org/codedoctor/hapi-auth-bearer-mw.svg?branch=master)](https://travis-ci.org/codedoctor/hapi-auth-bearer-mw) | ||
[![HAPI 6.0](http://img.shields.io/badge/hapi-6.0-blue.svg)](http://hapijs.com) | ||
[![HAPI 7.0](http://img.shields.io/badge/hapi-7.0-blue.svg)](http://hapijs.com) | ||
[![API Documentation](http://img.shields.io/badge/API-Documentation-ff69b4.svg)](http://coffeedoc.info/github/codedoctor/hapi-auth-bearer-mw) | ||
@@ -22,2 +23,6 @@ | ||
## Versions | ||
1.3.2 | ||
Requires the use of hapi-user-store-multi-tenant v1.1.1 or up. | ||
## See also | ||
@@ -24,0 +29,0 @@ |
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
Sorry, the diff of this file is not supported yet
403245
26
62
10910
+ Addedaccept@1.1.0(transitive)
+ Addedb64@2.0.1(transitive)
+ Addedboom@2.10.1(transitive)
+ Addedbossy@1.0.3(transitive)
+ Addedcall@1.0.0(transitive)
+ Addedcatbox@4.3.0(transitive)
+ Addedcatbox-memory@1.1.2(transitive)
+ Addedcontent@1.0.2(transitive)
+ Addedcryptiles@2.0.5(transitive)
+ Addedglue@1.0.0(transitive)
+ Addedh2o2@2.0.1(transitive)
+ Addedhapi@7.5.3(transitive)
+ Addedheavy@1.0.0(transitive)
+ Addedhoek@2.16.3(transitive)
+ Addedinert@1.1.1(transitive)
+ Addediron@2.1.3(transitive)
+ Addedisemail@1.2.0(transitive)
+ Addeditems@1.1.1(transitive)
+ Addedjoi@4.9.06.10.1(transitive)
+ Addedkilt@1.1.1(transitive)
+ Addedlru-cache@2.5.2(transitive)
+ Addedmimos@1.0.1(transitive)
+ Addedmoment@2.30.1(transitive)
+ Addednigel@1.0.1(transitive)
+ Addedpez@1.0.0(transitive)
+ Addedqs@2.4.24.0.0(transitive)
+ Addedrejoice@1.0.0(transitive)
+ Addedshot@1.7.0(transitive)
+ Addedstatehood@1.2.0(transitive)
+ Addedsubtext@1.1.1(transitive)
+ Addedtopo@1.1.0(transitive)
+ Addedvise@1.0.0(transitive)
+ Addedvision@1.2.2(transitive)
+ Addedwreck@5.6.16.3.0(transitive)
- Removedaccept@3.1.3(transitive)
- Removedammo@3.0.3(transitive)
- Removedb64@4.1.2(transitive)
- Removedbounce@1.2.3(transitive)
- Removedbourne@1.3.3(transitive)
- Removedcall@5.0.3(transitive)
- Removedcatbox@10.0.6(transitive)
- Removedcatbox-memory@4.0.1(transitive)
- Removedcontent@4.0.6(transitive)
- Removedcryptiles@4.1.3(transitive)
- Removedhapi@18.1.0(transitive)
- Removedheavy@6.1.2(transitive)
- Removediron@5.0.6(transitive)
- Removedisemail@3.2.0(transitive)
- Removedjoi@14.3.1(transitive)
- Removedmimos@4.0.2(transitive)
- Removednigel@3.0.4(transitive)
- Removedpez@4.0.5(transitive)
- Removedpodium@3.2.0(transitive)
- Removedpunycode@2.3.1(transitive)
- Removedshot@4.0.7(transitive)
- Removedsomever@2.0.0(transitive)
- Removedstatehood@6.0.9(transitive)
- Removedsubtext@6.0.12(transitive)
- Removedteamwork@3.2.0(transitive)
- Removedtopo@3.0.3(transitive)
- Removedvise@3.0.2(transitive)
- Removedwreck@14.2.0(transitive)
Updatedunderscore@>=1.7.0