Rename AuthAppi by AuthBackend

This commit is contained in:
Daniel García Aubert
2018-04-09 18:08:56 +02:00
parent 6167562758
commit 8dec4814a9
17 changed files with 75 additions and 75 deletions
+3 -3
View File
@@ -12,8 +12,8 @@ const DataviewBackend = require('../backends/dataview');
const TemplateMaps = require('../backends/template_maps.js');
const PgQueryRunner = require('../backends/pg_query_runner');
const StatsBackend = require('../backends/stats');
const AuthBackend = require('../backends/auth');
const AuthApi = require('../backends/api/auth_api');
const UserLimitsApi = require('../backends/api/user_limits_api');
const OverviewsMetadataApi = require('../backends/api/overviews_metadata_api');
const FilterStatsApi = require('../backends/api/filter_stats_api');
@@ -113,7 +113,7 @@ module.exports = class ApiRouter {
rateLimitsEnabled: global.environment.enabledFeatures.rateLimitsEnabled
}
});
const authApi = new AuthApi(pgConnection, metadataBackend, mapStore, templateMaps);
const authBackend = new AuthBackend(pgConnection, metadataBackend, mapStore, templateMaps);
const layergroupAffectedTablesCache = new LayergroupAffectedTablesCache();
@@ -164,7 +164,7 @@ module.exports = class ApiRouter {
mapStore,
userLimitsApi,
layergroupAffectedTablesCache,
authApi,
authBackend,
surrogateKeysCache,
templateMaps,
mapBackend,
@@ -8,9 +8,9 @@ const { RATE_LIMIT_ENDPOINTS_GROUPS } = rateLimit;
const cacheControlHeader = require('../middlewares/cache-control-header');
const dbParamsFromResLocals = require('../../utils/database-params');
function AnalysesController(pgConnection, authApi, userLimitsApi) {
function AnalysesController(pgConnection, authBackend, userLimitsApi) {
this.pgConnection = pgConnection;
this.authApi = authApi;
this.authBackend = authBackend;
this.userLimitsApi = userLimitsApi;
}
@@ -20,7 +20,7 @@ AnalysesController.prototype.register = function (mapRouter) {
mapRouter.get(
`/analyses/catalog`,
credentials(),
authorize(this.authApi),
authorize(this.authBackend),
dbConnSetup(this.pgConnection),
rateLimit(this.userLimitsApi, RATE_LIMIT_ENDPOINTS_GROUPS.ANALYSIS_CATALOG),
cleanUpQueryParams(),
@@ -14,7 +14,7 @@ module.exports = class AnalysisLayergroupController {
mapStore,
userLimitsApi,
layergroupAffectedTablesCache,
authApi,
authBackend,
surrogateKeysCache
) {
this.analysisStatusBackend = analysisStatusBackend;
@@ -22,7 +22,7 @@ module.exports = class AnalysisLayergroupController {
this.mapStore = mapStore;
this.userLimitsApi = userLimitsApi;
this.layergroupAffectedTablesCache = layergroupAffectedTablesCache;
this.authApi = authApi;
this.authBackend = authBackend;
this.surrogateKeysCache = surrogateKeysCache;
}
@@ -31,7 +31,7 @@ module.exports = class AnalysisLayergroupController {
`/:token/analysis/node/:nodeId`,
layergroupToken(),
credentials(),
authorize(this.authApi),
authorize(this.authBackend),
dbConnSetup(this.pgConnection),
rateLimit(this.userLimitsApi, RATE_LIMIT_ENDPOINTS_GROUPS.ANALYSIS),
cleanUpQueryParams(),
@@ -23,7 +23,7 @@ const rateLimit = require('../middlewares/rate-limit');
const { RATE_LIMIT_ENDPOINTS_GROUPS } = rateLimit;
/**
* @param {AuthApi} authApi
* @param {AuthBackend} authBackend
* @param {PgConnection} pgConnection
* @param {TemplateMaps} templateMaps
* @param {MapBackend} mapBackend
@@ -45,7 +45,7 @@ function AnonymousMapController (
layergroupAffectedTables,
mapConfigAdapter,
statsBackend,
authApi,
authBackend,
layergroupMetadata
) {
this.pgConnection = pgConnection;
@@ -57,7 +57,7 @@ function AnonymousMapController (
this.layergroupAffectedTables = layergroupAffectedTables;
this.mapConfigAdapter = mapConfigAdapter;
this.statsBackend = statsBackend;
this.authApi = authApi;
this.authBackend = authBackend;
this.layergroupMetadata = layergroupMetadata;
}
@@ -78,7 +78,7 @@ AnonymousMapController.prototype.composeCreateMapMiddleware = function () {
return [
credentials(),
authorize(this.authApi),
authorize(this.authBackend),
dbConnSetup(this.pgConnection),
rateLimit(this.userLimitsApi, RATE_LIMIT_ENDPOINTS_GROUPS.ANONYMOUS),
cleanUpQueryParams(['aggregation']),
@@ -18,7 +18,7 @@ module.exports = class AttributesLayergroupController {
mapStore,
userLimitsApi,
layergroupAffectedTablesCache,
authApi,
authBackend,
surrogateKeysCache
) {
this.attributesBackend = attributesBackend;
@@ -26,7 +26,7 @@ module.exports = class AttributesLayergroupController {
this.mapStore = mapStore;
this.userLimitsApi = userLimitsApi;
this.layergroupAffectedTablesCache = layergroupAffectedTablesCache;
this.authApi = authApi;
this.authBackend = authBackend;
this.surrogateKeysCache = surrogateKeysCache;
}
@@ -35,7 +35,7 @@ module.exports = class AttributesLayergroupController {
`/:token/:layer/attributes/:fid`,
layergroupToken(),
credentials(),
authorize(this.authApi),
authorize(this.authBackend),
dbConnSetup(this.pgConnection),
rateLimit(this.userLimitsApi, RATE_LIMIT_ENDPOINTS_GROUPS.ATTRIBUTES),
cleanUpQueryParams(),
@@ -33,7 +33,7 @@ module.exports = class DataviewLayergroupController {
mapStore,
userLimitsApi,
layergroupAffectedTablesCache,
authApi,
authBackend,
surrogateKeysCache
) {
this.dataviewBackend = dataviewBackend;
@@ -41,7 +41,7 @@ module.exports = class DataviewLayergroupController {
this.mapStore = mapStore;
this.userLimitsApi = userLimitsApi;
this.layergroupAffectedTablesCache = layergroupAffectedTablesCache;
this.authApi = authApi;
this.authBackend = authBackend;
this.surrogateKeysCache = surrogateKeysCache;
}
@@ -53,7 +53,7 @@ module.exports = class DataviewLayergroupController {
`/:token/dataview/:dataviewName`,
layergroupToken(),
credentials(),
authorize(this.authApi),
authorize(this.authBackend),
dbConnSetup(this.pgConnection),
rateLimit(this.userLimitsApi, RATE_LIMIT_ENDPOINTS_GROUPS.DATAVIEW),
cleanUpQueryParams(ALLOWED_DATAVIEW_QUERY_PARAMS),
@@ -74,7 +74,7 @@ module.exports = class DataviewLayergroupController {
`/:token/:layer/widget/:dataviewName`,
layergroupToken(),
credentials(),
authorize(this.authApi),
authorize(this.authBackend),
dbConnSetup(this.pgConnection),
rateLimit(this.userLimitsApi, RATE_LIMIT_ENDPOINTS_GROUPS.DATAVIEW),
cleanUpQueryParams(ALLOWED_DATAVIEW_QUERY_PARAMS),
@@ -95,7 +95,7 @@ module.exports = class DataviewLayergroupController {
`/:token/dataview/:dataviewName/search`,
layergroupToken(),
credentials(),
authorize(this.authApi),
authorize(this.authBackend),
dbConnSetup(this.pgConnection),
rateLimit(this.userLimitsApi, RATE_LIMIT_ENDPOINTS_GROUPS.DATAVIEW_SEARCH),
cleanUpQueryParams(ALLOWED_DATAVIEW_QUERY_PARAMS),
@@ -116,7 +116,7 @@ module.exports = class DataviewLayergroupController {
`/:token/:layer/widget/:dataviewName/search`,
layergroupToken(),
credentials(),
authorize(this.authApi),
authorize(this.authBackend),
dbConnSetup(this.pgConnection),
rateLimit(this.userLimitsApi, RATE_LIMIT_ENDPOINTS_GROUPS.DATAVIEW_SEARCH),
cleanUpQueryParams(ALLOWED_DATAVIEW_QUERY_PARAMS),
+9 -9
View File
@@ -21,7 +21,7 @@ module.exports = class MapRouter {
mapStore,
userLimitsApi,
layergroupAffectedTablesCache,
authApi,
authBackend,
surrogateKeysCache,
templateMaps,
mapBackend,
@@ -39,7 +39,7 @@ module.exports = class MapRouter {
mapStore,
userLimitsApi,
layergroupAffectedTablesCache,
authApi,
authBackend,
surrogateKeysCache
);
@@ -49,7 +49,7 @@ module.exports = class MapRouter {
mapStore,
userLimitsApi,
layergroupAffectedTablesCache,
authApi,
authBackend,
surrogateKeysCache
);
@@ -59,7 +59,7 @@ module.exports = class MapRouter {
mapStore,
userLimitsApi,
layergroupAffectedTablesCache,
authApi,
authBackend,
surrogateKeysCache
);
@@ -69,7 +69,7 @@ module.exports = class MapRouter {
mapStore,
userLimitsApi,
layergroupAffectedTablesCache,
authApi,
authBackend,
surrogateKeysCache
);
@@ -79,7 +79,7 @@ module.exports = class MapRouter {
mapStore,
userLimitsApi,
layergroupAffectedTablesCache,
authApi,
authBackend,
surrogateKeysCache
);
@@ -93,7 +93,7 @@ module.exports = class MapRouter {
layergroupAffectedTablesCache,
mapConfigAdapter,
statsBackend,
authApi,
authBackend,
layergroupMetadata
);
@@ -104,13 +104,13 @@ module.exports = class MapRouter {
tablesExtentApi,
metadataBackend,
pgConnection,
authApi,
authBackend,
userLimitsApi
);
this.analysesController = new AnalysesCatalogController(
pgConnection,
authApi,
authBackend,
userLimitsApi
);
}
@@ -18,7 +18,7 @@ module.exports = class PreviewLayergroupController {
mapStore,
userLimitsApi,
layergroupAffectedTablesCache,
authApi,
authBackend,
surrogateKeysCache
) {
this.previewBackend = previewBackend;
@@ -26,7 +26,7 @@ module.exports = class PreviewLayergroupController {
this.mapStore = mapStore;
this.userLimitsApi = userLimitsApi;
this.layergroupAffectedTablesCache = layergroupAffectedTablesCache;
this.authApi = authApi;
this.authBackend = authBackend;
this.surrogateKeysCache = surrogateKeysCache;
}
@@ -37,7 +37,7 @@ module.exports = class PreviewLayergroupController {
`/static/center/:token/:z/:lat/:lng/:width/:height.:format`,
layergroupToken(),
credentials(),
authorize(this.authApi),
authorize(this.authBackend),
dbConnSetup(this.pgConnection),
rateLimit(this.userLimitsApi, RATE_LIMIT_ENDPOINTS_GROUPS.STATIC),
cleanUpQueryParams(['layer']),
@@ -59,7 +59,7 @@ module.exports = class PreviewLayergroupController {
`/static/bbox/:token/:west,:south,:east,:north/:width/:height.:format`,
layergroupToken(),
credentials(),
authorize(this.authApi),
authorize(this.authBackend),
dbConnSetup(this.pgConnection),
rateLimit(this.userLimitsApi, RATE_LIMIT_ENDPOINTS_GROUPS.STATIC),
cleanUpQueryParams(['layer']),
@@ -29,7 +29,7 @@ function PreviewTemplateController (
tablesExtentApi,
metadataBackend,
pgConnection,
authApi,
authBackend,
userLimitsApi
) {
this.namedMapProviderCache = namedMapProviderCache;
@@ -38,7 +38,7 @@ function PreviewTemplateController (
this.tablesExtentApi = tablesExtentApi;
this.metadataBackend = metadataBackend;
this.pgConnection = pgConnection;
this.authApi = authApi;
this.authBackend = authBackend;
this.userLimitsApi = userLimitsApi;
}
@@ -48,7 +48,7 @@ PreviewTemplateController.prototype.register = function (mapRouter) {
mapRouter.get(
`/static/named/:template_id/:width/:height.:format`,
credentials(),
authorize(this.authApi),
authorize(this.authBackend),
dbConnSetup(this.pgConnection),
rateLimit(this.userLimitsApi, RATE_LIMIT_ENDPOINTS_GROUPS.STATIC_NAMED),
cleanUpQueryParams(['layer', 'zoom', 'lon', 'lat', 'bbox']),
@@ -28,7 +28,7 @@ module.exports = class TileLayergroupController {
mapStore,
userLimitsApi,
layergroupAffectedTablesCache,
authApi,
authBackend,
surrogateKeysCache
) {
this.tileBackend = tileBackend;
@@ -36,7 +36,7 @@ module.exports = class TileLayergroupController {
this.mapStore = mapStore;
this.userLimitsApi = userLimitsApi;
this.layergroupAffectedTablesCache = layergroupAffectedTablesCache;
this.authApi = authApi;
this.authBackend = authBackend;
this.surrogateKeysCache = surrogateKeysCache;
}
@@ -50,7 +50,7 @@ module.exports = class TileLayergroupController {
`/:token/:z${number()}/:x${number()}/:y${number()}@:scale_factor${number()}?x.:format`,
layergroupToken(),
credentials(),
authorize(this.authApi),
authorize(this.authBackend),
dbConnSetup(this.pgConnection),
rateLimit(this.userLimitsApi, RATE_LIMIT_ENDPOINTS_GROUPS.TILE),
cleanUpQueryParams(),
@@ -75,7 +75,7 @@ module.exports = class TileLayergroupController {
`/:token/:z${number()}/:x${number()}/:y${number()}.:format`,
layergroupToken(),
credentials(),
authorize(this.authApi),
authorize(this.authBackend),
dbConnSetup(this.pgConnection),
rateLimit(this.userLimitsApi, RATE_LIMIT_ENDPOINTS_GROUPS.TILE),
cleanUpQueryParams(),
@@ -100,7 +100,7 @@ module.exports = class TileLayergroupController {
`/:token${not('static')}/:layer/:z${number()}/:x${number()}/:y${number()}.(:format)`,
layergroupToken(),
credentials(),
authorize(this.authApi),
authorize(this.authBackend),
dbConnSetup(this.pgConnection),
rateLimit(this.userLimitsApi, RATE_LIMIT_ENDPOINTS_GROUPS.TILE),
cleanUpQueryParams(),
+2 -2
View File
@@ -1,6 +1,6 @@
module.exports = function authorize (authApi) {
module.exports = function authorize (authBackend) {
return function authorizeMiddleware (req, res, next) {
authApi.authorize(req, res, (err, authorized) => {
authBackend.authorize(req, res, (err, authorized) => {
req.profiler.done('authorize');
if (err) {
@@ -4,13 +4,13 @@ const rateLimit = require('../middlewares/rate-limit');
const { RATE_LIMIT_ENDPOINTS_GROUPS } = rateLimit;
/**
* @param {AuthApi} authApi
* @param {AuthBackend} authBackend
* @param {PgConnection} pgConnection
* @param {TemplateMaps} templateMaps
* @constructor
*/
function AdminTemplateController(authApi, templateMaps, userLimitsApi) {
this.authApi = authApi;
function AdminTemplateController(authBackend, templateMaps, userLimitsApi) {
this.authBackend = authBackend;
this.templateMaps = templateMaps;
this.userLimitsApi = userLimitsApi;
}
@@ -23,7 +23,7 @@ AdminTemplateController.prototype.register = function (templateRouter) {
templateRouter.post(
`/`,
credentials(),
authorizedByAPIKey({ authApi: this.authApi, action: 'create', label: 'POST TEMPLATE' }),
authorizedByAPIKey({ authBackend: this.authBackend, action: 'create', label: 'POST TEMPLATE' }),
rateLimit(this.userLimitsApi, RATE_LIMIT_ENDPOINTS_GROUPS.NAMED_CREATE),
checkContentType({ action: 'POST', label: 'POST TEMPLATE' }),
createTemplate({ templateMaps: this.templateMaps })
@@ -32,7 +32,7 @@ AdminTemplateController.prototype.register = function (templateRouter) {
templateRouter.put(
`/:template_id`,
credentials(),
authorizedByAPIKey({ authApi: this.authApi, action: 'update', label: 'PUT TEMPLATE' }),
authorizedByAPIKey({ authBackend: this.authBackend, action: 'update', label: 'PUT TEMPLATE' }),
rateLimit(this.userLimitsApi, RATE_LIMIT_ENDPOINTS_GROUPS.NAMED_UPDATE),
checkContentType({ action: 'PUT', label: 'PUT TEMPLATE' }),
updateTemplate({ templateMaps: this.templateMaps })
@@ -41,7 +41,7 @@ AdminTemplateController.prototype.register = function (templateRouter) {
templateRouter.get(
`/:template_id`,
credentials(),
authorizedByAPIKey({ authApi: this.authApi, action: 'get', label: 'GET TEMPLATE' }),
authorizedByAPIKey({ authBackend: this.authBackend, action: 'get', label: 'GET TEMPLATE' }),
rateLimit(this.userLimitsApi, RATE_LIMIT_ENDPOINTS_GROUPS.NAMED_GET),
retrieveTemplate({ templateMaps: this.templateMaps })
);
@@ -49,7 +49,7 @@ AdminTemplateController.prototype.register = function (templateRouter) {
templateRouter.delete(
`/:template_id`,
credentials(),
authorizedByAPIKey({ authApi: this.authApi, action: 'delete', label: 'DELETE TEMPLATE' }),
authorizedByAPIKey({ authBackend: this.authBackend, action: 'delete', label: 'DELETE TEMPLATE' }),
rateLimit(this.userLimitsApi, RATE_LIMIT_ENDPOINTS_GROUPS.NAMED_DELETE),
destroyTemplate({ templateMaps: this.templateMaps })
);
@@ -57,7 +57,7 @@ AdminTemplateController.prototype.register = function (templateRouter) {
templateRouter.get(
`/`,
credentials(),
authorizedByAPIKey({ authApi: this.authApi, action: 'list', label: 'GET TEMPLATE LIST' }),
authorizedByAPIKey({ authBackend: this.authBackend, action: 'list', label: 'GET TEMPLATE LIST' }),
rateLimit(this.userLimitsApi, RATE_LIMIT_ENDPOINTS_GROUPS.NAMED_LIST),
listTemplates({ templateMaps: this.templateMaps })
);
@@ -75,11 +75,11 @@ function checkContentType ({ action, label }) {
};
}
function authorizedByAPIKey ({ authApi, action, label }) {
function authorizedByAPIKey ({ authBackend, action, label }) {
return function authorizedByAPIKeyMiddleware (req, res, next) {
const { user } = res.locals;
authApi.authorizedByAPIKey(user, res, (err, authenticated) => {
authBackend.authorizedByAPIKey(user, res, (err, authenticated) => {
if (err) {
return next(err);
}
@@ -21,7 +21,7 @@ const rateLimit = require('../middlewares/rate-limit');
const { RATE_LIMIT_ENDPOINTS_GROUPS } = rateLimit;
/**
* @param {AuthApi} authApi
* @param {AuthBackend} authBackend
* @param {PgConnection} pgConnection
* @param {TemplateMaps} templateMaps
* @param {MapBackend} mapBackend
@@ -43,7 +43,7 @@ function NamedMapController (
layergroupAffectedTables,
mapConfigAdapter,
statsBackend,
authApi,
authBackend,
layergroupMetadata
) {
this.pgConnection = pgConnection;
@@ -55,7 +55,7 @@ function NamedMapController (
this.layergroupAffectedTables = layergroupAffectedTables;
this.mapConfigAdapter = mapConfigAdapter;
this.statsBackend = statsBackend;
this.authApi = authApi;
this.authBackend = authBackend;
this.layergroupMetadata = layergroupMetadata;
}
@@ -82,7 +82,7 @@ NamedMapController.prototype.composeInstantiateTemplateMiddleware = function ()
return [
credentials(),
authorize(this.authApi),
authorize(this.authBackend),
dbConnSetup(this.pgConnection),
rateLimit(this.userLimitsApi, RATE_LIMIT_ENDPOINTS_GROUPS.NAMED),
cleanUpQueryParams(['aggregation']),
+4 -4
View File
@@ -16,7 +16,7 @@ module.exports = class TemplateRouter {
layergroupAffectedTablesCache,
mapConfigAdapter,
statsBackend,
authApi,
authBackend,
layergroupMetadata,
namedMapProviderCache,
tileBackend,
@@ -32,7 +32,7 @@ module.exports = class TemplateRouter {
layergroupAffectedTablesCache,
mapConfigAdapter,
statsBackend,
authApi,
authBackend,
layergroupMetadata
);
@@ -41,12 +41,12 @@ module.exports = class TemplateRouter {
tileBackend,
surrogateKeysCache,
pgConnection,
authApi,
authBackend,
userLimitsApi
);
this.adminTemplateController = new AdminTemplateController(
authApi,
authBackend,
templateMaps,
userLimitsApi
);
@@ -16,14 +16,14 @@ function TileTemplateController (
tileBackend,
surrogateKeysCache,
pgConnection,
authApi,
authBackend,
userLimitsApi
) {
this.namedMapProviderCache = namedMapProviderCache;
this.tileBackend = tileBackend;
this.surrogateKeysCache = surrogateKeysCache;
this.pgConnection = pgConnection;
this.authApi = authApi;
this.authBackend = authBackend;
this.userLimitsApi = userLimitsApi;
}
@@ -33,7 +33,7 @@ TileTemplateController.prototype.register = function (templateRouter) {
templateRouter.get(
`/:template_id/:layer/:z/:x/:y.(:format)`,
credentials(),
authorize(this.authApi),
authorize(this.authBackend),
dbConnSetup(this.pgConnection),
rateLimit(this.userLimitsApi, RATE_LIMIT_ENDPOINTS_GROUPS.NAMED_TILES),
cleanUpQueryParams(),
@@ -7,16 +7,16 @@ var _ = require('underscore'); // AUTH_FALLBACK
* @param {MapStore} mapStore
* @param {TemplateMaps} templateMaps
* @constructor
* @type {AuthApi}
* @type {AuthBackend}
*/
function AuthApi(pgConnection, metadataBackend, mapStore, templateMaps) {
function AuthBackend(pgConnection, metadataBackend, mapStore, templateMaps) {
this.pgConnection = pgConnection;
this.metadataBackend = metadataBackend;
this.mapStore = mapStore;
this.templateMaps = templateMaps;
}
module.exports = AuthApi;
module.exports = AuthBackend;
// Check if the user is authorized by a signer
//
@@ -25,7 +25,7 @@ module.exports = AuthApi;
// null if the request is not signed by anyone
// or will be a string cartodb username otherwise.
//
AuthApi.prototype.authorizedBySigner = function(req, res, callback) {
AuthBackend.prototype.authorizedBySigner = function(req, res, callback) {
if ( ! res.locals.token || ! res.locals.signer ) {
return callback(null, false); // no signer requested
}
@@ -60,7 +60,7 @@ function isValidApiKey(apikey) {
// @param callback function(err, authorized)
// NOTE: authorized is expected to be 0 or 1 (integer)
//
AuthApi.prototype.authorizedByAPIKey = function(user, res, callback) {
AuthBackend.prototype.authorizedByAPIKey = function(user, res, callback) {
const apikeyToken = res.locals.api_key;
const basicAuthUsername = res.locals.basicAuthUsername;
@@ -160,7 +160,7 @@ function usernameMatches (basicAuthUsername, requestUsername) {
* @param res - standard res object. Contains the auth parameters in locals
* @param callback function(err, allowed) is access allowed not?
*/
AuthApi.prototype.authorize = function(req, res, callback) {
AuthBackend.prototype.authorize = function(req, res, callback) {
var user = res.locals.user;
this.authorizedByAPIKey(user, res, (err, isAuthorizedByApikey) => {
+3 -3
View File
@@ -4,7 +4,7 @@ var _ = require('underscore');
var RedisPool = require('redis-mpool');
var cartodbRedis = require('cartodb-redis');
var PgConnection = require('../../../lib/cartodb/backends/pg_connection');
var AuthApi = require('../../../lib/cartodb/backends/api/auth_api');
var AuthBackend = require('../../../lib/cartodb/backends/auth');
var TemplateMaps = require('../../../lib/cartodb/backends/template_maps');
const cleanUpQueryParamsMiddleware = require('../../../lib/cartodb/api/middlewares/clean-up-query-params');
@@ -31,10 +31,10 @@ describe('prepare-context', function() {
var metadataBackend = cartodbRedis({pool: redisPool});
var pgConnection = new PgConnection(metadataBackend);
var templateMaps = new TemplateMaps(redisPool);
var authApi = new AuthApi(pgConnection, metadataBackend, mapStore, templateMaps);
var authBackend = new AuthBackend(pgConnection, metadataBackend, mapStore, templateMaps);
cleanUpQueryParams = cleanUpQueryParamsMiddleware();
authorize = authorizeMiddleware(authApi);
authorize = authorizeMiddleware(authBackend);
dbConnSetup = dbConnSetupMiddleware(pgConnection);
setCredentials = credentialsMiddleware();
});