@@ -266,25 +266,12 @@ Handler middleware(Handler handler) {
266
266
),
267
267
) // Used by AuthService
268
268
269
- // --- 4. Authentication Middleware (User Context Population) ---
270
- // PURPOSE: Reads the `Authorization: Bearer <token>` header, validates
271
- // the token using `AuthTokenService`, and provides the
272
- // resulting `User?` object into the context.
273
- // ORDER: Empirically found to work best in this position.
274
- // While it reads `AuthTokenService` (provided in the next step),
275
- // this order is critical for correct runtime behavior. The
276
- // `AuthTokenService` instance is created before the chain and
277
- // captured by its provider closure. Should come BEFORE any
278
- // route handlers that need `context.read<User?>()`.
279
- .use (authenticationProvider ())
280
-
281
- // --- 5. Authentication Service Providers (Auth Logic Dependencies) ---
269
+ // --- 4. Authentication Service Providers (Auth Logic Dependencies) ---
282
270
// PURPOSE: Provide the core services needed for authentication logic.
283
- // ORDER: These MUST be provided BEFORE any route handlers that perform
284
- // authentication/authorization.
271
+ // ORDER: These MUST be provided BEFORE `authenticationProvider` and
272
+ // any route handlers that perform authentication/authorization.
285
273
// - `Uuid` is used by `AuthService` and `JwtAuthTokenService`.
286
- // - `AuthTokenService` is used by `AuthService` and read by
287
- // `authenticationProvider` (previous step).
274
+ // - `AuthTokenService` is read by `authenticationProvider`.
288
275
// - `AuthService` uses several repositories and `AuthTokenService`.
289
276
// - `VerificationCodeStorageService` is used by `AuthService`.
290
277
// - `TokenBlacklistService` is used by `JwtAuthTokenService`.
@@ -310,7 +297,7 @@ Handler middleware(Handler handler) {
310
297
),
311
298
) // Reads other services/repos
312
299
313
- // --- 6 . Request Logger (Logging) ---
300
+ // --- 5 . Request Logger (Logging) ---
314
301
// PURPOSE: Logs details about the incoming request and outgoing response.
315
302
// ORDER: Often placed late in the request phase / early in the response
316
303
// phase. Placing it here logs the request *before* the handler
0 commit comments