From 5c0ba0483291e8f2b1ca40cb24ef648c05a3a081 Mon Sep 17 00:00:00 2001 From: SBCrumb Date: Wed, 22 Oct 2025 17:03:44 -0400 Subject: [PATCH] auth: fix auth issues --- api/auth.py | 4 ++-- start_web.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/api/auth.py b/api/auth.py index e65a037..fedaba9 100644 --- a/api/auth.py +++ b/api/auth.py @@ -72,10 +72,10 @@ class AuthSession: class SimpleAuthMiddleware(BaseHTTPMiddleware): """Simple authentication middleware for web interface routes""" - def __init__(self, app, config): + def __init__(self, app, config, session_manager=None): super().__init__(app) self.config = config - self.session_manager = AuthSession(config.web_auth_session_timeout) + self.session_manager = session_manager or AuthSession(config.web_auth_session_timeout) self.security = HTTPBasic() # Routes that require authentication (web interface) diff --git a/start_web.py b/start_web.py index 5ea7fc0..7d0cfdd 100644 --- a/start_web.py +++ b/start_web.py @@ -129,7 +129,8 @@ def main(): # Add authentication middleware if enabled (BEFORE routes) if auth_enabled: - app.add_middleware(SimpleAuthMiddleware, config=config) + # Pass the session manager to middleware so it uses the same instance + app.add_middleware(SimpleAuthMiddleware, config=config, session_manager=session_manager) print("🔐 Authentication middleware added to web interface") # Setup static files and routes