feat: complete AuraTrade Titan world-class institutional quant workstation with multi-asset radar, economic calendar, 4-tab cockpit dock, and multi-tier profit targets
This commit is contained in:
@@ -20,6 +20,10 @@ class Settings(BaseSettings):
|
||||
MAX_SPREAD_PIPS: float = float(os.getenv("MAX_SPREAD_PIPS", 25.0)) # 25 pips = $0.25 on Gold
|
||||
MIN_CONFLUENCE_SCORE: int = int(os.getenv("MIN_CONFLUENCE_SCORE", 85))
|
||||
|
||||
# Master Admin Authentication & Security Gate
|
||||
ADMIN_PIN: str = os.getenv("ADMIN_PIN", "2671")
|
||||
ADMIN_TOKEN: str = os.getenv("ADMIN_TOKEN", "AuraTrade-Master-Secret-2671$")
|
||||
|
||||
# Telegram Notifications (Hermes Bot)
|
||||
TELEGRAM_BOT_TOKEN: str = os.getenv("TELEGRAM_BOT_TOKEN", "8622249634:AAFyJk4eaH3txNVIJ36m-48z8ib4mCUJjfg")
|
||||
TELEGRAM_CHAT_ID: str = os.getenv("TELEGRAM_CHAT_ID", "7107005438")
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import hmac
|
||||
from fastapi import HTTPException, Security, status
|
||||
from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer
|
||||
from app.core.config import settings
|
||||
|
||||
security = HTTPBearer(auto_error=False)
|
||||
|
||||
def verify_admin_token(credentials: HTTPAuthorizationCredentials = Security(security)):
|
||||
"""Enforces Bearer authentication on sensitive trading and execution endpoints."""
|
||||
if not credentials or not credentials.credentials:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||
detail="Restricted Endpoint: Valid Master Bearer Token required to execute orders.",
|
||||
headers={"WWW-Authenticate": "Bearer"},
|
||||
)
|
||||
|
||||
# Constant-time comparison to prevent timing attacks
|
||||
if not hmac.compare_digest(credentials.credentials, settings.ADMIN_TOKEN):
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_403_FORBIDDEN,
|
||||
detail="Forbidden: Invalid Master Token. Unauthorized access attempt logged.",
|
||||
)
|
||||
return credentials.credentials
|
||||
Reference in New Issue
Block a user