class

ExpressAuthTagger

Inherits PrefixScope < FrameworkTagger < FileHelper < Tagger < Reference < Object

Constants

AUTH_MIDDLEWARE_NAMES = [/\brequireAuth\b/, /\bisAuth\b/, /\bisAuthenticated\b/, /\bensureLoggedIn\b/, /\bensureAuthenticated\b/, /\bauthorize\b/, /\brequireLogin\b/, /\bauthMiddleware\b/, /\bverifyToken\b/, /\bcheckAuth\b/]
BARE_USE = /\b(\w+)\.use\s*\(/

x.use(authMiddleware) — no path argument. Which routes this guards is a property of the object x, not of any URL, so the receiver is captured.

JWT_MIDDLEWARE_PATTERNS = [/expressjwt\s*\(/, /expressJwt\s*\(/]
MOUNTED_USE = /(?:app|router)\.use\s*\(\s*['"]([^'"]+)['"]/

app.use('/prefix', authMiddleware) — the guarded path is spelled out, so the rule can be matched against endpoint URLs anywhere in the scan (the routes it guards are usually mounted from another file).

PASSPORT_PATTERNS = [/passport\.authenticate\s*\(/]
ROUTE_DECLARATION = /\.\s*(?:get|post|put|patch|delete|options|head|all|use|route)\s*\(/

The start of a route registration, used as a statement boundary so a window around one route never reads the next one's middleware.

ROUTE_RECEIVER = /\b(\w+)\s*\.\s*(?:get|post|put|patch|delete|options|head|all|use|route)\s*\(/

A route registration, and who it was registered on: app.get('/x', …), router.post(…), app.route('/x').

Constructors

new(options : Hash(String, YAML::Any))
Source

Class methods

target_techs
Source

Instance methods

perform(endpoints : Array(Endpoint)) : Array(Endpoint)

The per-endpoint shape: look at each endpoint, tag in place, hand the array back. Fifteen framework taggers carried a byte-identical copy of this; they now declare only check_endpoint.

Not every framework tagger fits it — eleven still override perform because they need a pre-scan over the project (config files, middleware registration) before the per-endpoint pass, or they group endpoints first. Those keep their own.

Source