How kdcllc/tokenflow works
Main Components
a) External Systems:
• Azure Active Directory (for device flow authentication)
• Azure Container App (hosting environment)
• Azure Blob Storage (state management)
b) Application Components:
• FastAPI Web Server
• Authentication Layer
• Token Management System
• API Endpoints Layer
┌─ Client Layer ─────────────────────────┐
• HTTP Clients │
• Azure CLI │
• ┬─┘
• ↓ │
┌─ Security Layer ────────────────────┼─┐
• X-Auth-Token Validation │ │
• Device Code Flow Authentication │ │
• ┘
• ↓
┌─ API Layer ──────────────────────────┐
• Health Check Endpoint │
• Device Code Endpoint │
• Token Management Endpoints │
• Subscription Management │
• ┘
• ↓
┌─ External Services ──────────────────┐
• Azure AD │
• Azure Resource Management API │
• Azure Blob Storage │
• ┘
Key Relationships to Highlight
a) Authentication Flow:
• Client → Security Layer (X-Auth-Token validation)
• Security Layer → Azure AD (device code flow)
• Token Management → Azure AD (token refresh/validation)
b) Data Flow:
• API Layer → Azure Blob Storage (state persistence)
• API Layer → Azure Resource Management (resource operations)
Implementation Details
• FastAPI framework (main application server)
• Authentication middleware (src/auth_middleware.py)
• Token authenticator (src/token_authenticator.py)
• REST endpoints (shown in /rest directory)
Deployment Context
• Containerization boundary (Docker)
• Azure Container App hosting environment
• External dependency connections
This design should reflect the application's primary purpose of managing Azure authentication and resource access across multiple tenants, while showing the security measures in place to protect these operations.