Core Architecture (Internal)¶
Internal Implementation Details
The djangoapi_guard/core/ modules documented here are internal implementation details and should NOT be imported directly. Always use the public API.
Overview¶
DjangoAPI Guard uses a modular core architecture that separates security concerns into specialized, independently testable modules.
Module Overview¶
djangoapi_guard/core/
├── checks/ # Security check pipeline (Chain of Responsibility)
├── events/ # Event bus and metrics collection
├── initialization/ # Handler initialization logic
├── responses/ # Response creation and processing
├── routing/ # Route configuration resolution
├── validation/ # Request validation utilities
├── bypass/ # Security bypass handling
└── behavioral/ # Behavioral rule processing
Security Check Pipeline¶
17 checks execute in order:
- RouteConfigCheck - Extract route config and client IP
- EmergencyModeCheck - Emergency mode
- HttpsEnforcementCheck - HTTPS enforcement
- RequestLoggingCheck - Log request
- RequestSizeContentCheck - Validate size/content
- RequiredHeadersCheck - Check required headers
- AuthenticationCheck - Verify authentication
- ReferrerCheck - Check referrer
- CustomValidatorsCheck - Custom validators
- TimeWindowCheck - Time-based access
- CloudIpRefreshCheck - Periodic maintenance
- IpSecurityCheck - IP whitelist/blacklist
- CloudProviderCheck - Cloud provider blocking
- UserAgentCheck - User agent filtering
- RateLimitCheck - Rate limiting
- SuspiciousActivityCheck - Threat detection
- CustomRequestCheck - Custom checks
See Also¶
- DjangoAPIGuard - Main middleware documentation
- API Overview - Complete API reference
- Decorators - Route-level security decorators