Skip to content

Commit 373cab4

Browse files
committed
fix: flask>=3.1, changed variable
1 parent 35fdd5a commit 373cab4

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

invenio_oauthclient/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# This file is part of Invenio.
44
# Copyright (C) 2015-2023 CERN.
5-
# Copyright (C) 2024 Graz University of Technology.
5+
# Copyright (C) 2024-2025 Graz University of Technology.
66
#
77
# Invenio is free software; you can redistribute it and/or modify it
88
# under the terms of the MIT License; see LICENSE file for more details.
@@ -103,7 +103,7 @@ def get_safe_redirect_target(arg="next"):
103103
:param arg: URL argument.
104104
:returns: The redirect target or ``None``.
105105
"""
106-
allowed_hosts = current_app.config.get("APP_ALLOWED_HOSTS") or []
106+
allowed_hosts = current_app.config.get("TRUSTED_HOSTS") or []
107107
for target in request.args.get(arg), request.referrer:
108108
if target:
109109
redirect_uri = urisplit(target)

tests/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# This file is part of Invenio.
44
# Copyright (C) 2015-2018 CERN.
55
# Copyright (C) 2018 University of Chicago.
6-
# Copyright (C) 2023-2024 Graz University of Technology.
6+
# Copyright (C) 2023-2025 Graz University of Technology.
77
#
88
# Invenio is free software; you can redistribute it and/or modify it
99
# under the terms of the MIT License; see LICENSE file for more details.
@@ -139,7 +139,7 @@ def base_app(request):
139139
SECURITY_PASSWORD_HASH="plaintext",
140140
SECURITY_PASSWORD_SCHEMES=["plaintext"],
141141
SECURITY_PASSWORD_SINGLE_HASH=None,
142-
APP_ALLOWED_HOSTS=["localhost"],
142+
TRUSTED_HOSTS=["localhost"],
143143
APP_THEME=["semantic-ui"],
144144
THEME_ICONS={"semantic-ui": dict(link="linkify icon")},
145145
OAUTHCLIENT_SETTINGS_TEMPLATE="invenio_oauthclient/settings/base.html",

tests/test_views.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# This file is part of Invenio.
44
# Copyright (C) 2015-2018 CERN.
5-
# Copyright (C) 2024 Graz University of Technology.
5+
# Copyright (C) 2024-2025 Graz University of Technology.
66
#
77
# Invenio is free software; you can redistribute it and/or modify it
88
# under the terms of the MIT License; see LICENSE file for more details.
@@ -79,7 +79,7 @@ def test_redirect_uri(views_fixture):
7979
check_response_redirect_url(resp, url)
8080

8181
# Assert that absolute redirects are allowed only if
82-
# `APP_ALLOWED_HOSTS` is set and includes them. Otherwise, the relative
82+
# `TRUSTED_HOSTS` is set and includes them. Otherwise, the relative
8383
# path of the url is extracted and returned. Note if you need to
8484
# redirect to index page you should pass '/' as next parameter.
8585

@@ -91,7 +91,7 @@ def test_redirect_uri(views_fixture):
9191

9292
check_response_redirect_url(resp, urlparse(test_url).path)
9393

94-
app.config.update({"APP_ALLOWED_HOSTS": ["inveniosoftware.org"]})
94+
app.config.update({"TRUSTED_HOSTS": ["inveniosoftware.org"]})
9595

9696
resp = client.get(
9797
url_for("invenio_oauthclient.login", remote_app="test", next=test_url)

tests/test_views_rest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# This file is part of Invenio.
44
# Copyright (C) 2015-2018 CERN.
5-
# Copyright (C) 2024 Graz University of Technology.
5+
# Copyright (C) 2024-2025 Graz University of Technology.
66
#
77
# Invenio is free software; you can redistribute it and/or modify it
88
# under the terms of the MIT License; see LICENSE file for more details.
@@ -75,7 +75,7 @@ def test_redirect_uri(app_rest):
7575
check_response_redirect_url(resp, url)
7676

7777
# Assert that absolute redirects are allowed only if
78-
# `APP_ALLOWED_HOSTS` is set and includes them. Otherwise, the relative
78+
# `TRUSTED_HOSTS` is set and includes them. Otherwise, the relative
7979
# path of the url is extracted and returned. Note if you need to
8080
# redirect to index page you should pass '/' as next parameter.
8181

@@ -87,7 +87,7 @@ def test_redirect_uri(app_rest):
8787

8888
check_response_redirect_url(resp, urlparse(test_url).path)
8989

90-
app_rest.config.update({"APP_ALLOWED_HOSTS": ["inveniosoftware.org"]})
90+
app_rest.config.update({"TRUSTED_HOSTS": ["inveniosoftware.org"]})
9191

9292
resp = client.get(
9393
url_for("invenio_oauthclient.rest_login", remote_app="test", next=test_url)

0 commit comments

Comments
 (0)