This is an automated email from the ASF dual-hosted git repository.

kaxilnaik pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 144f20fd113 Fix adding auth manager to fastapi state regardless of 
fastapi app presence (#47883)
144f20fd113 is described below

commit 144f20fd11330905a373b340534727537e15b499
Author: Jed Cunningham <[email protected]>
AuthorDate: Mon Mar 17 15:46:16 2025 -0600

    Fix adding auth manager to fastapi state regardless of fastapi app presence 
(#47883)
---
 airflow/api_fastapi/app.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/airflow/api_fastapi/app.py b/airflow/api_fastapi/app.py
index 07061ae70b3..b8f118e9761 100644
--- a/airflow/api_fastapi/app.py
+++ b/airflow/api_fastapi/app.py
@@ -142,10 +142,11 @@ def init_auth_manager(app: FastAPI | None = None) -> 
BaseAuthManager:
     """Initialize the auth manager."""
     am = create_auth_manager()
     am.init()
+    if app:
+        app.state.auth_manager = am
 
     if app and (auth_manager_fastapi_app := am.get_fastapi_app()):
         app.mount("/auth", auth_manager_fastapi_app)
-        app.state.auth_manager = am
 
     return am
 

Reply via email to