@@ -8,25 +8,6 @@ import 'package:flutter_news_app_api_server_full_source_code/src/rbac/permission
88import 'package:flutter_news_app_api_server_full_source_code/src/rbac/permissions.dart' ;
99import 'package:flutter_news_app_api_server_full_source_code/src/registry/model_registry.dart' ;
1010
11- /// Middleware specific to the generic `/api/v1/data` route path.
12- ///
13- /// This middleware chain performs the following in order:
14- /// 1. **Authentication Check (`requireAuthentication` ):** Ensures that the user
15- /// is authenticated. If not, it aborts the request with a 401.
16- /// 2. **Data Rate Limiting (`_dataRateLimiterMiddleware` ):** Applies a
17- /// configurable, user-centric rate limit. Bypassed by admin/publisher roles.
18- /// 3. **Model Validation & Context Provision (`_modelValidationAndProviderMiddleware` ):**
19- /// - Validates the `model` query parameter.
20- /// - Looks up the `ModelConfig` from the `ModelRegistryMap`.
21- /// - Provides the `ModelConfig` and `modelName` into the request context.
22- /// 4. **Authorization Check (`authorizationMiddleware` ):** Enforces role-based
23- /// and model-specific permissions based on the `ModelConfig` metadata.
24- /// If the user lacks permission, it throws a [ForbiddenException].
25- ///
26- /// This setup ensures that data routes are protected, have the necessary
27- /// model-specific configuration available, and access is authorized before
28- /// reaching the final route handler.
29-
3011// Helper middleware for applying rate limiting to the data routes.
3112Middleware _dataRateLimiterMiddleware () {
3213 return (handler) {
0 commit comments