+ const plugin = res.locals.registeredPlugin
+ if (!plugin.registerHelpers) {
+ return res.fail({
+ status: HttpStatusCode.NOT_FOUND_404,
+ message: 'No registered helpers were found for this plugin'
+ })
+ }
+
+ const externalAuth = plugin.registerHelpers.getExternalAuths().find(a => a.authName === req.params.authName)
+ if (!externalAuth) {
+ return res.fail({
+ status: HttpStatusCode.NOT_FOUND_404,
+ message: 'No external auths were found for this plugin'
+ })
+ }
+
+ res.locals.externalAuth = externalAuth
+
+ return next()
+ }
+]
+
+const pluginStaticDirectoryValidator = [
+ param('staticEndpoint')
+ .custom(isSafePath),
+
+ (req: express.Request, res: express.Response, next: express.NextFunction) => {