docs: README + API_Auth + Security_Plan + Plugin_Guide 更新至 v0.7.0
- README: 新功能列表、start.sh、架构图 - API_Auth_Flow: 新增 API Key 认证章节 - Security_Hardening_Plan: 标记全部完成 - Plugin_Dev_Guide: 新增插件导入安装章节 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -239,6 +239,34 @@ Content-Type: application/json
|
||||
|
||||
---
|
||||
|
||||
|
||||
## 十一、API Key 认证 (服务器间通信)
|
||||
|
||||
### 创建 API Key
|
||||
在 WebUI "框架设置" → "API Key 管理" 中创建,支持三种权限模板:
|
||||
| 模板 | 权限 |
|
||||
|------|------|
|
||||
| `readonly` | framework.status.read, plugin.info.read |
|
||||
| `monitor` | + framework.event.subscribe |
|
||||
| `full` | admin (全部) |
|
||||
|
||||
每个 Key 可选 TTL 过期时间,格式 `sk-` + 48 hex chars。
|
||||
|
||||
### 使用方式
|
||||
```
|
||||
GET /SenSu/api/system
|
||||
Authorization: Bearer sk-xxxxxxxx...
|
||||
```
|
||||
|
||||
### 验证流程
|
||||
```
|
||||
panel_auth() 拦截
|
||||
├─ Cookie panel_token → Session Store
|
||||
├─ 失败 → API Key Store (validate_api_key)
|
||||
├─ 检查过期时间
|
||||
└─ 注入 key 自身权限范围
|
||||
```
|
||||
|
||||
## 八、安全响应头
|
||||
|
||||
所有响应自动添加:
|
||||
|
||||
Reference in New Issue
Block a user