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

feat: deprecated basic auth airflow.api.auth.backend.basic_auth removed #41663

Merged
merged 3 commits into from
Aug 22, 2024
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
3 changes: 2 additions & 1 deletion .github/workflows/basic-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ jobs:
nohup airflow webserver --port 8080 &
echo "Started webserver"
env:
AIRFLOW__API__AUTH_BACKENDS: airflow.api.auth.backend.session,airflow.api.auth.backend.basic_auth
AIRFLOW__API__AUTH_BACKENDS: >-
airflow.api.auth.backend.session,airflow.providers.fab.auth_manager.api.auth.backend.basic_auth
AIRFLOW__WEBSERVER__EXPOSE_CONFIG: "True"
AIRFLOW__CORE__LOAD_EXAMPLES: "True"
AIRFLOW_HOME: "${{ github.workspace }}/airflow_home"
Expand Down
52 changes: 0 additions & 52 deletions airflow/api/auth/backend/basic_auth.py

This file was deleted.

2 changes: 1 addition & 1 deletion airflow/api_connexion/openapi/v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ info:
`airflow config get-value api auth_backends` command as in the example below.
```bash
$ airflow config get-value api auth_backends
airflow.api.auth.backend.basic_auth
airflow.providers.fab.auth_manager.api.auth.backend.basic_auth
```
The default is to deny all requests.

Expand Down
52 changes: 0 additions & 52 deletions airflow/auth/managers/fab/api/auth/backend/basic_auth.py

This file was deleted.

6 changes: 3 additions & 3 deletions clients/python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ If you want to check which auth backend is currently set, you can use

```bash
$ airflow config get-value api auth_backends
airflow.api.auth.backend.basic_auth
airflow.providers.fab.auth_manager.api.auth.backend.basic_auth
```

The default is to deny all requests.
Expand Down Expand Up @@ -534,11 +534,11 @@ that uses the API to run the tests. To do that, you need to:

```ini
[api]
auth_backend = airflow.api.auth.backend.session,airflow.api.auth.backend.basic_auth
auth_backend = airflow.api.auth.backend.session,airflow.providers.fab.auth_manager.api.auth.backend.basic_auth
```

You can also set it by env variable:
`export AIRFLOW__API__AUTH_BACKENDS=airflow.api.auth.backend.session,airflow.api.auth.backend.basic_auth`
`export AIRFLOW__API__AUTH_BACKENDS=airflow.api.auth.backend.session,airflow.providers.fab.auth_manager.api.auth.backend.basic_auth`

* configure your airflow webserver to load example dags
In the `[core]` section of your `airflow.cfg` set:
Expand Down
2 changes: 1 addition & 1 deletion clients/python/test_python_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
# configured also with the basic_auth as backend additionally to regular session backend needed
# by the UI. In the `[api]` section of your `airflow.cfg` set:
#
# auth_backend = airflow.api.auth.backend.session,airflow.api.auth.backend.basic_auth
# auth_backend = airflow.api.auth.backend.session,airflow.providers.fab.auth_manager.api.auth.backend.basic_auth
#
# Make sure that your user/name are configured properly - using the user/password that has admin
# privileges in Airflow
Expand Down
2 changes: 1 addition & 1 deletion dev/README_RELEASE_PYTHON_CLIENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ and allows you to test the client in a real environment.
variable in `files/airflow-breeze-config/init.sh`:

```shell
export AIRFLOW__API__AUTH_BACKENDS=airflow.api.auth.backend.session,airflow.api.auth.backend.basic_auth
export AIRFLOW__API__AUTH_BACKENDS=airflow.api.auth.backend.session,airflow.providers.fab.auth_manager.api.auth.backend.basic_auth
export AIRFLOW__WEBSERVER__EXPOSE_CONFIG=True
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,7 @@ def _deploy_helm_chart(
"-v",
"1",
"--set",
"config.api.auth_backends=airflow.api.auth.backend.basic_auth",
"config.api.auth_backends=airflow.providers.fab.auth_manager.api.auth.backend.basic_auth",
"--set",
"config.logging.logging_level=DEBUG",
"--set",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ command as in the example below.
.. code-block:: console

$ airflow config get-value api auth_backends
airflow.api.auth.backend.basic_auth
airflow.providers.fab.auth_manager.api.auth.backend.basic_auth

Kerberos authentication
'''''''''''''''''''''''
Expand Down Expand Up @@ -78,7 +78,7 @@ To enable basic authentication, set the following in the configuration:
.. code-block:: ini

[api]
auth_backends = airflow.api.auth.backend.basic_auth
auth_backends = airflow.providers.fab.auth_manager.api.auth.backend.basic_auth

Username and password needs to be base64 encoded and send through the
``Authorization`` HTTP header in the following format:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ x-airflow-common:
AIRFLOW__CORE__FERNET_KEY: ''
AIRFLOW__CORE__DAGS_ARE_PAUSED_AT_CREATION: 'true'
AIRFLOW__CORE__LOAD_EXAMPLES: 'true'
AIRFLOW__API__AUTH_BACKENDS: 'airflow.api.auth.backend.basic_auth,airflow.api.auth.backend.session'
AIRFLOW__API__AUTH_BACKENDS: >-
airflow.providers.fab.auth_manager.api.auth.backend.basic_auth,airflow.api.auth.backend.session
# yamllint disable rule:line-length
# Use simple http server on scheduler for health checks
# See https://airflow.apache.org/docs/apache-airflow/stable/administration-and-deployment/logging-monitoring/check-health.html#scheduler-health-check-server
Expand Down
1 change: 1 addition & 0 deletions newsfragments/41663.significant.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Removed deprecated auth ``airflow.api.auth.backend.basic_auth`` from ``auth_backends``. Please use ``airflow.providers.fab.auth_manager.api.auth.backend.basic_auth`` instead.
10 changes: 6 additions & 4 deletions tests/core/test_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,13 +646,15 @@ def test_auth_backends_adds_session(self):
),
},
}
test_conf.read_dict({"api": {"auth_backends": "airflow.api.auth.backend.basic_auth"}})
test_conf.read_dict(
{"api": {"auth_backends": "airflow.providers.fab.auth_manager.api.auth.backend.basic_auth"}}
)

with pytest.warns(FutureWarning):
test_conf.validate()
assert (
test_conf.get("api", "auth_backends")
== "airflow.api.auth.backend.basic_auth,airflow.api.auth.backend.session"
== "airflow.providers.fab.auth_manager.api.auth.backend.basic_auth,airflow.api.auth.backend.session"
)

def test_command_from_env(self):
Expand Down Expand Up @@ -1028,11 +1030,11 @@ def test_deprecated_values_from_conf(self):
"old, new",
[
(
("api", "auth_backend", "airflow.api.auth.backend.basic_auth"),
("api", "auth_backend", "airflow.providers.fab.auth_manager.api.auth.backend.basic_auth"),
(
"api",
"auth_backends",
"airflow.api.auth.backend.basic_auth,airflow.api.auth.backend.session",
"airflow.providers.fab.auth_manager.api.auth.backend.basic_auth,airflow.api.auth.backend.session",
),
),
(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from flask import Response
from flask_appbuilder.const import AUTH_LDAP

from airflow.api.auth.backend.basic_auth import requires_authentication
from airflow.providers.fab.auth_manager.api.auth.backend.basic_auth import requires_authentication
from airflow.www import app as application
from tests.test_utils.compat import AIRFLOW_V_2_9_PLUS

Expand Down
Loading