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

vincbeck pushed a commit to branch v2-10-test
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/v2-10-test by this push:
     new f733667e661 Deprecate session auth backend (#42911)
f733667e661 is described below

commit f733667e661f1497b5900da55a774d5a176af5b8
Author: Vincent <97131062+vincb...@users.noreply.github.com>
AuthorDate: Tue Oct 15 09:52:21 2024 -0400

    Deprecate session auth backend (#42911)
---
 airflow/api/auth/backend/session.py | 8 ++++++++
 tests/api_connexion/test_auth.py    | 5 ++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/airflow/api/auth/backend/session.py 
b/airflow/api/auth/backend/session.py
index d51f7bf1cf4..aef759346eb 100644
--- a/airflow/api/auth/backend/session.py
+++ b/airflow/api/auth/backend/session.py
@@ -18,15 +18,23 @@
 
 from __future__ import annotations
 
+import warnings
 from functools import wraps
 from typing import Any, Callable, TypeVar, cast
 
 from flask import Response
 
+from airflow.exceptions import RemovedInAirflow3Warning
 from airflow.www.extensions.init_auth_manager import get_auth_manager
 
 CLIENT_AUTH: tuple[str, str] | Any | None = None
 
+warnings.warn(
+    "This module is deprecated. Please use 
`airflow.providers.fab.auth_manager.api.auth.backend.session` instead.",
+    RemovedInAirflow3Warning,
+    stacklevel=2,
+)
+
 
 def init_app(_):
     """Initialize authentication backend."""
diff --git a/tests/api_connexion/test_auth.py b/tests/api_connexion/test_auth.py
index 9f78d0c0881..cccd04eb3c1 100644
--- a/tests/api_connexion/test_auth.py
+++ b/tests/api_connexion/test_auth.py
@@ -21,6 +21,7 @@ from base64 import b64encode
 import pytest
 from flask_login import current_user
 
+from airflow.exceptions import RemovedInAirflow3Warning
 from tests.test_utils.api_connexion_utils import assert_401
 from tests.test_utils.config import conf_vars
 from tests.test_utils.db import clear_db_pools
@@ -137,7 +138,8 @@ class TestSessionAuth(BaseTestAuth):
 
         try:
             with conf_vars({("api", "auth_backends"): 
"airflow.api.auth.backend.session"}):
-                init_api_experimental_auth(minimal_app_for_api)
+                with pytest.warns(RemovedInAirflow3Warning):
+                    init_api_experimental_auth(minimal_app_for_api)
                 yield
         finally:
             setattr(minimal_app_for_api, "api_auth", old_auth)
@@ -174,6 +176,7 @@ class TestSessionAuth(BaseTestAuth):
             assert_401(response)
 
 
+@pytest.mark.filterwarnings("default::airflow.exceptions.RemovedInAirflow3Warning")
 class TestSessionWithBasicAuthFallback(BaseTestAuth):
     @pytest.fixture(autouse=True, scope="class")
     def with_basic_auth_backend(self, minimal_app_for_api):

Reply via email to