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

This middleware is provided by Flitter-auth. It will redirect the user back to their previous location if the does not have the specified permission.


(async) test(req, res, next, permission)


Run the middleware's check. If an authenticated session exists and the user has the specified permission, 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. If the permission doesn't exist, show a 401.

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.

permission string

Name of the permission to require