bedrock-account-http
Advanced tools
Comparing version
# bedrock-account-http ChangeLog | ||
## 4.2.1 - 2022-03-26 | ||
### Changed | ||
- Update peer deps to match those with ESM internals: | ||
- `bedrock-account@6.3.2` | ||
- `bedrock-express@6.4.1` | ||
- `bedrock-passport@8.1.0` | ||
- `bedrock-validation@^5.6.3`. | ||
### Fixed | ||
- Fix test suite. | ||
## 4.2.0 - 2022-03-23 | ||
@@ -4,0 +16,0 @@ |
@@ -10,4 +10,4 @@ /*! | ||
import {createValidateMiddleware} from 'bedrock-validation'; | ||
import {ensureAuthenticated, optionallyAuthenticated} from 'bedrock-passport'; | ||
import intParser from 'express-query-int'; | ||
import {ensureAuthenticated, optionallyAuthenticated} from 'bedrock-passport'; | ||
@@ -14,0 +14,0 @@ const {config, util: {uuid, BedrockError}} = bedrock; |
{ | ||
"name": "bedrock-account-http", | ||
"version": "4.2.0", | ||
"version": "4.2.1", | ||
"description": "HTTP API for Bedrock User Accounts", | ||
@@ -33,6 +33,6 @@ "license": "SEE LICENSE IN LICENSE.md", | ||
"bedrock": "^4.5.0", | ||
"bedrock-account": "^6.3.0", | ||
"bedrock-express": "^6.2.2", | ||
"bedrock-passport": "^8.0.2", | ||
"bedrock-validation": "^5.5.0" | ||
"bedrock-account": "^6.3.2", | ||
"bedrock-express": "^6.4.1", | ||
"bedrock-passport": "^8.1.0", | ||
"bedrock-validation": "^5.6.3" | ||
}, | ||
@@ -39,0 +39,0 @@ "directories": { |
@@ -49,21 +49,24 @@ /*! | ||
passportStub.callsFake((req, res, next) => next()); | ||
let passportStubSettings = {email: null}; | ||
function stubPassportStub(email) { | ||
passportStub.callsFake(async (req, res, next) => { | ||
if(!email) { | ||
req.user = null; | ||
return next(); | ||
} | ||
passportStubSettings.email = email; | ||
} | ||
passportStub.callsFake((strategyName, options, callback) => { | ||
return async function (req, res, next) { | ||
req.isAuthenticated = req.isAuthenticated || (() => !!req.user); | ||
let user = false; | ||
try { | ||
req.user = await _deserializeUser({ | ||
accountId: accounts[email].account.id | ||
}); | ||
const {email} = passportStubSettings; | ||
if(email) { | ||
user = await _deserializeUser({ | ||
accountId: accounts[email].account.id | ||
}); | ||
} | ||
} catch(e) { | ||
return next(e); | ||
return callback(e); | ||
} | ||
next(); | ||
}); | ||
} | ||
callback(null, user); | ||
}; | ||
}); | ||
@@ -70,0 +73,0 @@ describe('bedrock-account-http', function bedrockAccountHttp() { |
@@ -29,10 +29,10 @@ { | ||
"bedrock": "^4.5.0", | ||
"bedrock-account": "^6.3.0", | ||
"bedrock-account": "^6.3.2", | ||
"bedrock-account-http": "file:..", | ||
"bedrock-express": "^6.2.2", | ||
"bedrock-mongodb": "^8.4.0", | ||
"bedrock-passport": "^8.0.2", | ||
"bedrock-server": "^3.1.0", | ||
"bedrock-express": "^6.4.1", | ||
"bedrock-mongodb": "^8.5.0", | ||
"bedrock-passport": "^8.1.0", | ||
"bedrock-server": "^3.2.1", | ||
"bedrock-test": "^6.0.0", | ||
"bedrock-validation": "^5.5.0", | ||
"bedrock-validation": "^5.6.3", | ||
"cross-env": "^7.0.2", | ||
@@ -39,0 +39,0 @@ "nyc": "^15.1.0", |
/*! | ||
* Copyright (c) 2016-2021 Digital Bazaar, Inc. All rights reserved. | ||
* Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved. | ||
*/ | ||
@@ -7,4 +7,4 @@ 'use strict'; | ||
const sinon = require('sinon'); | ||
const brPassport = require('bedrock-passport'); | ||
global.passportStub = sinon.stub(brPassport, 'optionallyAuthenticated'); | ||
const {passport} = require('bedrock-passport'); | ||
global.passportStub = sinon.stub(passport, 'authenticate'); | ||
const bedrock = require('bedrock'); | ||
@@ -11,0 +11,0 @@ require('bedrock-account'); |
Sorry, the diff of this file is not supported yet
37690
1.14%722
0.56%