From f85b0dc2a77b42f3b66a980d3986a8171a3af0a6 Mon Sep 17 00:00:00 2001 From: Dmitri Zagidulin Date: Tue, 3 Dec 2019 20:34:59 -0500 Subject: [PATCH 1/3] Refactor OidcManager to use flex-docstore. --- bin/lib/start.js | 4 +- lib/authentication/force-user.js | 4 +- lib/authentication/multi-rp-client.js | 3 +- lib/authentication/oidc-manager.js | 68 +++-- lib/authentication/webid-oidc.js | 4 +- lib/create-app.js | 12 +- lib/create-server.js | 4 +- .../integration/account-creation-oidc-test.js | 283 ++++++++---------- test/integration/acl-oidc-test.js | 41 ++- test/integration/authentication-oidc-test.js | 61 ++-- test/integration/capability-discovery-test.js | 24 +- test/integration/errors-oidc-test.js | 34 ++- test/integration/formats-test.js | 17 +- test/integration/header-test.js | 3 +- test/integration/http-copy-test.js | 40 +-- test/integration/http-test.js | 14 +- test/integration/ldp-file-store-test.js | 1 + test/integration/oidc-manager-test.js | 4 +- test/integration/patch-sparql-update-test.js | 16 +- test/integration/patch-test.js | 11 +- ..._key_2d7c299a1aa8e8cadb6a0bb93b6e7873.json | 1 - ..._key_370f34992ebf2d00bc6b4a2bd3dd77fd.json | 1 - .../_key_https%3A%2F%2Flocalhost%3A7000.json | 1 - .../_key_https%3A%2F%2Flocalhost%3A7000.json | 1 - .../_key_https%3A%2F%2Flocalhost%3A7001.json | 1 - test/unit/oidc-manager-test.js | 2 - 26 files changed, 316 insertions(+), 339 deletions(-) delete mode 100644 test/resources/accounts-scenario/alice/db/oidc/op/clients/_key_2d7c299a1aa8e8cadb6a0bb93b6e7873.json delete mode 100644 test/resources/accounts-scenario/alice/db/oidc/op/clients/_key_370f34992ebf2d00bc6b4a2bd3dd77fd.json delete mode 100644 test/resources/accounts-scenario/alice/db/oidc/rp/clients/_key_https%3A%2F%2Flocalhost%3A7000.json delete mode 100644 test/resources/accounts-scenario/bob/db/oidc/rp/clients/_key_https%3A%2F%2Flocalhost%3A7000.json delete mode 100644 test/resources/accounts-scenario/bob/db/oidc/rp/clients/_key_https%3A%2F%2Flocalhost%3A7001.json diff --git a/bin/lib/start.js b/bin/lib/start.js index 3a5a1eaa..424755ce 100644 --- a/bin/lib/start.js +++ b/bin/lib/start.js @@ -41,7 +41,7 @@ module.exports = function (program, server) { }) } -function bin (argv, server) { +async function bin (argv, server) { if (!argv.email) { argv.email = { host: argv.emailHost, @@ -106,7 +106,7 @@ function bin (argv, server) { const solid = require('../../') let app try { - app = solid.createServer(argv, server) + app = await solid.createServer(argv, server) } catch (e) { if (e.code === 'EACCES') { if (e.syscall === 'mkdir') { diff --git a/lib/authentication/force-user.js b/lib/authentication/force-user.js index 0836ac1b..f0e16724 100644 --- a/lib/authentication/force-user.js +++ b/lib/authentication/force-user.js @@ -3,8 +3,10 @@ const { logger } = require('./../logger') /** * Enforces the `--force-user` server flag, hardcoding a webid for all requests, * for testing purposes. + * + * Note: It's async only to match the signature of other auth methods. */ -function initialize (app, argv) { +async function initialize (app, argv) { const forceUserId = argv.forceUser app.use('/', (req, res, next) => { logger.warn(`Identified user (override): ${forceUserId}`) diff --git a/lib/authentication/multi-rp-client.js b/lib/authentication/multi-rp-client.js index d84fb4c2..79c727a1 100644 --- a/lib/authentication/multi-rp-client.js +++ b/lib/authentication/multi-rp-client.js @@ -75,7 +75,7 @@ class MultiRpClient { async clientForIssuer (issuerUri) { const client = await this.loadClient(issuerUri) if (client) { - // logger.info(`Client fetched for issuer ${issuerUri}`) + logger.info(`Client fetched for issuer ${issuerUri}`) return client } @@ -129,7 +129,6 @@ class MultiRpClient { } registerClient ({ registration, rpOptions }) { - // logger.info('new OIDCRelyingParty.register()', config) logger.info('Registering new client for issuer ', registration.issuer) return OIDCRelyingParty.register(registration.issuer, registration, rpOptions) diff --git a/lib/authentication/oidc-manager.js b/lib/authentication/oidc-manager.js index 6b8d1f64..2cde1fc4 100644 --- a/lib/authentication/oidc-manager.js +++ b/lib/authentication/oidc-manager.js @@ -6,7 +6,6 @@ const { logger } = require('../logger') const { URL } = require('url') const validUrl = require('valid-url') const ResourceAuthenticator = require('@solid/oidc-rs') -const KVPFileStore = require('kvplus-files') const { FlexDocStore } = require('flex-docstore') const { MultiRpClient } = require('./multi-rp-client') const OIDCProvider = require('@interop-alliance/oidc-op') @@ -78,8 +77,7 @@ class OidcManager { * * Config for OIDCProvider: * @param config.serverUri {string} URI of the OpenID Connect Provider - * @param [config.host] {Object} Injected host behavior object, - * see `providerFrom()` docstring. + * @param [config.host] {Object} Injected host behavior object. * * Config for MultiRpClient: * @param config.authCallbackUri {string} @@ -150,7 +148,7 @@ class OidcManager { postLogoutUri, saltRounds: argv.saltRounds, delayBeforeRegisteringInitialClient: argv.delayBeforeRegisteringInitialClient, - host: {} + host: HostAPI } return OidcManager.from(options) @@ -190,17 +188,21 @@ class OidcManager { * * @return {Promise} Initialized local RP client */ - async initialize () { + async initialize ({ skipInitLocalRp } = {}) { try { - this.initStorage() - await this.initProviderKeychain() - this.saveProviderConfig() + const shouldSaveConfig = await this.initProviderKeychain() + if (shouldSaveConfig) { + this.saveProviderConfig() + } await this.sleepIfNeeded() - return this.initLocalRpClient() + if (!skipInitLocalRp) { + await this.initLocalRpClient() + } } catch (error) { logger.error('Error initializing OidcManager:', error) + throw error } } @@ -224,24 +226,20 @@ class OidcManager { } } - /** - * Initializes storage collections (creates directories if using - * on-disk stores, etc). - * Synchronous. - */ - initStorage () { - this.provider.backend.initCollections() - } - async initProviderKeychain () { + let shouldSaveConfig = true + if (this.provider.keys) { logger.info('Provider keys loaded from config') + shouldSaveConfig = false } else { logger.info('No provider keys found, generating fresh ones') } await this.provider.initializeKeyChain(this.provider.keys) logger.info('Provider keychain initialized') + + return shouldSaveConfig } /** @@ -318,24 +316,28 @@ class OidcManager { initProvider () { const providerConfig = this.loadProviderConfig() - const provider = new OIDCProvider(providerConfig) - if (providerConfig.keys) { - provider.keys = providerConfig.keys - } - - const backend = new KVPFileStore({ - path: this.storePaths.providerStore, - collections: ['codes', 'clients', 'tokens', 'refresh'] - }) - provider.inject({ backend }) - // Init the injected host API (authenticate / obtainConsent / logout) - let host = this.host || {} - host = Object.assign(host, HostAPI) + // providerConfig.store = { + // codes: FlexDocStore.using('files', + // { dir: path.join(this.storePaths.providerStore, 'codes') }), + // clients: FlexDocStore.using('files', + // { dir: path.join(this.storePaths.providerStore, 'clients') }), + // tokens: FlexDocStore.using('files', + // { dir: path.join(this.storePaths.providerStore, 'tokens') }), + // refresh: FlexDocStore.using('files', + // { dir: path.join(this.storePaths.providerStore, 'refresh') }) + // } + + providerConfig.store = { + codes: FlexDocStore.using('memory'), + clients: FlexDocStore.using('memory'), + tokens: FlexDocStore.using('memory'), + refresh: FlexDocStore.using('memory') + } - provider.inject({ host }) + providerConfig.host = this.host || HostAPI - this.provider = provider + this.provider = new OIDCProvider(providerConfig) } providerConfigPath () { diff --git a/lib/authentication/webid-oidc.js b/lib/authentication/webid-oidc.js index e1b6cd3b..07d6dd20 100644 --- a/lib/authentication/webid-oidc.js +++ b/lib/authentication/webid-oidc.js @@ -23,10 +23,10 @@ const { * @param app {Object} Express.js app instance * @param argv {Object} Config options hashmap */ -function initialize (app, argv) { +async function initialize (app, argv) { const oidc = OidcManager.fromServerConfig(argv) app.locals.oidc = oidc - oidc.initialize() + await oidc.initialize(argv) // Attach the OIDC API app.use('/', middleware(oidc)) diff --git a/lib/create-app.js b/lib/create-app.js index ec5da66d..73ce5760 100644 --- a/lib/create-app.js +++ b/lib/create-app.js @@ -18,7 +18,7 @@ const bodyParser = require('body-parser') const { ldpRequestHandler } = require('./data-storage/api') const { corsSettings, initHeaders } = require('./common-headers') -function createApp (argv = {}) { +async function createApp (argv = {}) { // Override default configs (defaults) with passed-in params (argv) argv = Object.assign({}, defaults, argv) @@ -46,7 +46,7 @@ function createApp (argv = {}) { // If authentication is enabled, initialize it if (argv.webid) { - initWebId(argv, app, storage) + await initWebId(argv, app, storage) } // Attach the LDP middleware @@ -119,7 +119,7 @@ function initViews (app) { * @param app {Function} * @param storage {StorageManager} */ -function initWebId (argv, app, storage) { +async function initWebId (argv, app, storage) { const { root, multiuser, templates, server, host, skipWelcomePage } = argv if (!skipWelcomePage) { // Skip creating server welcome page (useful for tests) @@ -146,7 +146,7 @@ function initWebId (argv, app, storage) { app.use('/', accountMgmtApi.middleware(accountManager)) // Set up authentication-related API endpoints and app.locals - initAuthentication(app, argv) + await initAuthentication(app, argv) app.get('/api/share', (req, res, next) => ShareRequest.get(req, res).catch(next)) app.post('/api/share', bodyParser.urlencoded({ extended: true }), @@ -163,13 +163,13 @@ function initWebId (argv, app, storage) { * @param app {Object} Express.js app instance * @param argv {Object} Config options hashmap */ -function initAuthentication (app, argv) { +async function initAuthentication (app, argv) { const auth = argv.forceUser ? 'forceUser' : argv.auth const authenticationApi = require('./authentication') if (!(auth in authenticationApi)) { throw new Error(`Unsupported authentication scheme: ${auth}`) } - authenticationApi[auth].initialize(app, argv) + await authenticationApi[auth].initialize(app, argv) } /** diff --git a/lib/create-server.js b/lib/create-server.js index 28f04260..78e2546e 100644 --- a/lib/create-server.js +++ b/lib/create-server.js @@ -7,10 +7,10 @@ const http = require('http') const { logger } = require('./logger') const createApp = require('./create-app') -function createServer (argv, app) { +async function createServer (argv, app) { argv = argv || {} app = app || express() - const ldpApp = createApp(argv) + const ldpApp = await createApp(argv) let mount = argv.mount || '/' // Removing ending '/' if (mount.length > 1 && diff --git a/test/integration/account-creation-oidc-test.js b/test/integration/account-creation-oidc-test.js index 104fa363..6fe134f7 100644 --- a/test/integration/account-creation-oidc-test.js +++ b/test/integration/account-creation-oidc-test.js @@ -1,204 +1,165 @@ + const supertest = require('supertest') // Helper functions for the FS -const $rdf = require('rdflib') +const rdf = require('rdflib') const { rm, read, checkDnsSettings, cleanDir } = require('../utils') const ldnode = require('../../index') const path = require('path') const fs = require('fs-extra') +const { promisify } = require('util') + +describe('AccountManager (OIDC account creation tests)', () => { + const serverUri = 'https://localhost:3457' + const host = 'localhost:3457' -describe('AccountManager (OIDC account creation tests)', function () { - var serverUri = 'https://localhost:3457' - var host = 'localhost:3457' - var ldpHttpsServer + let ldp const rootPath = path.join(__dirname, '../resources/accounts/') const configPath = path.join(__dirname, '../resources/config') const dbPath = path.join(__dirname, '../resources/accounts/db') - var ldp = ldnode.createServer({ - root: rootPath, - configPath, - sslKey: path.join(__dirname, '../keys/key.pem'), - sslCert: path.join(__dirname, '../keys/cert.pem'), - auth: 'oidc', - webid: true, - multiuser: true, - skipWelcomePage: true, - strictOrigin: true, - dbPath, - serverUri - }) - - before(checkDnsSettings) + before(async () => { + await checkDnsSettings() + ldp = await ldnode.createServer({ + root: rootPath, + configPath, + sslKey: path.join(__dirname, '../keys/key.pem'), + sslCert: path.join(__dirname, '../keys/cert.pem'), + webid: true, + multiuser: true, + skipWelcomePage: true, + skipInitLocalRp: true, + dbPath, + serverUri + }) - before(function (done) { - ldpHttpsServer = ldp.listen(3457, done) + await promisify(ldp.listen.bind(ldp))(3457) }) - after(function () { - if (ldpHttpsServer) ldpHttpsServer.close() + after(async () => { + ldp.close() cleanDir(path.join(rootPath, 'localhost')) + await fs.remove(path.join(dbPath, 'oidc', 'users')) }) - var server = supertest(serverUri) - // FIXME: Does this test even make sense? - it.skip('should expect a 404 on GET /accounts', function (done) { - server.get('/api/accounts') - .expect(404, done) // actually throws a 401 Unauthorized + it.skip('should expect a 404 on GET /accounts', async () => { + return supertest(serverUri).get('/api/accounts') + .expect(404) // actually throws a 401 Unauthorized }) - describe('accessing accounts', function () { - it('should be able to access public file of an account', function (done) { - var subdomain = supertest('https://tim.' + host) - subdomain.get('/hello.html') - .expect(200, done) + describe('accessing accounts', () => { + it('should be able to access public file of an account', async () => { + return supertest('https://tim.' + host) + .get('/hello.html') + .expect(200) }) - it('should get 404 if root does not exist', function (done) { - var subdomain = supertest('https://nicola.' + host) - subdomain.head('/') + it('should get 404 if root does not exist', async () => { + return supertest('https://nicola.' + host) + .head('/') .set('Accept', 'text/turtle') .set('Origin', 'http://example.com') .expect(404) .expect('Access-Control-Allow-Origin', 'http://example.com') .expect('Access-Control-Allow-Credentials', 'true') - .end(function (err, res) { - done(err) - }) }) }) describe('creating an account with POST', function () { - beforeEach(function () { + beforeEach(() => { rm('accounts/nicola.localhost') }) - after(function () { + after(() => { rm('accounts/nicola.localhost') }) - it('should not create WebID if no username is given', (done) => { - const subdomain = supertest('https://nicola.' + host) - subdomain.post('/api/accounts/new') + it('should not create WebID if no username is given', async () => { + return supertest('https://nicola.' + host) + .post('/api/accounts/new') .send('username=&password=12345') - .expect(400, done) + .expect(400) }) - it('should not create WebID if no password is given', (done) => { - const subdomain = supertest('https://nicola.' + host) - subdomain.post('/api/accounts/new') + it('should not create WebID if no password is given', async () => { + return supertest('https://nicola.' + host) + .post('/api/accounts/new') .send('username=nicola&password=') - .expect(400, done) + .expect(400) }) - it('should not create a WebID if it already exists', function (done) { - var subdomain = supertest('https://nicola.' + host) - subdomain.post('/api/accounts/new') + it('should not create a WebID if it already exists', async () => { + const subdomain = supertest('https://nicola.' + host) + await subdomain.post('/api/accounts/new') .send('username=nicola&password=12345') .expect(302) - .end((err, res) => { - if (err) { - console.log(res) - return done(err) - } - subdomain.post('/api/accounts/new') - .send('username=nicola&password=12345') - .expect(400) - .end((err) => { - console.log(err) - done(err) - }) - }) + return subdomain.post('/api/accounts/new') + .send('username=nicola&password=12345') + .expect(400) }) - it('should create the default folders', function (done) { - var subdomain = supertest('https://nicola.' + host) - subdomain.post('/api/accounts/new') + it('should create the default folders', async () => { + const subdomain = supertest('https://nicola.' + host) + await subdomain.post('/api/accounts/new') .send('username=nicola&password=12345') .expect(302) - .end(function (err) { - if (err) { - return done(err) - } - var domain = host.split(':')[0] - var card = read(path.join('accounts/nicola.' + domain, - 'web')) - var cardAcl = read(path.join('accounts/nicola.' + domain, - 'web.acl')) - var prefs = read(path.join('accounts/nicola.' + domain, - 'settings/prefs.ttl')) - var rootMeta = read(path.join('accounts/nicola.' + domain, '.meta')) - var rootMetaAcl = read(path.join('accounts/nicola.' + domain, - '.meta.acl')) - - if (domain && card && cardAcl && prefs && rootMeta && - rootMetaAcl) { - done() - } else { - done(new Error('failed to create default files')) - } - }) - }).timeout(20000) - - it('should link WebID to the root account', function (done) { - var subdomain = supertest('https://nicola.' + host) - subdomain.post('/api/accounts/new') + + const domain = host.split(':')[0] + const card = read(path.join('accounts/nicola.' + domain, + 'web')) + const cardAcl = read(path.join('accounts/nicola.' + domain, + 'web.acl')) + const prefs = read(path.join('accounts/nicola.' + domain, + 'settings/prefs.ttl')) + const rootMeta = read(path.join('accounts/nicola.' + domain, '.meta')) + const rootMetaAcl = read(path.join('accounts/nicola.' + domain, + '.meta.acl')) + + if (!(domain && card && cardAcl && prefs && rootMeta && rootMetaAcl)) { + throw new Error('failed to create default files') + } + }) + + it('should link WebID to the root account', async () => { + const subdomain = supertest('https://nicola.' + host) + await subdomain.post('/api/accounts/new') .send('username=nicola&password=12345') .expect(302) - .end(function (err) { - if (err) { - return done(err) - } - subdomain.get('/.meta') - .expect(200) - .end(function (err, data) { - if (err) { - return done(err) - } - var graph = $rdf.graph() - $rdf.parse( - data.text, - graph, - 'https://nicola.' + host + '/.meta', - 'text/turtle') - var statements = graph.statementsMatching( - undefined, - $rdf.sym('http://www.w3.org/ns/solid/terms#account'), - undefined) - if (statements.length === 1) { - done() - } else { - done(new Error('missing link to WebID of account')) - } - }) - }) - }).timeout(20000) - - it('should create a private settings container', function (done) { - var subdomain = supertest('https://nicola.' + host) - subdomain.head('/settings/') + + const data = await subdomain.get('/.meta') + .expect(200) + + const graph = rdf.graph() + await promisify(rdf.parse)( + data.text, + graph, + 'https://nicola.' + host + '/.meta', + 'text/turtle') + const statements = graph.statementsMatching( + undefined, + rdf.sym('http://www.w3.org/ns/solid/terms#account'), + undefined) + if (statements.length !== 1) { + throw new Error('missing link to WebID of account') + } + }) + + it('should create a private settings container', async () => { + return supertest('https://nicola.' + host) + .head('/settings/') .expect(401) - .end(function (err) { - done(err) - }) }) - it('should create a private prefs file in the settings container', function (done) { - var subdomain = supertest('https://nicola.' + host) - subdomain.head('/inbox/prefs.ttl') + it('should create a private prefs file in the settings container', async () => { + return supertest('https://nicola.' + host) + .head('/inbox/prefs.ttl') .expect(401) - .end(function (err) { - done(err) - }) }) - it('should create a private inbox container', function (done) { - var subdomain = supertest('https://nicola.' + host) - subdomain.head('/inbox/') + it('should create a private inbox container', async () => { + return supertest('https://nicola.' + host) + .head('/inbox/') .expect(401) - .end(function (err) { - done(err) - }) }) }) }) @@ -206,34 +167,34 @@ describe('AccountManager (OIDC account creation tests)', function () { describe('Single User signup page', () => { const serverUri = 'https://localhost:7457' const port = 7457 - var ldpHttpsServer + let ldp const rootDir = path.join(__dirname, '../resources/accounts/single-user/') const configPath = path.join(__dirname, '../resources/config') - const ldp = ldnode.createServer({ - port, - root: rootDir, - configPath, - sslKey: path.join(__dirname, '../keys/key.pem'), - sslCert: path.join(__dirname, '../keys/cert.pem'), - webid: true, - multiuser: false, - strictOrigin: true - }) const server = supertest(serverUri) - before(function (done) { - ldpHttpsServer = ldp.listen(port, done) + before(async () => { + ldp = await ldnode.createServer({ + port, + root: rootDir, + configPath, + sslKey: path.join(__dirname, '../keys/key.pem'), + sslCert: path.join(__dirname, '../keys/cert.pem'), + webid: true, + multiuser: false, + skipWelcomePage: true, + skipInitLocalRp: true + }) + await promisify(ldp.listen.bind(ldp))(port) }) - after(function () { - if (ldpHttpsServer) ldpHttpsServer.close() + after(() => { fs.removeSync(rootDir) + ldp.close() }) - it('should return a 401 unauthorized without accept text/html', done => { - server.get('/') + it('should return a 401 unauthorized without accept text/html', async () => { + return server.get('/') .set('accept', 'text/plain') .expect(401) - .end(done) }) }) diff --git a/test/integration/acl-oidc-test.js b/test/integration/acl-oidc-test.js index 8a8a96a4..91d2da29 100644 --- a/test/integration/acl-oidc-test.js +++ b/test/integration/acl-oidc-test.js @@ -2,6 +2,7 @@ const assert = require('chai').assert const fs = require('fs-extra') const request = require('request') const path = require('path') +const { promisify } = require('util') const { loadProvider, rm, checkDnsSettings, cleanDir } = require('../utils') const IDToken = require('@interop-alliance/oidc-op/src/IDToken') @@ -49,39 +50,31 @@ const argv = { sslCert: path.join(__dirname, '../keys/cert.pem'), webid: true, multiuser: true, - skipWelcomePage: true + skipWelcomePage: true, + skipInitLocalRp: true } -describe('ACL with WebID+OIDC over HTTP', function () { - let ldp, ldpHttpsServer +describe('ACL with WebID+OIDC over HTTP', () => { + let ldp - before(checkDnsSettings) + before(async () => { + checkDnsSettings() - before(done => { - ldp = ldnode.createServer(argv) + ldp = await ldnode.createServer(argv) - loadProvider(oidcProviderPath) - .then(provider => { - oidcProvider = provider - - return Promise.all([ - issueIdToken(oidcProvider, user1), - issueIdToken(oidcProvider, user2) - ]) - }) - .then(tokens => { - userCredentials.user1 = tokens[0] - userCredentials.user2 = tokens[1] - }) - .then(() => { - ldpHttpsServer = ldp.listen(port, done) - }) - .catch(console.error) + oidcProvider = await loadProvider(oidcProviderPath) + const tokens = await Promise.all([ + issueIdToken(oidcProvider, user1), + issueIdToken(oidcProvider, user2) + ]) + userCredentials.user1 = tokens[0] + userCredentials.user2 = tokens[1] + await promisify(ldp.listen.bind(ldp))(port) }) after(() => { - if (ldpHttpsServer) ldpHttpsServer.close() cleanDir(rootPath) + ldp.close() }) const origin1 = 'http://example.org/' diff --git a/test/integration/authentication-oidc-test.js b/test/integration/authentication-oidc-test.js index fcb8b959..8243670d 100644 --- a/test/integration/authentication-oidc-test.js +++ b/test/integration/authentication-oidc-test.js @@ -49,44 +49,49 @@ describe('Authentication API (OIDC)', () => { const serverConfig = { sslKey: path.join(__dirname, '../keys/key.pem'), sslCert: path.join(__dirname, '../keys/cert.pem'), - auth: 'oidc', webid: true, multiuser: false, skipWelcomePage: true, + skipInitLocalRp: true, configPath } const aliceRootPath = path.join(__dirname, '../resources/accounts-scenario/alice') - const alicePod = Solid.createServer( - Object.assign({ - root: aliceRootPath, - serverUri: aliceServerUri, - dbPath: aliceDbPath - }, serverConfig) - ) + let alicePod + const bobRootPath = path.join(__dirname, '../resources/accounts-scenario/bob') - const bobPod = Solid.createServer( - Object.assign({ - root: bobRootPath, - serverUri: bobServerUri, - dbPath: bobDbPath - }, serverConfig) - ) + let bobPod before(async () => { - await Promise.all([ - startServer(alicePod, 7000), - startServer(bobPod, 7001) - ]).then(() => { - alice = supertest(aliceServerUri) - bob = supertest(bobServerUri) - }) + alicePod = await Solid.createServer( + Object.assign({ + root: aliceRootPath, + serverUri: aliceServerUri, + dbPath: aliceDbPath + }, serverConfig)) + + await startServer(alicePod, 7000) + + bobPod = await Solid.createServer( + Object.assign({ + root: bobRootPath, + serverUri: bobServerUri, + dbPath: bobDbPath + }, serverConfig) + ) + + await startServer(bobPod, 7001) + + alice = supertest(aliceServerUri) + bob = supertest(bobServerUri) }) after(() => { alicePod.close() bobPod.close() fs.removeSync(path.join(aliceDbPath, 'oidc/users')) + fs.removeSync(path.join(aliceDbPath, 'oidc/rp')) + fs.removeSync(path.join(bobDbPath, 'oidc/rp/clients')) cleanDir(aliceRootPath) cleanDir(bobRootPath) }) @@ -142,10 +147,10 @@ describe('Authentication API (OIDC)', () => { describe('Login by Username and Password (POST /login/password)', () => { // Logging in as alice, to alice's pod - const aliceAccount = UserAccount.from({ webId: aliceWebId }) const alicePassword = '12345' - beforeEach(() => { + const aliceAccount = UserAccount.from({ webId: aliceWebId }) + return aliceCredentialStore.createUser(aliceAccount, alicePassword) .catch(console.error.bind(console)) }) @@ -156,7 +161,10 @@ describe('Authentication API (OIDC)', () => { describe('after performing a correct login', () => { let response, cookie + before(done => { + const aliceAccount = UserAccount.from({ webId: aliceWebId }) + aliceCredentialStore.createUser(aliceAccount, alicePassword) alice.post('/login/password') .type('form') @@ -303,6 +311,8 @@ describe('Authentication API (OIDC)', () => { const authorizeUri = res.header.location expect(authorizeUri.startsWith(aliceServerUri + '/authorize')) + console.log('REDIRECTED TO:', authorizeUri) + // Follow the redirect to /authorize const authorizePath = authorizeUri.replace(aliceServerUri, '') // (new URL(authorizeUri)).pathname return alice.get(authorizePath) @@ -310,6 +320,7 @@ describe('Authentication API (OIDC)', () => { .then(res => { // Since alice not logged in to her pod, /authorize redirects to /login const loginUri = res.header.location + expect(loginUri.startsWith('/login')) }) }) @@ -343,7 +354,7 @@ describe('Authentication API (OIDC)', () => { after(() => { fs.removeSync(path.join(aliceDbPath, 'users/users')) - fs.removeSync(path.join(aliceDbPath, 'oidc/op/tokens')) + // fs.removeSync(path.join(aliceDbPath, 'oidc/op/tokens')) // const clientId = auth.currentClient.registration['client_id'] // const registration = `_key_${clientId}.json` diff --git a/test/integration/capability-discovery-test.js b/test/integration/capability-discovery-test.js index bb1a95cc..57f81e96 100644 --- a/test/integration/capability-discovery-test.js +++ b/test/integration/capability-discovery-test.js @@ -1,6 +1,6 @@ const Solid = require('../../index') const path = require('path') -const { cleanDir } = require('../utils') +const { cleanDir, startServer } = require('../utils') const supertest = require('supertest') // In this test we always assume that we are Alice @@ -20,24 +20,20 @@ describe('API', () => { webid: true, multiuser: false, skipWelcomePage: true, + skipInitLocalRp: true, configPath } - const alicePod = Solid.createServer( - Object.assign({ - root: aliceRootPath, - serverUri: aliceServerUri, - dbPath: aliceDbPath - }, serverConfig) - ) - - function startServer (pod, port) { - return new Promise((resolve) => { - pod.listen(port, () => { resolve() }) - }) - } + let alicePod before(async () => { + alicePod = await Solid.createServer( + Object.assign({ + root: aliceRootPath, + serverUri: aliceServerUri, + dbPath: aliceDbPath + }, serverConfig) + ) await startServer(alicePod, 5000) alice = supertest(aliceServerUri) }) diff --git a/test/integration/errors-oidc-test.js b/test/integration/errors-oidc-test.js index 831f3c8e..ee2787cb 100644 --- a/test/integration/errors-oidc-test.js +++ b/test/integration/errors-oidc-test.js @@ -1,36 +1,38 @@ const supertest = require('supertest') const ldnode = require('../../index') const path = require('path') +const { promisify } = require('util') const { cleanDir } = require('../utils') const expect = require('chai').expect describe('OIDC error handling', function () { const serverUri = 'https://localhost:3457' - var ldpHttpsServer const rootPath = path.join(__dirname, '../resources/accounts/errortests') const configPath = path.join(__dirname, '../resources/config') const dbPath = path.join(__dirname, '../resources/accounts/db') - const ldp = ldnode.createServer({ - root: rootPath, - configPath, - sslKey: path.join(__dirname, '../keys/key.pem'), - sslCert: path.join(__dirname, '../keys/cert.pem'), - auth: 'oidc', - webid: true, - multiuser: false, - skipWelcomePage: true, - dbPath, - serverUri - }) + let ldp - before(function (done) { - ldpHttpsServer = ldp.listen(3457, done) + before(async () => { + ldp = await ldnode.createServer({ + root: rootPath, + configPath, + sslKey: path.join(__dirname, '../keys/key.pem'), + sslCert: path.join(__dirname, '../keys/cert.pem'), + auth: 'oidc', + webid: true, + multiuser: false, + skipWelcomePage: true, + skipInitLocalRp: true, + dbPath, + serverUri + }) + await promisify(ldp.listen.bind(ldp))(3457) }) after(function () { - if (ldpHttpsServer) ldpHttpsServer.close() cleanDir(rootPath) + ldp.close() }) const server = supertest(serverUri) diff --git a/test/integration/formats-test.js b/test/integration/formats-test.js index 31533394..175d43ec 100644 --- a/test/integration/formats-test.js +++ b/test/integration/formats-test.js @@ -3,14 +3,19 @@ var ldnode = require('../../index') var path = require('path') const assert = require('chai').assert -describe('formats', function () { - var ldp = ldnode.createServer({ - root: path.join(__dirname, '../resources'), - skipWelcomePage: true, - webid: false +describe('formats', () => { + let ldp, server + + before(async () => { + ldp = await ldnode.createServer({ + root: path.join(__dirname, '../resources'), + skipWelcomePage: true, + webid: false + }) + + server = supertest(ldp) }) - var server = supertest(ldp) describe('HTML', function () { it('should return HTML containing "Hello, World!" if Accept is set to text/html', function (done) { server.get('/hello.html') diff --git a/test/integration/header-test.js b/test/integration/header-test.js index 2089004b..3a1a11ac 100644 --- a/test/integration/header-test.js +++ b/test/integration/header-test.js @@ -8,12 +8,13 @@ const serverOptions = { multiuser: false, webid: true, skipWelcomePage: true, + skipInitLocalRp: true, sslKey: path.join(__dirname, '../keys/key.pem'), sslCert: path.join(__dirname, '../keys/cert.pem'), forceUser: 'https://ruben.verborgh.org/profile/#me' } -describe('Header handler', () => { +describe.skip('Header handler', () => { let request before(() => { diff --git a/test/integration/http-copy-test.js b/test/integration/http-copy-test.js index 1fe0016c..96555a2d 100644 --- a/test/integration/http-copy-test.js +++ b/test/integration/http-copy-test.js @@ -2,34 +2,33 @@ var assert = require('chai').assert var fs = require('fs') var request = require('request') var path = require('path') +const { promisify } = require('util') // Helper functions for the FS var rm = require('./../utils').rm var solidServer = require('../../index') describe('HTTP COPY API', function () { - var address = 'https://localhost:3456' + const address = 'https://localhost:3456' - var ldpHttpsServer - var ldp = solidServer.createServer({ - root: path.join(__dirname, '../resources/accounts/localhost/'), - sslKey: path.join(__dirname, '../keys/key.pem'), - sslCert: path.join(__dirname, '../keys/cert.pem'), - webid: false, - skipWelcomePage: true, - serverUri: address - }) + let ldp - before(function (done) { - ldpHttpsServer = ldp.listen(3456, done) + before(async () => { + ldp = await solidServer.createServer({ + root: path.join(__dirname, '../resources/accounts/localhost/'), + sslKey: path.join(__dirname, '../keys/key.pem'), + sslCert: path.join(__dirname, '../keys/cert.pem'), + webid: false, + skipWelcomePage: true, + serverUri: address + }) + await promisify(ldp.listen.bind(ldp))(3456) }) - after(function () { - if (ldpHttpsServer) ldpHttpsServer.close() + after(async () => { // Clean up after COPY API tests - return Promise.all([ - rm('/accounts/localhost/sampleUser1Container/nicola-copy.jpg') - ]) + await rm('/accounts/localhost/sampleUser1Container/nicola-copy.jpg') + ldp.close() }) var userCredentials = { @@ -55,16 +54,19 @@ describe('HTTP COPY API', function () { return options } - it('should create the copied resource', function (done) { + it('should create the copied resource', (done) => { var copyFrom = '/samplePublicContainer/nicola.jpg' var copyTo = '/sampleUser1Container/nicola-copy.jpg' var uri = address + copyTo var options = createOptions('COPY', uri, 'user1') options.headers.Source = copyFrom + request(uri, options, function (error, response) { assert.equal(error, null) assert.equal(response.statusCode, 201) - assert.ok(copyTo.endsWith(response.headers.location)) + + assert.equal(response.headers.location, + 'https://localhost:3456/sampleUser1Container/nicola-copy.jpg') const destinationPath = path.join(__dirname, '../resources/accounts/localhost', copyTo) assert.ok(fs.existsSync(destinationPath), 'Resource created via COPY should exist') diff --git a/test/integration/http-test.js b/test/integration/http-test.js index d26dd640..2196d5c6 100644 --- a/test/integration/http-test.js +++ b/test/integration/http-test.js @@ -11,12 +11,16 @@ chai.use(require('dirty-chai')) const { ACL_SUFFIX, META_SUFFIX } = require('../../lib/defaults') -const ldpServer = ldnode.createServer({ - root: path.join(__dirname, '../resources'), - skipWelcomePage: true, - webid: false +let ldpServer, server + +before(async () => { + ldpServer = await ldnode.createServer({ + root: path.join(__dirname, '../resources'), + skipWelcomePage: true, + webid: false + }) + server = supertest(ldpServer) }) -const server = supertest(ldpServer) /** * Creates a new test basic container via an LDP POST diff --git a/test/integration/ldp-file-store-test.js b/test/integration/ldp-file-store-test.js index 4f49bed6..6a9bf6c1 100644 --- a/test/integration/ldp-file-store-test.js +++ b/test/integration/ldp-file-store-test.js @@ -1,4 +1,5 @@ const chai = require('chai') +chai.use(require('dirty-chai')) const { expect } = chai chai.should() // const rdf = require('rdflib') diff --git a/test/integration/oidc-manager-test.js b/test/integration/oidc-manager-test.js index 3b003335..4019bc5b 100644 --- a/test/integration/oidc-manager-test.js +++ b/test/integration/oidc-manager-test.js @@ -14,13 +14,14 @@ chai.should() const { OidcManager } = require('../../lib/authentication/oidc-manager') const SolidHost = require('../../lib/solid-host') -const dbPath = path.resolve(__dirname, '../db/oidc') +const dbPath = path.resolve(__dirname, '../resources/temp/db/oidc') const serverUri = 'https://example.com' describe('OidcManager (integration tests)', () => { beforeEach(() => { fs.removeSync(dbPath) fs.mkdirpSync(dbPath) + fs.mkdirpSync(path.join(dbPath, 'op')) }) after(() => { @@ -85,7 +86,6 @@ describe('OidcManager (integration tests)', () => { }) .then(() => { const providerConfig = oidc.loadProviderConfig() - expect(providerConfig.issuer).to.equal(serverUri) expect(providerConfig.authorization_endpoint).to.exist() expect(providerConfig.keys).to.exist() diff --git a/test/integration/patch-sparql-update-test.js b/test/integration/patch-sparql-update-test.js index e75f5738..835d8c39 100644 --- a/test/integration/patch-sparql-update-test.js +++ b/test/integration/patch-sparql-update-test.js @@ -10,13 +10,17 @@ var { rm, write, read } = require('../utils') describe.skip('PATCH through application/sparql-update', function () { // Starting LDP - var ldp = ldnode({ - root: path.join(__dirname, '../resources/sampleContainer'), - mount: '/test', - skipWelcomePage: true, - webid: false + let ldp, server + + before(async () => { + ldp = await ldnode({ + root: path.join(__dirname, '../resources/sampleContainer'), + mount: '/test', + skipWelcomePage: true, + webid: false + }) + server = supertest(ldp) }) - var server = supertest(ldp) it('should create a new file if file does not exist', function (done) { rm('sampleContainer/notExisting.ttl') diff --git a/test/integration/patch-test.js b/test/integration/patch-test.js index e0a243fd..cb12b461 100644 --- a/test/integration/patch-test.js +++ b/test/integration/patch-test.js @@ -2,6 +2,7 @@ const { assert } = require('chai') const ldnode = require('../../index') const path = require('path') +const { promisify } = require('util') const supertest = require('supertest') const fs = require('fs') const { read, rm, backup, restore } = require('../utils') @@ -17,6 +18,7 @@ const serverOptions = { serverUri, multiuser: false, skipWelcomePage: true, + skipInitLocalRp: true, webid: true, sslKey: path.join(__dirname, '../keys/key.pem'), sslCert: path.join(__dirname, '../keys/cert.pem'), @@ -24,13 +26,12 @@ const serverOptions = { } describe('PATCH', () => { - var request - let server + let server, request // Start the server - before(done => { - server = ldnode.createServer(serverOptions) - server.listen(port, done) + before(async () => { + server = await ldnode.createServer(serverOptions) + await promisify(server.listen.bind(server))(port) request = supertest(serverUri) }) diff --git a/test/resources/accounts-scenario/alice/db/oidc/op/clients/_key_2d7c299a1aa8e8cadb6a0bb93b6e7873.json b/test/resources/accounts-scenario/alice/db/oidc/op/clients/_key_2d7c299a1aa8e8cadb6a0bb93b6e7873.json deleted file mode 100644 index 491a9fb8..00000000 --- a/test/resources/accounts-scenario/alice/db/oidc/op/clients/_key_2d7c299a1aa8e8cadb6a0bb93b6e7873.json +++ /dev/null @@ -1 +0,0 @@ -{"client_id":"2d7c299a1aa8e8cadb6a0bb93b6e7873","client_secret":"b2926a0f21cec49c906b7b7956cc44ce","redirect_uris":["https://localhost:7000/api/oidc/rp/https%3A%2F%2Flocalhost%3A7000"],"response_types":["code","id_token token","code id_token token"],"grant_types":["authorization_code","implicit","refresh_token","client_credentials"],"application_type":"web","client_name":"Solid OIDC RP for https://localhost:7000","id_token_signed_response_alg":"RS256","token_endpoint_auth_method":"client_secret_basic","default_max_age":86400,"post_logout_redirect_uris":["https://localhost:7000/goodbye"],"frontchannel_logout_session_required":false} \ No newline at end of file diff --git a/test/resources/accounts-scenario/alice/db/oidc/op/clients/_key_370f34992ebf2d00bc6b4a2bd3dd77fd.json b/test/resources/accounts-scenario/alice/db/oidc/op/clients/_key_370f34992ebf2d00bc6b4a2bd3dd77fd.json deleted file mode 100644 index d68fbeca..00000000 --- a/test/resources/accounts-scenario/alice/db/oidc/op/clients/_key_370f34992ebf2d00bc6b4a2bd3dd77fd.json +++ /dev/null @@ -1 +0,0 @@ -{"client_id":"370f34992ebf2d00bc6b4a2bd3dd77fd","client_secret":"1fbd9aa5561f242e7f9b1f95910a722d","redirect_uris":["https://localhost:7001/api/oidc/rp/https%3A%2F%2Flocalhost%3A7000"],"response_types":["code","id_token token","code id_token token"],"grant_types":["authorization_code","implicit","refresh_token","client_credentials"],"application_type":"web","client_name":"Solid OIDC RP for https://localhost:7000","id_token_signed_response_alg":"RS256","token_endpoint_auth_method":"client_secret_basic","default_max_age":86400,"post_logout_redirect_uris":["https://localhost:7001/goodbye"],"frontchannel_logout_session_required":false} \ No newline at end of file diff --git a/test/resources/accounts-scenario/alice/db/oidc/rp/clients/_key_https%3A%2F%2Flocalhost%3A7000.json b/test/resources/accounts-scenario/alice/db/oidc/rp/clients/_key_https%3A%2F%2Flocalhost%3A7000.json deleted file mode 100644 index 64bca5b7..00000000 --- a/test/resources/accounts-scenario/alice/db/oidc/rp/clients/_key_https%3A%2F%2Flocalhost%3A7000.json +++ /dev/null @@ -1 +0,0 @@ -{"provider":{"url":"https://localhost:7000","configuration":{"issuer":"https://localhost:7000","authorization_endpoint":"https://localhost:7000/authorize","token_endpoint":"https://localhost:7000/token","userinfo_endpoint":"https://localhost:7000/userinfo","jwks_uri":"https://localhost:7000/jwks","registration_endpoint":"https://localhost:7000/register","response_types_supported":["code","code token","code id_token","id_token","id_token token","code id_token token","none"],"response_modes_supported":["query","fragment"],"grant_types_supported":["authorization_code","implicit","refresh_token","client_credentials"],"subject_types_supported":["public"],"id_token_signing_alg_values_supported":["RS256","RS384","RS512","none"],"token_endpoint_auth_methods_supported":["client_secret_basic"],"token_endpoint_auth_signing_alg_values_supported":["RS256"],"display_values_supported":[],"claim_types_supported":["normal"],"claims_supported":[],"claims_parameter_supported":false,"request_parameter_supported":true,"request_uri_parameter_supported":false,"require_request_uri_registration":false,"check_session_iframe":"https://localhost:7000/session","end_session_endpoint":"https://localhost:7000/logout"},"jwks":{"keys":[{"kid":"exSw1tC0jPw","kty":"RSA","alg":"RS256","n":"stiawfAYMau0L6VtUt2DCt9ytp0JnpjBlf8oujcPJsZ7IGNl4cq9VDEkm6WKxiaQ5aHwjrIF4EtW97Q1LwUIloiLgYvgBj6ADV1Zfa7-KDIoSE1nH1Uz8NWbPwaJ4dsjDQUa8EOGPAHjw1zgmCnOd70lIvqM8MnNjg9haut3tUhrILOmo3ubExawkvtp7GdiUqwSGo5K7s1WcKP4nQgd8SNxVMBFAyWC380_ZXcPL9SKgDsw9DIExmMVDjmaPn4orF3zivqVfU0VHi7z6ObNnBia2U6FK-M-j1-nPVNXW2En2xrtJ-nnGoAzasQ__GkC0XpYLyjv_4kuGkEFUwN1Bw","e":"AQAB","key_ops":["verify"],"ext":true},{"kid":"XHWy74gIj2o","kty":"RSA","alg":"RS384","n":"rPDDwDbxtk6wV4cVi5jhTDMyP6MisKZypSm6-JQ1sMGjY2TcwVAMugIsDdY6hpcWvfGR8uJymCmnNvHrYOKsMqCEmexXoGBg-gqsuitjzxQUQfmulcD5MGrbsuGVpmuPKQ9lkT0BjdTplKtrKvBqIrdWCIp5wivh0NxI3tqb7eEzMc1rJQ781SKlQAxM5BLghLoZpdUiyHl1sKYH5ofs7Qqn-MBagFMtmy8Fl0YrnX2CSKM6xwGOlqm6dbVGpLiOdBLzfL-9ICyg1zurxWOUSIKosBY_dNUdx3e9QdsbHD74kKCEYe-BEvgj8t_dnEST_8g4hmxEeevOdSuAkDE-eQ","e":"AQAB","key_ops":["verify"],"ext":true},{"kid":"1pWK9Xv5qtw","kty":"RSA","alg":"RS512","n":"2Pxvhef0LSwCNFjBnBnTeRnN_kc1G_frzLCTqyPMow8jICVmK_-44QlOi860J12rnSGYi-UWOtg5ZRTnNCAakMnXtqajjPQ4PxmcMkrkdCfhyShYMjmqTICGUPfOujX3d_oc3l-SSpBeQdpSejecaoyIAmR4Ra7x37PWiZgw2b3Ss-TMeL8iufc6221gNDAzmOlQmVby0SXz43Jf1WbUnRLBygAGmcD18CSawNSQL2lZMRtaFlTikZ5Nz9dbzUS5U8btg99u9cOL1wL6xLnMX2MdYImF_ThtDdFW-Q3_Xj8xYJIUinMKSyPofk0yOD5F0OcjR2IIp828BO42htb8lQ","e":"AQAB","key_ops":["verify"],"ext":true},{"kid":"hE56feUj3HU","kty":"RSA","alg":"RS256","n":"5UAby9SJp2vDnV8ZIq7E5HHtGYKbAVwTmzYSxbdcMBhJScoY2HX2-N8cqZNIf6RhE7ipimVkbYeXXX795DtnbCN9Jcl8iKbWBLDe6ozHyQ-ZEuzdWe8gSi6HGwCW3ECfN8dXUbS72BIvID1KAe2LoQQuyRx1A9nlHQCJao31w7-y17h-j13_X5YhmVBYmLwmQI-3yOI4AYGFgwEuuS347X6bDk4IoSSLVieM65SAL9djs_ZzIyXrV5BEf7eY-zCazRt7vdqn11W_aM-JdyS5xDrsgwVPhaksU50vgPOjfzbOLVALvEDQ-sxCuT1Ic6S3I9zrVq6SzORW7vZtiKn_YQ","e":"AQAB","key_ops":["verify"],"ext":true},{"kid":"TcucFsr7B9c","kty":"RSA","alg":"RS384","n":"yNViaNYveaDftUVYRQmi1JbzBBk-uvOeQ-4vr_levpAMCVFrtEWN5A6jWmhbD4B3nvAn9828cjt1697nNPOIbF2hzRWCZIfsN5YJUbhseREb05ZL5TLlv5TkHj3sdhpmQqcd6JWcCQDIbaiZeLdQ-Ljm5dbckZlsJc1eJ96mlXVlQ3VaLbrEJThXjJ_YtPfMq1vUAzHpq-OF4yhGoTzvcVEswiH0tyTDobmaQuGJq1DabTC0-Vt4TpmlxOHLgCU5-ofehHaIeLqwRUrl6n5gKo0CX-7a8qvGYNX14X0Iq_1CjhP1Q8619wcFfXESFgitl7EQrncfCx8TrtdOIuFGeQ","e":"AQAB","key_ops":["verify"],"ext":true},{"kid":"7cB0RYQoGVA","kty":"RSA","alg":"RS512","n":"s75H3KlbQgGFLGf_oqYC-cv0-iQ6iRi4bDs1x00taHeTJQPazYJny-plYxi3OU7U9kCChS3v2zIIiAb5IOHI9nxTtfra2p1-VNIEe8YLqpJsYbie5uXSGXNahHIsZNjYO0kdTg-WkUZOR2jyeSUPOggp2zNBM_9UUUhLWWVKE_SHshm4vbHJIxIZfDmwLhZEUwvgwO1-b-VAitNd4kQXfbg2KSxXPb7_pRK9qV2KJJJ4k4K2oa7tFfilXwB1FDZnPgPLxI7dmzwgwekngXJ5PfQrVvsUDBe9mZUH2wanZ5q3W9qF7yLQYbMi8l9O8CQYHLstSNNMDc4okYZQY-HCcQ","e":"AQAB","key_ops":["verify"],"ext":true},{"kid":"_KGGowgYPwQ","kty":"RSA","alg":"RS256","n":"pp5I4Ubud6110-hIvfFsosJLSn-OrrW1C2ck5751GydxikI6sQnMlqbAS1yjyZSWRYPKWR8vD5NRp-EKP2Hd0dS1hA9_hNeQ4JKCcvmlOpmy07ckpr4fg6G-l501-36u2pnH5lJJGvA84xlaEfcqH3urHhsPbrZaurCOhiBPON6ek2GF_H1sYvdzflQ0E0k5ibwHNdVE85Ou8Uvzw58eDl0uhlwpRPg_k_zQFyeNK8MyDTcnExR13xU4IcnQPz3VdjC6BnOZWDE_GmspCE_4apd3bSFEHcV9C4v1PCLqQurBXTs0vgvfWML9UnSqWoGlnkczpYGgtujnnsxRpWFmCQ","e":"AQAB","key_ops":["verify"],"ext":true}]}},"defaults":{"authenticate":{"response_type":"id_token token","display":"page","scope":["openid"]}},"registration":{"client_id":"2d7c299a1aa8e8cadb6a0bb93b6e7873","client_secret":"b2926a0f21cec49c906b7b7956cc44ce","redirect_uris":["https://localhost:7000/api/oidc/rp/https%3A%2F%2Flocalhost%3A7000"],"response_types":["code","id_token token","code id_token token"],"grant_types":["authorization_code","implicit","refresh_token","client_credentials"],"application_type":"web","client_name":"Solid OIDC RP for https://localhost:7000","id_token_signed_response_alg":"RS256","token_endpoint_auth_method":"client_secret_basic","default_max_age":86400,"post_logout_redirect_uris":["https://localhost:7000/goodbye"],"frontchannel_logout_session_required":false,"registration_access_token":"eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJodHRwczovL2xvY2FsaG9zdDo3MDAwIiwic3ViIjoiMmQ3YzI5OWExYWE4ZThjYWRiNmEwYmI5M2I2ZTc4NzMiLCJhdWQiOiIyZDdjMjk5YTFhYThlOGNhZGI2YTBiYjkzYjZlNzg3MyJ9.FL7GfVjf1faSrKg6G7EmQyGFpprHf-Djw06kLypEu9__g2ozzSgxPzo2cgHWGc5gNQ9D5FU-unwZmx354WvIk0DvU4GF_sDhG5gfVgRUiwNgKzgyaxl87aoUG4jYfwHDYwvZLXCPIuoCD7iB2u4cD_NYhK2u6OQST9bRSTlelrXN0MyJbDy1eItY6ys8yH0Yw-584SK6ksZh2NmjvBr73znmVI0xHdv80ntcrfagw-G1PK79OG_DH_wjPqoUI9yUxpY2AjnLkqbraQIwT6Uwx0eFNCj7OwVVoIOkxdDMCargpSHF1jvBBL8wsXqppuEy0YhHYIfU6POFZBofRJrKtQ","registration_client_uri":"https://localhost:7000/register/2d7c299a1aa8e8cadb6a0bb93b6e7873","client_id_issued_at":1489773557,"client_secret_expires_at":0}} diff --git a/test/resources/accounts-scenario/bob/db/oidc/rp/clients/_key_https%3A%2F%2Flocalhost%3A7000.json b/test/resources/accounts-scenario/bob/db/oidc/rp/clients/_key_https%3A%2F%2Flocalhost%3A7000.json deleted file mode 100644 index 0df32c0d..00000000 --- a/test/resources/accounts-scenario/bob/db/oidc/rp/clients/_key_https%3A%2F%2Flocalhost%3A7000.json +++ /dev/null @@ -1 +0,0 @@ -{"provider":{"url":"https://localhost:7000","configuration":{"issuer":"https://localhost:7000","authorization_endpoint":"https://localhost:7000/authorize","token_endpoint":"https://localhost:7000/token","userinfo_endpoint":"https://localhost:7000/userinfo","jwks_uri":"https://localhost:7000/jwks","registration_endpoint":"https://localhost:7000/register","response_types_supported":["code","code token","code id_token","id_token","id_token token","code id_token token","none"],"response_modes_supported":["query","fragment"],"grant_types_supported":["authorization_code","implicit","refresh_token","client_credentials"],"subject_types_supported":["public"],"id_token_signing_alg_values_supported":["RS256","RS384","RS512","none"],"token_endpoint_auth_methods_supported":["client_secret_basic"],"token_endpoint_auth_signing_alg_values_supported":["RS256"],"display_values_supported":[],"claim_types_supported":["normal"],"claims_supported":[],"claims_parameter_supported":false,"request_parameter_supported":true,"request_uri_parameter_supported":false,"require_request_uri_registration":false,"check_session_iframe":"https://localhost:7000/session","end_session_endpoint":"https://localhost:7000/logout"},"jwks":{"keys":[{"kid":"exSw1tC0jPw","kty":"RSA","alg":"RS256","n":"stiawfAYMau0L6VtUt2DCt9ytp0JnpjBlf8oujcPJsZ7IGNl4cq9VDEkm6WKxiaQ5aHwjrIF4EtW97Q1LwUIloiLgYvgBj6ADV1Zfa7-KDIoSE1nH1Uz8NWbPwaJ4dsjDQUa8EOGPAHjw1zgmCnOd70lIvqM8MnNjg9haut3tUhrILOmo3ubExawkvtp7GdiUqwSGo5K7s1WcKP4nQgd8SNxVMBFAyWC380_ZXcPL9SKgDsw9DIExmMVDjmaPn4orF3zivqVfU0VHi7z6ObNnBia2U6FK-M-j1-nPVNXW2En2xrtJ-nnGoAzasQ__GkC0XpYLyjv_4kuGkEFUwN1Bw","e":"AQAB","key_ops":["verify"],"ext":true},{"kid":"XHWy74gIj2o","kty":"RSA","alg":"RS384","n":"rPDDwDbxtk6wV4cVi5jhTDMyP6MisKZypSm6-JQ1sMGjY2TcwVAMugIsDdY6hpcWvfGR8uJymCmnNvHrYOKsMqCEmexXoGBg-gqsuitjzxQUQfmulcD5MGrbsuGVpmuPKQ9lkT0BjdTplKtrKvBqIrdWCIp5wivh0NxI3tqb7eEzMc1rJQ781SKlQAxM5BLghLoZpdUiyHl1sKYH5ofs7Qqn-MBagFMtmy8Fl0YrnX2CSKM6xwGOlqm6dbVGpLiOdBLzfL-9ICyg1zurxWOUSIKosBY_dNUdx3e9QdsbHD74kKCEYe-BEvgj8t_dnEST_8g4hmxEeevOdSuAkDE-eQ","e":"AQAB","key_ops":["verify"],"ext":true},{"kid":"1pWK9Xv5qtw","kty":"RSA","alg":"RS512","n":"2Pxvhef0LSwCNFjBnBnTeRnN_kc1G_frzLCTqyPMow8jICVmK_-44QlOi860J12rnSGYi-UWOtg5ZRTnNCAakMnXtqajjPQ4PxmcMkrkdCfhyShYMjmqTICGUPfOujX3d_oc3l-SSpBeQdpSejecaoyIAmR4Ra7x37PWiZgw2b3Ss-TMeL8iufc6221gNDAzmOlQmVby0SXz43Jf1WbUnRLBygAGmcD18CSawNSQL2lZMRtaFlTikZ5Nz9dbzUS5U8btg99u9cOL1wL6xLnMX2MdYImF_ThtDdFW-Q3_Xj8xYJIUinMKSyPofk0yOD5F0OcjR2IIp828BO42htb8lQ","e":"AQAB","key_ops":["verify"],"ext":true},{"kid":"hE56feUj3HU","kty":"RSA","alg":"RS256","n":"5UAby9SJp2vDnV8ZIq7E5HHtGYKbAVwTmzYSxbdcMBhJScoY2HX2-N8cqZNIf6RhE7ipimVkbYeXXX795DtnbCN9Jcl8iKbWBLDe6ozHyQ-ZEuzdWe8gSi6HGwCW3ECfN8dXUbS72BIvID1KAe2LoQQuyRx1A9nlHQCJao31w7-y17h-j13_X5YhmVBYmLwmQI-3yOI4AYGFgwEuuS347X6bDk4IoSSLVieM65SAL9djs_ZzIyXrV5BEf7eY-zCazRt7vdqn11W_aM-JdyS5xDrsgwVPhaksU50vgPOjfzbOLVALvEDQ-sxCuT1Ic6S3I9zrVq6SzORW7vZtiKn_YQ","e":"AQAB","key_ops":["verify"],"ext":true},{"kid":"TcucFsr7B9c","kty":"RSA","alg":"RS384","n":"yNViaNYveaDftUVYRQmi1JbzBBk-uvOeQ-4vr_levpAMCVFrtEWN5A6jWmhbD4B3nvAn9828cjt1697nNPOIbF2hzRWCZIfsN5YJUbhseREb05ZL5TLlv5TkHj3sdhpmQqcd6JWcCQDIbaiZeLdQ-Ljm5dbckZlsJc1eJ96mlXVlQ3VaLbrEJThXjJ_YtPfMq1vUAzHpq-OF4yhGoTzvcVEswiH0tyTDobmaQuGJq1DabTC0-Vt4TpmlxOHLgCU5-ofehHaIeLqwRUrl6n5gKo0CX-7a8qvGYNX14X0Iq_1CjhP1Q8619wcFfXESFgitl7EQrncfCx8TrtdOIuFGeQ","e":"AQAB","key_ops":["verify"],"ext":true},{"kid":"7cB0RYQoGVA","kty":"RSA","alg":"RS512","n":"s75H3KlbQgGFLGf_oqYC-cv0-iQ6iRi4bDs1x00taHeTJQPazYJny-plYxi3OU7U9kCChS3v2zIIiAb5IOHI9nxTtfra2p1-VNIEe8YLqpJsYbie5uXSGXNahHIsZNjYO0kdTg-WkUZOR2jyeSUPOggp2zNBM_9UUUhLWWVKE_SHshm4vbHJIxIZfDmwLhZEUwvgwO1-b-VAitNd4kQXfbg2KSxXPb7_pRK9qV2KJJJ4k4K2oa7tFfilXwB1FDZnPgPLxI7dmzwgwekngXJ5PfQrVvsUDBe9mZUH2wanZ5q3W9qF7yLQYbMi8l9O8CQYHLstSNNMDc4okYZQY-HCcQ","e":"AQAB","key_ops":["verify"],"ext":true},{"kid":"_KGGowgYPwQ","kty":"RSA","alg":"RS256","n":"pp5I4Ubud6110-hIvfFsosJLSn-OrrW1C2ck5751GydxikI6sQnMlqbAS1yjyZSWRYPKWR8vD5NRp-EKP2Hd0dS1hA9_hNeQ4JKCcvmlOpmy07ckpr4fg6G-l501-36u2pnH5lJJGvA84xlaEfcqH3urHhsPbrZaurCOhiBPON6ek2GF_H1sYvdzflQ0E0k5ibwHNdVE85Ou8Uvzw58eDl0uhlwpRPg_k_zQFyeNK8MyDTcnExR13xU4IcnQPz3VdjC6BnOZWDE_GmspCE_4apd3bSFEHcV9C4v1PCLqQurBXTs0vgvfWML9UnSqWoGlnkczpYGgtujnnsxRpWFmCQ","e":"AQAB","key_ops":["verify"],"ext":true}]}},"defaults":{"authenticate":{"response_type":"id_token token","display":"page","scope":["openid"]}},"registration":{"client_id":"370f34992ebf2d00bc6b4a2bd3dd77fd","client_secret":"1fbd9aa5561f242e7f9b1f95910a722d","redirect_uris":["https://localhost:7001/api/oidc/rp/https%3A%2F%2Flocalhost%3A7000"],"response_types":["code","id_token token","code id_token token"],"grant_types":["authorization_code","implicit","refresh_token","client_credentials"],"application_type":"web","client_name":"Solid OIDC RP for https://localhost:7000","id_token_signed_response_alg":"RS256","token_endpoint_auth_method":"client_secret_basic","default_max_age":86400,"post_logout_redirect_uris":["https://localhost:7001/goodbye"],"frontchannel_logout_session_required":false,"registration_access_token":"eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJodHRwczovL2xvY2FsaG9zdDo3MDAwIiwic3ViIjoiMzcwZjM0OTkyZWJmMmQwMGJjNmI0YTJiZDNkZDc3ZmQiLCJhdWQiOiIzNzBmMzQ5OTJlYmYyZDAwYmM2YjRhMmJkM2RkNzdmZCJ9.HkMGXV33JfSf5VFF3eY2XdEnH1KkG911-1MSoAcHaUjkXRJCW1KB1l0ofMEqBeHb3mC4iC8xZ3TP4F5kz2fPDQvAZe3v-LNjO2N8vCEpnT3HhKQnRitsA2zx0V6_aiGCDSyTavXK27OmSYwNs50RZQeSBjy76hjsS_sHu7_W42UDVn-beMkKpOhHnHddrir75JcmkUh1YqYMgopClQkt-Y22kdAQ3of2l17_QVDSUxatUEUVDSj76p8MAkYxb2YTdwULb-9fhQoYsy9JJphf59Bn5L26MlFlL9OgBYZRwVE8zvlGdyxllcgs4nSQbziOuQmArfQV3L0r-m8zDZYykw","registration_client_uri":"https://localhost:7000/register/370f34992ebf2d00bc6b4a2bd3dd77fd","client_id_issued_at":1489773628,"client_secret_expires_at":0}} diff --git a/test/resources/accounts-scenario/bob/db/oidc/rp/clients/_key_https%3A%2F%2Flocalhost%3A7001.json b/test/resources/accounts-scenario/bob/db/oidc/rp/clients/_key_https%3A%2F%2Flocalhost%3A7001.json deleted file mode 100644 index 862d7c9f..00000000 --- a/test/resources/accounts-scenario/bob/db/oidc/rp/clients/_key_https%3A%2F%2Flocalhost%3A7001.json +++ /dev/null @@ -1 +0,0 @@ -{"provider":{"url":"https://localhost:7001","configuration":{"issuer":"https://localhost:7001","authorization_endpoint":"https://localhost:7001/authorize","token_endpoint":"https://localhost:7001/token","userinfo_endpoint":"https://localhost:7001/userinfo","jwks_uri":"https://localhost:7001/jwks","registration_endpoint":"https://localhost:7001/register","response_types_supported":["code","code token","code id_token","id_token","id_token token","code id_token token","none"],"response_modes_supported":["query","fragment"],"grant_types_supported":["authorization_code","implicit","refresh_token","client_credentials"],"subject_types_supported":["public"],"id_token_signing_alg_values_supported":["RS256","RS384","RS512","none"],"token_endpoint_auth_methods_supported":["client_secret_basic"],"token_endpoint_auth_signing_alg_values_supported":["RS256"],"display_values_supported":[],"claim_types_supported":["normal"],"claims_supported":[],"claims_parameter_supported":false,"request_parameter_supported":true,"request_uri_parameter_supported":false,"require_request_uri_registration":false,"check_session_iframe":"https://localhost:7001/session","end_session_endpoint":"https://localhost:7001/logout"},"jwks":{"keys":[{"kid":"ysNKuDh7-rk","kty":"RSA","alg":"RS256","n":"wvMeFsXkedSC_tnFgzvSHSYqoki9d95_l6Rm3hcwNknOkaycrrJketqeE4oSq_H4curUdPjUXYwu5e5LSoEZERLNElTXY10MUpu_he0DrhlsnWbBlzm6e3YuPr3MZlO_beQhpVtTnPTTeOZgOnUK9A44uqIzWoh7uaiU5uRi5JrZFtVpk2KGp49o68IXkSvhd0BkFaEBB4r-BSjpWwXKeu9Y1Tp2V7C5pKpXHZwOzI4LZru-QoTARlLKGsFPxTjK1E47N76dy1usoKLu6Xs0toaiXnxNUTLPk4ERg1kk93mvHkiIDsP-jVawJh-bhWLXQEEm7lbAV0IkcySqiJaKkw","e":"AQAB","key_ops":["verify"],"ext":true},{"kid":"Y8dNW6a_V18","kty":"RSA","alg":"RS384","n":"xQNISCAVvlsB4VTHq9HQcDf3PxF7D9DvnTNYPtXAxTIXx5bXVX4WxJU2xSTkYtN0k-yAMXQed9MAYNKsNwD7NAO7RV7m6jCSIgD1FEu3V6iEeliMetL4CfIe_Vn7Rb37lSI-gKaNMwBVIcYoAy7xOXLxxpSFJ5t357HbJnd3p0cgvx13sfyz-WyxqMLWY5IdxktwS-tdxUmpsk6M2xbcJB97c4h4afrfxp68ZB4fznC23aos6QUm7DLhGOURJAdwQTebUre9J6Vy3BXfKNpXb62AGpzPLGDzt-c-kQ05ckEzo9ZZZVC6l-DfMryb5rLZKlMKTefzL12ricSRcltcZw","e":"AQAB","key_ops":["verify"],"ext":true},{"kid":"BSILu2VUSq8","kty":"RSA","alg":"RS512","n":"2OyR9CUp2B3_XrC1rwx3CxvsGenGyyjj5i_BMUyi8biEAu7N3aZ7AxvaSVtYGeWCWDRmPE2XImoEDtLBdG3wlOroOlRvgGnd3hlajqswIRgy3dmmbVETNqqJJQefc5tRESsA3VHKz04H3trcibo-ycM5HRc3cGXdWExg2XQUxkmOXKVCUEBnMpeWGlAG-QUGjGP3DVZ0V6-ldQXH_lP1ftt5zTWusOp0iyrLbvX7eWduVlfGsIHYNi3cVJdAxbZXUMwOwyHn3HUrlCDi1tc8_x8-pq2SgQhTrJQVF3D8UExYV_k6cTQOXRqJgz7LcISYyWULm8FM2NYWGl12MCMqqQ","e":"AQAB","key_ops":["verify"],"ext":true},{"kid":"xuMN0hE4aNA","kty":"RSA","alg":"RS256","n":"xs-BOX2tAPab_6ftuKFJNqJJPAMf6NnGEt_KPEuQKlS6Eoqxd1Sl3V6y8mj7g4TTg7Yb0JT0GjUmKs61cJww6w4JIQepzAKb_LT-mrOjckWTDC4lUSYm8IX-tfFDUKhkYh-rOQz7rNQ13BKQ_MHKGY3_imzp5tRvevkbwHzGjHRVMPKzRFBm20O5_IOSCFLYp0dIi-zKK7gSpZFfMW6ZoAoZiOhBoRhNFs-XJ6UUcAifNmpxnCDM9KJBGv7YCVroYnyt7pz0xSrab72ZGPQQo5EqnjvckO1ACQuekJfOCQ0c2yVd48y-W_wTDvSn1ZKOdecTE0BbQg2P-h1HYN3RFw","e":"AQAB","key_ops":["verify"],"ext":true},{"kid":"hrVDwDlmtBc","kty":"RSA","alg":"RS384","n":"na2HnmI9weG040vd5v8mC9RkfzKmil-GtZxUNtCndW3MV_55x5yBund_TSo_rDHrlKm_ZvVWhvkhHtteZ-V_Yv521zA_vVaFVwCGQ0-KXSRW6GtereabW835tb23nQWItRepT1SX4Z_7tpS-_anpVVwaKvUqEJcUptFfkGICP98yMnemGkAR-ejLVNSElh4u9FU6q8Y4wBuBv_VRtcFanUcsnSDWIjCL0YyKZ1Ow7FqvGjpglBHsfzeWFyX2Hn2JZvozWNMGGm77ietL7fsPfvfAilrHXXFNk0Oso8DtQnj6Ft1oXLUyZijSiTN7AubpdaylW7tjbkXf42ZmPadjvw","e":"AQAB","key_ops":["verify"],"ext":true},{"kid":"5DeLhvjbXpU","kty":"RSA","alg":"RS512","n":"xH5VCmySFeekK1oYflMd6XWV9PsNP8JBUbwhR0Uq4ANRPVdhzFc1N8GInEl-XWgBU9CYtLhMB4CrgRiFgSQPU7AUmYfmmaZ4ScGQItpIHcL5TSELw5ncQTmv4TYTEksvvESm-ihRbN6Irhrm-_izjzXZd1yRlpZJL-e4L5CGlIl4s1_ZwhHoF79Nw0_ql4Awn4hJQiZzdJnaJ36ltSVfIN750Glyv9MGVATpwKSsEtIiDHw8szcLXv04wPdmwTcblhgrSrgbPTn4YHpjmq6I6iFJz3sJEAGT-XbB7PdEC3Snk9CC8iJzaF-DrRVbp2BIi4Vo51AC1NPgESDU8lSWmQ","e":"AQAB","key_ops":["verify"],"ext":true},{"kid":"5lqnxcDvwtY","kty":"RSA","alg":"RS256","n":"nSn6UV7vgCImW0PExOhWUOqtT4_SM1ZShwN-Ti-4sIfiRgaOw1_Wf4PAHkqQmTp8xiOZhDOfe2NTDGhP0VENkwILPs_kdHq-Pm-4Qq4tx9nSEKdjq1XlEP99wmtmMQOSBdenwzkKzkXMMSROOqs3iItablA2vFnVfjZUsEioDikn6sQIg7nwQT6Sf76w1wv5uYrVlc-nU6FPh_08-h5C_IL2QNpbRBHM1BKtZEH2njDnSKVNFzwuwDfnjRtKwOtAmOwxxO0xXZHlDZYYE4tAlbAX1anJj_mjWxoLDPwQKvZCMw_XPLY3jo5nsSGOX2bBCWsZsZcbs_Cg0t58DldC2w","e":"AQAB","key_ops":["verify"],"ext":true}]}},"defaults":{"authenticate":{"response_type":"id_token token","display":"page","scope":["openid"]}},"registration":{"client_id":"eafafc5103e5b15ba06c3bed7c5dc3df","client_secret":"5eac22a963328151a139206a35036b17","redirect_uris":["https://localhost:7001/api/oidc/rp/https%3A%2F%2Flocalhost%3A7001"],"response_types":["code","id_token token","code id_token token"],"grant_types":["authorization_code","implicit","refresh_token","client_credentials"],"application_type":"web","client_name":"Solid OIDC RP for https://localhost:7001","id_token_signed_response_alg":"RS256","token_endpoint_auth_method":"client_secret_basic","default_max_age":86400,"post_logout_redirect_uris":["https://localhost:7001/goodbye"],"frontchannel_logout_session_required":false,"registration_access_token":"eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJodHRwczovL2xvY2FsaG9zdDo3MDAxIiwic3ViIjoiZWFmYWZjNTEwM2U1YjE1YmEwNmMzYmVkN2M1ZGMzZGYiLCJhdWQiOiJlYWZhZmM1MTAzZTViMTViYTA2YzNiZWQ3YzVkYzNkZiJ9.atRg3STosJx0a9FV8cadbr0TpccgdTwqjsKQQYFv1hwDptgJr_WPYfp5mpUvNfr-Q7M4Ege5mONmw-JKa9rkqGzB5EOsEuJs1CfXZcFPjNZU10X_3iDnZik6eqYDVHmpwJrgVm3GIM3sN1VDqyksVUyr-Dd6vNbVnnHZOFHUpcZBSkvOb6bensDlgQ6TpZ-45TtPNgeHHjmhaL3t0xFeVABjUBLg_38yrxP_-Tylc7KMZVNCQCCDgGkgHBPyzf9KwHv8UU_MvHtQzYlV4_2u14iz9mLbMvbGMWv9akdGCfwZDldThbVSfmt_lz3dfRNivGGRnJNec9tdP2wT4mv4uQ","registration_client_uri":"https://localhost:7001/register/eafafc5103e5b15ba06c3bed7c5dc3df","client_id_issued_at":1489773546,"client_secret_expires_at":0}} diff --git a/test/unit/oidc-manager-test.js b/test/unit/oidc-manager-test.js index 98cef7aa..b3251c18 100644 --- a/test/unit/oidc-manager-test.js +++ b/test/unit/oidc-manager-test.js @@ -169,8 +169,6 @@ describe('OidcManager', () => { oidc.initProvider() expect(oidc.provider.issuer).to.equal(providerUri) - const storePath = oidc.provider.backend.path - expect(storePath.endsWith('oidc-mgr/op')).to.be.true() expect(oidc.provider.host.authenticate).to.equal(host.authenticate) expect(loadProviderConfig).to.have.been.called() }) From 55ebf9e3ef55c275ce569bf4a3d317e15277924e Mon Sep 17 00:00:00 2001 From: Dmitri Zagidulin Date: Tue, 3 Dec 2019 20:43:12 -0500 Subject: [PATCH 2/3] Use oidc-op v0.8.0. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index eefa5372..8f529e2c 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "homepage": "https://github.com/interop-alliance/life-server", "bugs": "https://github.com/interop-alliance/life-server/issues", "dependencies": { - "@interop-alliance/oidc-op": "^0.7.0", + "@interop-alliance/oidc-op": "^0.8.0", "@interop-alliance/oidc-rp": "^0.11.1", "@solid/oidc-rs": "^0.4.0", "bcryptjs": "^2.4.3", From b7ef1632f03bacc365a68d219be8086c4ef414ff Mon Sep 17 00:00:00 2001 From: Dmitri Zagidulin Date: Tue, 3 Dec 2019 21:13:09 -0500 Subject: [PATCH 3/3] Fix failing tests. --- lib/authentication/oidc-manager.js | 1 + test/integration/account-creation-oidc-test.js | 3 +++ 2 files changed, 4 insertions(+) diff --git a/lib/authentication/oidc-manager.js b/lib/authentication/oidc-manager.js index 2cde1fc4..32578f48 100644 --- a/lib/authentication/oidc-manager.js +++ b/lib/authentication/oidc-manager.js @@ -392,6 +392,7 @@ class OidcManager { saveProviderConfig () { const configPath = this.providerConfigPath() + fs.ensureDirSync(this.storePaths.providerStore) fs.writeFileSync(configPath, JSON.stringify(this.provider, null, 2)) } diff --git a/test/integration/account-creation-oidc-test.js b/test/integration/account-creation-oidc-test.js index 6fe134f7..51ce279b 100644 --- a/test/integration/account-creation-oidc-test.js +++ b/test/integration/account-creation-oidc-test.js @@ -171,12 +171,14 @@ describe('Single User signup page', () => { const rootDir = path.join(__dirname, '../resources/accounts/single-user/') const configPath = path.join(__dirname, '../resources/config') const server = supertest(serverUri) + const dbPath = path.join(__dirname, '../resources/temp/7457/db') before(async () => { ldp = await ldnode.createServer({ port, root: rootDir, configPath, + dbPath, sslKey: path.join(__dirname, '../keys/key.pem'), sslCert: path.join(__dirname, '../keys/cert.pem'), webid: true, @@ -189,6 +191,7 @@ describe('Single User signup page', () => { after(() => { fs.removeSync(rootDir) + fs.removeSync(dbPath) ldp.close() })