Backend (Django 4.2 + DRF): - Admin auth with SimpleJWT - Volcengine API client with HMAC-SHA256 signing - IAM user management (create/sync/import/disable/enable) - Billing query with pagination - Feishu webhook notifications (async) - APScheduler for periodic spending checks - AES-256 encrypted credential storage - API key auth for external system integration Frontend (Vue 3 + Element Plus): - Login page - Dashboard with stats overview - IAM user list with per-user threshold config - Billing view with spending progress bars - Alert history with type filtering - Settings page for global config and Volcengine account management Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
12 lines
407 B
Python
12 lines
407 B
Python
from rest_framework.permissions import BasePermission
|
|
from django.conf import settings
|
|
|
|
|
|
class IsAPIKeyAuth(BasePermission):
|
|
"""允许通过 X-API-Key 头认证(供外部系统如 AirDrama 调用)"""
|
|
|
|
def has_permission(self, request, view):
|
|
api_key = request.headers.get('X-API-Key', '')
|
|
expected = settings.AIRGATE_API_KEY
|
|
return bool(expected and api_key == expected)
|