feat: Add API Key support for MCP authentication

- New db model: api_keys table with bcrypt-hashed keys
- New API: POST/GET/DELETE /v3/access/api-keys endpoints
- MCP _resolve_token: validates API keys, resolves to 5-min JWT
- API keys inherit the creating user's RBAC permissions
- MCP auth supports both JWT (24h) and API key (permanent) tokens
This commit is contained in:
YueGuobin committed 2026-06-11 22:54:03 +08:00
1 parent 8e9afbcf92
commit a79bc7dd20
8 files changed
+361 -6

No files matched your search

+6
View File
@@ -28,3 +28,9 @@ class TokenData(BaseModel):
username: Optional[str] = None
token_version: int = 0
class ApiKeyCreate(BaseModel):
"""Schema for creating a new API key."""
name: str