From 5b31c855cad92780d7f555d6a7f232580a7c9506 Mon Sep 17 00:00:00 2001 From: vincbeck Date: Tue, 24 Sep 2024 11:34:21 -0400 Subject: [PATCH] Fix logout in AWS auth manager --- airflow/providers/amazon/aws/auth_manager/views/auth.py | 2 +- tests/providers/amazon/aws/auth_manager/views/test_auth.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/airflow/providers/amazon/aws/auth_manager/views/auth.py b/airflow/providers/amazon/aws/auth_manager/views/auth.py index 7ea602d0dd45d..e08c2a7a6e100 100644 --- a/airflow/providers/amazon/aws/auth_manager/views/auth.py +++ b/airflow/providers/amazon/aws/auth_manager/views/auth.py @@ -61,7 +61,7 @@ def login(self): saml_auth = self._init_saml_auth() return redirect(saml_auth.login()) - @expose("/logout") + @expose("/logout", methods=("GET", "POST")) def logout(self): """Start logout process.""" session.clear() diff --git a/tests/providers/amazon/aws/auth_manager/views/test_auth.py b/tests/providers/amazon/aws/auth_manager/views/test_auth.py index 435dd8d2c32fe..05d2fb84b51cf 100644 --- a/tests/providers/amazon/aws/auth_manager/views/test_auth.py +++ b/tests/providers/amazon/aws/auth_manager/views/test_auth.py @@ -69,7 +69,7 @@ def aws_app(): ) as mock_is_policy_store_schema_up_to_date: mock_is_policy_store_schema_up_to_date.return_value = True mock_parser.parse_remote.return_value = SAML_METADATA_PARSED - return application.create_app(testing=True) + return application.create_app(testing=True, config={"WTF_CSRF_ENABLED": False}) @pytest.mark.db_test @@ -82,7 +82,7 @@ def test_login_redirect_to_identity_center(self, aws_app): def test_logout_redirect_to_identity_center(self, aws_app): with aws_app.test_client() as client: - response = client.get("/logout") + response = client.post("/logout") assert response.status_code == 302 assert response.location.startswith("https://portal.sso.us-east-1.amazonaws.com/saml/logout/")