Macro
AuthMiddleware(_:using:body:)
Groups authenticated routes using a controller’s middleware property or factory.
@freestanding(declaration) macro AuthMiddleware<T, Controller>(_ authenticationType: T.Type, using middleware: (Controller) -> any Middleware, body: () -> Void) where T : Authenticatable
Overview
For example, #AuthMiddleware(User.self, using: \Self.authentication) { ... }. A factory runs during route registration, once for each route in the group.