'client_authentication', // Ensure client is logged in 'rate_limit' => 'client_rate_limiting', // Apply rate limiting 'cors' => 'cors_headers', // Add CORS headers for API 'security' => 'security_headers' // Add security headers ]; /** * API versioning support * Future versions can be added here */ $api_versions = [ 'v1' => [ 'base_path' => 'clients/desk_moloni/', 'controller' => 'ClientPortalController', 'version' => '3.0.0' ] ]; /** * Rate limiting configuration * Different limits for different endpoints */ $rate_limits = [ 'documents' => [ 'window' => 60, // 1 minute 'max_requests' => 100 ], 'document_details' => [ 'window' => 30, // 30 seconds 'max_requests' => 50 ], 'document_download' => [ 'window' => 10, // 10 seconds 'max_requests' => 20 ], 'document_view' => [ 'window' => 30, // 30 seconds 'max_requests' => 100 ], 'dashboard' => [ 'window' => 60, // 1 minute 'max_requests' => 200 ], 'notifications' => [ 'window' => 60, // 1 minute 'max_requests' => 100 ], 'mark_notification' => [ 'window' => 30, // 30 seconds 'max_requests' => 50 ] ]; /** * Security configuration */ $security_config = [ 'require_https' => true, // Require HTTPS in production 'csrf_protection' => false, // CSRF not needed for API endpoints 'xss_protection' => true, // Enable XSS protection 'content_type_validation' => true, // Validate content types 'max_request_size' => '10MB', // Maximum request size 'allowed_origins' => [ 'same-origin' // Only allow same-origin requests by default ] ]; /** * Cache configuration */ $cache_config = [ 'documents_list' => [ 'ttl' => 300, // 5 minutes 'tags' => ['client_documents', 'api_cache'] ], 'document_details' => [ 'ttl' => 600, // 10 minutes 'tags' => ['document_details', 'api_cache'] ], 'dashboard' => [ 'ttl' => 1800, // 30 minutes 'tags' => ['dashboard_data', 'api_cache'] ] ]; /** * Logging configuration */ $logging_config = [ 'enabled' => true, 'log_level' => 'info', // info, warning, error 'include_request_data' => false, // Don't log sensitive request data 'include_response_data' => false, // Don't log response data 'retention_days' => 90, // Keep logs for 90 days 'anonymize_ip' => true // Anonymize IP addresses for privacy ]; /** * Error handling configuration */ $error_config = [ 'show_detailed_errors' => false, // Don't show detailed errors to clients 'error_reporting_email' => null, // Email for critical errors 'fallback_error_message' => 'An error occurred while processing your request.', 'maintenance_mode_message' => 'The document portal is temporarily unavailable for maintenance.' ]; /** * Feature flags */ $feature_flags = [ 'enable_pdf_preview' => true, 'enable_bulk_download' => false, // Future feature 'enable_document_sharing' => false, // Future feature 'enable_advanced_search' => true, 'enable_notifications' => true, 'enable_audit_logging' => true ];