# doushuov21/authmanager architecture

> Architecture diagram of the GitHub repository doushuov21/authmanager, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/doushuov21/authmanager
- Repository: https://github.com/doushuov21/authmanager

## Overview

AuthManager is an Unreal Engine runtime plugin plus a FastAPI authorization backend. At launch, the plugin checks a saved offline license first; otherwise it sends machine and project details to the backend, displays a blocking authorization UI with a QR code when needed, and polls until approval. Admins can approve requests online or issue offline keys through the dashboard. The graph preserves those documented capabilities, but sampled backend routes do not establish every UI-to-route interaction, so unsupported links are omitted.

Main entry points: [`Source/AuthManager/Private/AuthManager.cpp`](https://github.com/doushuov21/authmanager/blob/main/Source/AuthManager/Private/AuthManager.cpp) (Auth lifecycle), [`Resources/Backend/routers/client.py`](https://github.com/doushuov21/authmanager/blob/main/Resources/Backend/routers/client.py) (Client authorization API), [`Resources/Backend/routers/admin.py`](https://github.com/doushuov21/authmanager/blob/main/Resources/Backend/routers/admin.py) (Admin API), [`Resources/Backend/main.py`](https://github.com/doushuov21/authmanager/blob/main/Resources/Backend/main.py) (API application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_plugin["Unreal Plugin"]
  node_runtime["Auth lifecycle<br/>[AuthManager.cpp]"]
  node_settings["Project settings"]
  node_offline["Offline license check<br/>[AuthManager.cpp]"]
  node_blocking["Blocking auth UI<br/>[AuthManager.cpp]"]
end

subgraph group_backend["Authorization Backend"]
  node_backend_app["API application<br/>[main.py]"]
  node_client_api["Client authorization API<br/>[client.py]"]
  node_crypto["License generation<br/>[crypto_utils.py]"]
end

subgraph group_admin["Admin Capabilities"]
  node_admin_api["Admin API<br/>[admin.py]"]
  node_dashboard["Admin dashboard<br/>[dashboard.html]"]
  node_mobile["Mobile approval page<br/>[mobile_auth.html]"]
end

subgraph group_state["Authorization State"]
  node_store[("Auth database<br/>[database.py]")]
end

node_game(("Game launch"))
node_admin_user(("Administrator"))
node_client_machine(("Client machine"))

node_game -->|"starts"| node_runtime
node_runtime -->|"checks first"| node_offline
node_runtime -.->|"reads config"| node_settings
node_offline -->|"authorizes locally"| node_runtime
node_runtime -->|"checks remotely"| node_client_api
node_client_api -->|"reads and writes"| node_store
node_client_api -->|"generates key"| node_crypto
node_backend_app -->|"initializes"| node_store
node_backend_app -->|"registers route"| node_client_api
node_backend_app -->|"registers route"| node_admin_api
node_client_api -->|"returns status and QR"| node_runtime
node_runtime -->|"polls status"| node_client_api
node_runtime -->|"shows pending state"| node_blocking
node_blocking -->|"prompts authorization"| node_client_machine
node_admin_user -->|"manages machines"| node_dashboard
node_dashboard -.->|"uses admin routes"| node_admin_api
node_admin_user -->|"scans QR"| node_mobile
node_mobile -.->|"approves request"| node_admin_api
node_admin_api -->|"manages authorization state"| node_store
node_admin_api -->|"creates offline key"| node_crypto
node_admin_api -.->|"approval enables polling"| node_client_api
node_runtime -->|"accepts manual key"| node_offline

click node_runtime "https://github.com/doushuov21/authmanager/blob/main/Source/AuthManager/Private/AuthManager.cpp"
click node_settings "https://github.com/doushuov21/authmanager/blob/main/Source/AuthManager/Public/AuthManagerSettings.h"
click node_offline "https://github.com/doushuov21/authmanager/blob/main/Source/AuthManager/Private/AuthManager.cpp"
click node_blocking "https://github.com/doushuov21/authmanager/blob/main/Source/AuthManager/Private/AuthManager.cpp"
click node_backend_app "https://github.com/doushuov21/authmanager/blob/main/Resources/Backend/main.py"
click node_client_api "https://github.com/doushuov21/authmanager/blob/main/Resources/Backend/routers/client.py"
click node_crypto "https://github.com/doushuov21/authmanager/blob/main/Resources/Backend/crypto_utils.py"
click node_store "https://github.com/doushuov21/authmanager/blob/main/Resources/Backend/database.py"
click node_admin_api "https://github.com/doushuov21/authmanager/blob/main/Resources/Backend/routers/admin.py"
click node_dashboard "https://github.com/doushuov21/authmanager/blob/main/Resources/Backend/templates/dashboard.html"
click node_mobile "https://github.com/doushuov21/authmanager/blob/main/Resources/Backend/templates/mobile_auth.html"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_runtime,node_settings,node_offline,node_blocking,node_client_machine toneBlue
class node_backend_app,node_client_api,node_crypto toneAmber
class node_admin_api,node_dashboard,node_mobile toneMint
class node_store toneRose
class node_game,node_admin_user toneIndigo
```

## Components

### Unreal Plugin

- [Auth lifecycle](https://github.com/doushuov21/authmanager/blob/main/Source/AuthManager/Private/AuthManager.cpp): `Source/AuthManager/Private/AuthManager.cpp`
- [Project settings](https://github.com/doushuov21/authmanager/blob/main/Source/AuthManager/Public/AuthManagerSettings.h): `Source/AuthManager/Public/AuthManagerSettings.h`
- [Offline license check](https://github.com/doushuov21/authmanager/blob/main/Source/AuthManager/Private/AuthManager.cpp): `Source/AuthManager/Private/AuthManager.cpp`
- [Blocking auth UI](https://github.com/doushuov21/authmanager/blob/main/Source/AuthManager/Private/AuthManager.cpp): `Source/AuthManager/Private/AuthManager.cpp`

### Authorization Backend

- [API application](https://github.com/doushuov21/authmanager/blob/main/Resources/Backend/main.py): `Resources/Backend/main.py`
- [Client authorization API](https://github.com/doushuov21/authmanager/blob/main/Resources/Backend/routers/client.py): `Resources/Backend/routers/client.py`
- [License generation](https://github.com/doushuov21/authmanager/blob/main/Resources/Backend/crypto_utils.py): `Resources/Backend/crypto_utils.py`

### Admin Capabilities

- [Admin API](https://github.com/doushuov21/authmanager/blob/main/Resources/Backend/routers/admin.py): `Resources/Backend/routers/admin.py`
- [Admin dashboard](https://github.com/doushuov21/authmanager/blob/main/Resources/Backend/templates/dashboard.html): `Resources/Backend/templates/dashboard.html`
- [Mobile approval page](https://github.com/doushuov21/authmanager/blob/main/Resources/Backend/templates/mobile_auth.html): `Resources/Backend/templates/mobile_auth.html`

### Authorization State

- [Auth database](https://github.com/doushuov21/authmanager/blob/main/Resources/Backend/database.py): `Resources/Backend/database.py`

### Other components

- **Game launch**
- **Administrator**
- **Client machine**

## Connections

- Game launch → Auth lifecycle: starts (evidence: `README.md`)
- Auth lifecycle → Offline license check: checks first (evidence: `README.md`)
- Auth lifecycle → Project settings: reads config (evidence: `Source/AuthManager/Private/AuthManager.cpp`)
- Offline license check → Auth lifecycle: authorizes locally (evidence: `Source/AuthManager/Private/AuthManager.cpp`)
- Auth lifecycle → Client authorization API: checks remotely (evidence: `README.md`)
- Client authorization API → Auth database: reads and writes (evidence: `Resources/Backend/routers/client.py`)
- Client authorization API → License generation: generates key (evidence: `Resources/Backend/routers/client.py`)
- API application → Auth database: initializes (evidence: `Resources/Backend/main.py`)
- API application → Client authorization API: registers route (evidence: `Resources/Backend/main.py`)
- API application → Admin API: registers route (evidence: `Resources/Backend/main.py`)
- Client authorization API → Auth lifecycle: returns status and QR (evidence: `Resources/Backend/routers/client.py`)
- Auth lifecycle → Client authorization API: polls status (evidence: `Source/AuthManager/Private/AuthManager.cpp`)
- Auth lifecycle → Blocking auth UI: shows pending state (evidence: `README.md`)
- Blocking auth UI → Client machine: prompts authorization (evidence: `README.md`)
- Administrator → Admin dashboard: manages machines (evidence: `README.md`)
- Admin dashboard → Admin API: uses admin routes
- Administrator → Mobile approval page: scans QR (evidence: `README.md`)
- Mobile approval page → Admin API: approves request
- Admin API → Auth database: manages authorization state (evidence: `Resources/Backend/routers/admin.py`)
- Admin API → License generation: creates offline key (evidence: `Resources/Backend/routers/admin.py`)
- Admin API → Client authorization API: approval enables polling
- Auth lifecycle → Offline license check: accepts manual key (evidence: `README.md`)
