Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove default as auth backend #43096

Merged
merged 8 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Remove default as auth backend
  • Loading branch information
vincbeck committed Oct 17, 2024
commit f4895079d5b35fa886bcfba69882783ba76b9f6c
8 changes: 2 additions & 6 deletions airflow/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,14 @@
from importlib import import_module

from airflow.configuration import conf
from airflow.exceptions import AirflowConfigException, AirflowException
from airflow.exceptions import AirflowException

log = logging.getLogger(__name__)


def load_auth():
"""Load authentication backends."""
auth_backends = "airflow.api.auth.backend.default"
try:
auth_backends = conf.get("api", "auth_backends")
except AirflowConfigException:
pass
auth_backends = conf.get("api", "auth_backends")
vincbeck marked this conversation as resolved.
Show resolved Hide resolved

backends = []
try:
Expand Down
42 changes: 0 additions & 42 deletions airflow/api/auth/backend/default.py

This file was deleted.

3 changes: 1 addition & 2 deletions airflow/config_templates/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1377,8 +1377,7 @@ api:
description: |
Comma separated list of auth backends to authenticate users of the API. See
`Security: API
<https://airflow.apache.org/docs/apache-airflow/stable/security/api.html>`__ for possible values.
("airflow.api.auth.backend.default" allows all requests for historic reasons)
<https://airflow.apache.org/docs/apache-airflow/stable/security/api.html>`__ for possible values
version_added: 2.3.0
type: string
example: ~
Expand Down
2 changes: 1 addition & 1 deletion airflow/config_templates/unit_tests.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ celery_logging_level = INFO
smtp_mail_from = airflow@example.com

[api]
auth_backends = airflow.api.auth.backend.default
auth_backends = airflow.api.auth.backend.session

[hive]
# Hive uses the configuration below to run the tests
Expand Down
5 changes: 1 addition & 4 deletions airflow/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -670,10 +670,7 @@ def _upgrade_auth_backends(self):
This is required by the UI for ajax queries.
"""
old_value = self.get("api", "auth_backends", fallback="")
if old_value in ("airflow.api.auth.backend.default", ""):
# handled by deprecated_values
pass
elif old_value.find("airflow.api.auth.backend.session") == -1:
if old_value.find("airflow.api.auth.backend.session") == -1:
new_value = old_value + ",airflow.api.auth.backend.session"
self._update_env_var(section="api", name="auth_backends", new_value=new_value)
self.upgraded_values[("api", "auth_backends")] = old_value
Expand Down
8 changes: 2 additions & 6 deletions airflow/www/extensions/init_security.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from importlib import import_module

from airflow.configuration import conf
from airflow.exceptions import AirflowConfigException, AirflowException
from airflow.exceptions import AirflowException

log = logging.getLogger(__name__)

Expand All @@ -46,11 +46,7 @@ def apply_caching(response):

def init_api_auth(app):
"""Load authentication backends."""
auth_backends = "airflow.api.auth.backend.default"
try:
auth_backends = conf.get("api", "auth_backends")
except AirflowConfigException:
pass
auth_backends = conf.get("api", "auth_backends")

app.api_auth = []
try:
Expand Down
1 change: 1 addition & 0 deletions newsfragments/43096.significant.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Removed auth backend ``airflow.api.auth.backend.default``