diff --git a/airflow/api_connexion/security.py b/airflow/api_connexion/security.py index 660bc6cce2370..c6474fd60074f 100644 --- a/airflow/api_connexion/security.py +++ b/airflow/api_connexion/security.py @@ -16,9 +16,8 @@ # under the License. from __future__ import annotations -import warnings from functools import wraps -from typing import TYPE_CHECKING, Callable, Sequence, TypeVar, cast +from typing import TYPE_CHECKING, Callable, TypeVar, cast from flask import Response, g @@ -33,7 +32,6 @@ PoolDetails, VariableDetails, ) -from airflow.exceptions import RemovedInAirflow3Warning from airflow.utils.airflow_flask_app import get_airflow_app from airflow.www.extensions.init_auth_manager import get_auth_manager @@ -60,27 +58,6 @@ def check_authentication() -> None: raise Unauthenticated(headers=response.headers) -def requires_access(permissions: Sequence[tuple[str, str]] | None = None) -> Callable[[T], T]: - """ - Check current user's permissions against required permissions. - - Deprecated. Do not use this decorator, use one of the decorator `has_access_*` defined in - airflow/api_connexion/security.py instead. - This decorator will only work with FAB authentication and not with other auth providers. - - This decorator might be used in user plugins, do not remove it. - """ - warnings.warn( - "The 'requires_access' decorator is deprecated. Please use one of the decorator `requires_access_*`" - "defined in airflow/api_connexion/security.py instead.", - RemovedInAirflow3Warning, - stacklevel=2, - ) - from airflow.providers.fab.auth_manager.decorators.auth import _requires_access_fab - - return _requires_access_fab(permissions) - - def _requires_access(*, is_authorized_callback: Callable[[], bool], func: Callable, args, kwargs) -> bool: """ Define the behavior whether the user is authorized to access the resource. diff --git a/newsfragments/41910.significant.rst b/newsfragments/41910.significant.rst new file mode 100644 index 0000000000000..08b0cb9d30cc7 --- /dev/null +++ b/newsfragments/41910.significant.rst @@ -0,0 +1 @@ +Removed deprecated method ``requires_access`` from module ``airflow.api_connexion.security``. Please use ``requires_access_*`` instead.