everyauth icon indicating copy to clipboard operation
everyauth copied to clipboard

Best way to selectively bypass/ignore everyauth middleware

Open mhuebert opened this issue 13 years ago • 2 comments

I'd like to avoid the overhead of everyauth middleware for some of my routes, which don't require authentication and shouldn't be querying my database (findUserById..)

I've got a hack working whereby I use custom middleware to declare unauthenticated routes before the everyauth middleware, using switch/when statements to pass queries to my controllers based on req.originalUrl. (Using normal express route declaration would break my other routes if declared before everyauth middleware). Afterwards, I include the express helpers, and then declare routes which require authentication.

My issues:

  1. I'd like to be able to use standard express syntax for declaring all my routes
  2. The recent changes to everyauth which implicitly add helpers/middleware may interfere with my hack, because I'm not sure how to explicitly position the express middleware in the middleware chain

mhuebert avatar Apr 08 '12 17:04 mhuebert

+1 - me too

iatek avatar Jun 25 '12 22:06 iatek

+1 - would be great to be able to provide custom middleware to the auth and callback routes.

jzabel avatar Mar 12 '13 23:03 jzabel