Skip to content

Commit 34e3795

Browse files
authored
Update oauth-flow.md
1 parent b329d3f commit 34e3795

File tree

1 file changed

+60
-27
lines changed

1 file changed

+60
-27
lines changed

docs/oauth-flow.md

Lines changed: 60 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,69 @@
22
[← Back to README](../README.md)
33

44

5-
```
6-
┌─────────────────────────────────────┐
7-
│ Интернет (HTTPS:443) │
8-
└──────────────┬──────────────────────┘
9-
10-
11-
┌─────────────────────────────────────┐
12-
│ KeenDNS Cloud │
13-
│ SSL Termination + Port Forward │
14-
└──────────────┬──────────────────────┘
15-
│ HTTP:80
16-
17-
┌─────────────────────────────────────┐
18-
│ nginx Reverse Proxy │
19-
│ X-Forwarded-Proto: https │
20-
└──────────────┬──────────────────────┘
21-
│ HTTP:8000
22-
23-
┌─────────────────────────────────────┐
24-
│ Backend Application │
25-
│ OAuth Callback Handler │
26-
└──────────────┬──────────────────────┘
27-
28-
29-
┌─────────────────────────────────────┐
30-
│ HeadHunter OAuth2 API │
31-
└─────────────────────────────────────┘
325

6+
7+
```mermaid
8+
flowchart TB
9+
10+
subgraph client["Клиент"]
11+
Browser[🌐 Браузер пользователя]
12+
end
13+
14+
subgraph cloud["☁️ KeenDNS Cloud"]
15+
KeenDNS[SSL Termination<br/>your-domain.keenetic.pro]
16+
end
17+
18+
subgraph home["🏠 Home Infrastructure"]
19+
direction TB
20+
Nginx[🔄 nginx Reverse Proxy<br/>HTTP:80 → :8000]
21+
App[🤖 Backend Application<br/>Flask/Telegram Bot :5000]
22+
23+
subgraph automation["⚙️ Token Automation"]
24+
direction LR
25+
Timer[⏱️ systemd timer<br/>Every 6h]
26+
Script[📜 refresh_token.sh]
27+
end
28+
29+
TokenStore[(🔐 Token Storage<br/>/var/lib/hh-token/token.json)]
30+
end
31+
32+
subgraph api["External Services"]
33+
HHAPI[🏢 HeadHunter OAuth2 API<br/>api.hh.ru]
34+
end
35+
36+
%% OAuth Flow
37+
Browser -->|1. OAuth Request| KeenDNS
38+
KeenDNS -->|2. Forward| Nginx
39+
Nginx -->|3. Proxy| App
40+
App <-->|4. API Calls| HHAPI
41+
42+
%% Token Refresh
43+
Timer -.->|Trigger| Script
44+
Script -->|5. Refresh| HHAPI
45+
Script -->|6. Save| TokenStore
46+
App -->|7. Read| TokenStore
47+
48+
%% Styling
49+
style Nginx fill:#2E8B57,color:#FFFFFF,stroke:#1a5f3a,stroke-width:2px
50+
style App fill:#4682B4,color:#FFFFFF,stroke:#1565c0,stroke-width:2px
51+
style HHAPI fill:#DC143C,color:#FFFFFF,stroke:#a00000,stroke-width:2px
52+
style Timer fill:#FFA500,color:#000000,stroke:#cc8400,stroke-width:2px
53+
style Script fill:#FF8C00,color:#FFFFFF,stroke:#cc7000,stroke-width:2px
54+
style TokenStore fill:#9370DB,color:#FFFFFF,stroke:#6a4db8,stroke-width:2px
55+
style Browser fill:#708090,color:#FFFFFF,stroke:#505a63,stroke-width:2px
56+
style KeenDNS fill:#87CEEB,color:#000000,stroke:#5fa8c0,stroke-width:2px
3357
```
3458

59+
### Цветовая схема
60+
61+
- 🟢 **Зелёный** — инфраструктурные компоненты (nginx)
62+
- 🔵 **Синий** — приложения (Flask, Telegram Bot)
63+
- 🔴 **Розовый** — внешние API (HeadHunter)
64+
- 🟠 **Оранжевый** — автоматизация (systemd, Bash)
65+
- 🟣 **Фиолетовый** — хранилище данных
66+
-**Серый** — клиентская часть
67+
- 🔵 **Голубой** — облачные сервисы (KeenDNS)
3568

3669
---
3770

0 commit comments

Comments
 (0)