Files
speckle-server/packages/server/modules/auth/index.js
T
Dimitrie Stefanescu 75d2924de5 feat(server): starts work on #62
scaffolds basic server invite logic
2021-03-14 11:40:42 +00:00

27 lines
776 B
JavaScript

'use strict'
let debug = require( 'debug' )
const appRoot = require( 'app-root-path' )
const { registerOrUpdateScope } = require( `${appRoot}/modules/shared` )
exports.init = async ( app, options ) => {
debug( 'speckle:modules' )( '🔑 Init auth module' )
// Initialise authn strategies
exports.authStrategies = await require( './strategies' )( app )
// Hoist auth routes
require( './rest' )( app )
// Register core-based scoeps
const scopes = require( './scopes.js' )
for ( let 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' )()
}