Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from airflow.api_fastapi.common.router import AirflowRouter
from airflow.api_fastapi.core_api.datamodels.ui.config import ConfigResponse
from airflow.api_fastapi.core_api.openapi.exceptions import create_openapi_http_exception_doc
from airflow.api_fastapi.core_api.security import requires_access_configuration
from airflow.api_fastapi.core_api.security import requires_authenticated
from airflow.configuration import conf
from airflow.settings import DASHBOARD_UIALERTS
from airflow.utils.log.log_reader import TaskLogReader
Expand All @@ -49,7 +49,7 @@
@config_router.get(
"/config",
responses=create_openapi_http_exception_doc([status.HTTP_404_NOT_FOUND]),
dependencies=[Depends(requires_access_configuration("GET"))],
dependencies=[Depends(requires_authenticated())],
)
def get_configs() -> ConfigResponse:
"""Get configs for UI."""
Expand Down
12 changes: 12 additions & 0 deletions airflow-core/src/airflow/api_fastapi/core_api/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,18 @@ def inner(
return inner


def requires_authenticated() -> Callable:
"""Just ensure the user is authenticated - no need to check any specific permissions."""

def inner(
request: Request,
user: GetUserDep,
) -> None:
pass

return inner


def _requires_access(
*,
is_authorized_callback: Callable[[], bool],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ def test_get_config_should_response_401(self, unauthenticated_test_client):
response = unauthenticated_test_client.get("/config")
assert response.status_code == 401

def test_get_config_should_response_403(self, unauthorized_test_client):
def test_get_config_just_authenticated(self, mock_config_data, unauthorized_test_client):
"""Just being authenticated is enough to access the endpoint."""
response = unauthorized_test_client.get("/config")
assert response.status_code == 403
assert response.status_code == 200
assert response.json() == mock_config_response
Loading