CoreID/app/routing/middleware/auth/DMZOnly.middleware.js
2020-04-22 16:56:39 -05:00

18 lines
437 B
JavaScript

const Middleware = require('libflitter/middleware/Middleware')
class DMZOnly extends Middleware {
async test(req, res, next, args = {}){
if ( req.is_auth ) return next()
else {
// If not signed in, save the target url so we can redirect back here after auth
req.session.auth.flow = req.originalUrl
return res.redirect('/auth/login')
}
}
}
module.exports = DMZOnly