RequireAuth

flitter-auth/deploy/routing/middleware/RequireAuth~ RequireAuth

This middleware is provided by Flitter-auth. It will redirect the user back to their previous location if the does not contain a user object.

Constructor

new RequireAuth()

Source:

Methods

test(req, res, next)

Source:

Run the middleware's check. If an authenticated session exists, let the request continue. If an authenticated session doesn't exist, write the destination to the session and redirect the user to the login page.

Parameters:
Name Type Description
req Express/Request

the incoming Express request

res Express/Response

the corresponding Express response

next function

Express handler stack callback. This should be called if the middleware check passed to allow the request to continue.