From 4fdd29259c55342934de91b10ace62d4862dbf7f Mon Sep 17 00:00:00 2001 From: Scott Bender Date: Wed, 31 Mar 2021 15:53:58 -0400 Subject: [PATCH] chore: fix lint errors --- src/pipedproviders.js | 38 ++++++++++++++++++++++++-------------- src/serverroutes.js | 3 +-- src/tokensecurity.js | 6 +++--- 3 files changed, 28 insertions(+), 19 deletions(-) diff --git a/src/pipedproviders.js b/src/pipedproviders.js index c201507df..5974c40ae 100644 --- a/src/pipedproviders.js +++ b/src/pipedproviders.js @@ -18,7 +18,7 @@ const deep = require('deep-get-set') const DevNull = require('dev-null-stream') const _ = require('lodash') -module.exports = function (app) { +module.exports = function(app) { function createPipedProvider(providerConfig) { const { propertyValues, ...sanitizedApp } = app const emitPropertyValue = (name, value) => @@ -30,22 +30,29 @@ module.exports = function (app) { }) const onPropertyValues = (name, cb) => app.propertyValues.onPropertyValues(name, cb) - const appFacade = { emitPropertyValue, onPropertyValues, ...sanitizedApp, toJSON: () => 'appFacade' } + const appFacade = { + emitPropertyValue, + onPropertyValues, + ...sanitizedApp, + toJSON: () => 'appFacade' + } const result = { id: providerConfig.id, pipeElements: providerConfig.pipeElements.reduce((res, config) => { if (typeof config.enabled === 'undefined' || config.enabled) { - res.push(createPipeElement({ - ...config, - options: { - providerId: providerConfig.id, - app: appFacade, - ...config.options, - emitPropertyValue, - onPropertyValues - } - })) + res.push( + createPipeElement({ + ...config, + options: { + providerId: providerConfig.id, + app: appFacade, + ...config.options, + emitPropertyValue, + onPropertyValues + } + }) + ) } return res }, []) @@ -65,9 +72,12 @@ module.exports = function (app) { function createPipeElement(elementConfig) { if (elementConfig.optionMappings) { - elementConfig.optionMappings.forEach(function (mapping) { + elementConfig.optionMappings.forEach(function(mapping) { if (deep(app, mapping.fromAppProperty)) { - elementConfig.options[mapping.toOption] = deep(app, mapping.fromAppProperty) + elementConfig.options[mapping.toOption] = deep( + app, + mapping.fromAppProperty + ) } }) } diff --git a/src/serverroutes.js b/src/serverroutes.js index 057187f6d..c7ad14beb 100644 --- a/src/serverroutes.js +++ b/src/serverroutes.js @@ -142,10 +142,9 @@ module.exports = function(app, saveSecurityConfig, getSecurityConfig) { app.put(`${SERVERROUTESPREFIX}/security/config`, (req, res, next) => { if (app.securityStrategy.allowConfigure(req)) { - try { app.securityStrategy.validateConfiguration(req.body) - } catch ( err ) { + } catch (err) { res.status(400).send(err.message) return } diff --git a/src/tokensecurity.js b/src/tokensecurity.js index c6878d179..4e3e3c22f 100644 --- a/src/tokensecurity.js +++ b/src/tokensecurity.js @@ -329,15 +329,15 @@ module.exports = function(app, config) { }) }) } - - strategy.validateConfiguration = ( newConfiguration ) => { + + strategy.validateConfiguration = newConfiguration => { const configuration = getConfiguration() const theExpiration = newConfiguration.expiration || '1h' jwt.sign('dummyPayload', configuration.secretKey, { expiresIn: theExpiration }) } - + strategy.getAuthRequiredString = () => { return strategy.allowReadOnly() ? 'forwrite' : 'always' }