diff --git a/invenio_oauthclient/handlers/ui.py b/invenio_oauthclient/handlers/ui.py index cf09b85..485b032 100644 --- a/invenio_oauthclient/handlers/ui.py +++ b/invenio_oauthclient/handlers/ui.py @@ -2,6 +2,7 @@ # # This file is part of Invenio. # Copyright (C) 2015-2019 CERN. +# Copyright (C) 2024 Graz University of Technology. # # Invenio is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. @@ -11,7 +12,6 @@ from functools import partial, wraps from flask import ( - Markup, current_app, flash, redirect, @@ -23,6 +23,7 @@ from flask_security.utils import do_flash, get_message from invenio_db import db from invenio_i18n import gettext as _ +from markupsafe import Markup from ..errors import ( AlreadyLinkedError, diff --git a/invenio_oauthclient/utils.py b/invenio_oauthclient/utils.py index 40f4cee..b042558 100644 --- a/invenio_oauthclient/utils.py +++ b/invenio_oauthclient/utils.py @@ -2,6 +2,7 @@ # # This file is part of Invenio. # Copyright (C) 2015-2023 CERN. +# Copyright (C) 2024 Graz University of Technology. # # Invenio is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. @@ -9,16 +10,22 @@ """Utility methods.""" from flask import current_app, request, session -from flask_login import current_user -from flask_principal import RoleNeed, UserNeed +from flask_principal import RoleNeed from invenio_db.utils import rebuild_encrypted_properties -from itsdangerous import TimedJSONWebSignatureSerializer from uritools import uricompose, urisplit from werkzeug.local import LocalProxy from werkzeug.utils import import_string from .models import RemoteToken +try: + # itsdangerous < 2.1.0 + from itsdangerous import TimedJSONWebSignatureSerializer +except ImportError: + # itsdangerous >= 2.1.0 + from invenio_base.jws import TimedJSONWebSignatureSerializer + + _security = LocalProxy(lambda: current_app.extensions["security"]) diff --git a/setup.cfg b/setup.cfg index 1e503a8..17078e0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -34,8 +34,9 @@ install_requires = invenio-i18n>=2.0.0 invenio-mail>=1.0.2 invenio-theme>=3.0.0 - oauthlib>=1.1.2,<3.0.0 - requests-oauthlib>=0.6.2,<1.2.0 + oauthlib>=1.1.2 + markupsafe>=2.1.5 + requests-oauthlib>=0.6.2 uritools>=1.0.1 github3.py>=1.0.0a4 uritemplate>=3.0.1