Files
speckle-server/packages/server/modules/auth/index.js
T
2022-05-03 13:10:00 +02:00

26 lines
693 B
JavaScript

'use strict'
const debug = require('debug')
const { registerOrUpdateScope } = require('@/modules/shared')
exports.init = async (app) => {
debug('speckle:modules')('🔑 Init auth module')
// Initialize authn strategies
exports.authStrategies = await require('./strategies')(app)
// Hoist auth routes
require('./rest')(app)
// Register core-based scopes
const scopes = require('./scopes.js')
for (const scope of scopes) {
await registerOrUpdateScope(scope)
}
}
exports.finalize = async () => {
// Note: we're registering the default apps last as we want to ensure that all
// scopes have been registered by any other modules.
await require('./defaultApps')()
}