CoreID/app/routing/middleware/auth/DMZOnly.middleware.js

18 lines
437 B
JavaScript
Raw Normal View History

2020-04-22 21:56:39 +00:00
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