From eb5fcda8c5d95e6cd19c0788054128002d60aeef Mon Sep 17 00:00:00 2001 From: Maksym Yankin Date: Wed, 15 Dec 2021 16:55:23 +0200 Subject: [PATCH] [MIG] auth_jwt: Migration to 15.0 --- auth_jwt/README.rst | 16 ++++++++-------- auth_jwt/__manifest__.py | 6 +++--- auth_jwt/exceptions.py | 2 +- auth_jwt/i18n/auth_jwt.pot | 2 +- auth_jwt/models/auth_jwt_validator.py | 10 +++++----- auth_jwt/models/ir_http.py | 2 +- auth_jwt/static/description/index.html | 6 +++--- auth_jwt/tests/test_auth_jwt.py | 2 +- auth_jwt/views/auth_jwt_validator_views.xml | 1 + requirements.txt | 3 +++ setup/auth_jwt/odoo/addons/auth_jwt | 1 + setup/auth_jwt/setup.py | 6 ++++++ 12 files changed, 34 insertions(+), 23 deletions(-) create mode 100644 requirements.txt create mode 120000 setup/auth_jwt/odoo/addons/auth_jwt create mode 100644 setup/auth_jwt/setup.py diff --git a/auth_jwt/README.rst b/auth_jwt/README.rst index 871af3c4a2..3187766114 100644 --- a/auth_jwt/README.rst +++ b/auth_jwt/README.rst @@ -10,17 +10,17 @@ Auth JWT .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png :target: https://odoo-community.org/page/development-status :alt: Beta -.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png - :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html - :alt: License: AGPL-3 +.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--auth-lightgray.png?logo=github - :target: https://github.com/OCA/server-auth/tree/14.0/auth_jwt + :target: https://github.com/OCA/server-auth/tree/15.0/auth_jwt :alt: OCA/server-auth .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/server-auth-14-0/server-auth-14-0-auth_jwt + :target: https://translation.odoo-community.org/projects/server-auth-15-0/server-auth-15-0-auth_jwt :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/251/14.0 + :target: https://runbot.odoo-community.org/runbot/251/15.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -102,7 +102,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -140,6 +140,6 @@ Current `maintainer `__: |maintainer-sbidoul| -This module is part of the `OCA/server-auth `_ project on GitHub. +This module is part of the `OCA/server-auth `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/auth_jwt/__manifest__.py b/auth_jwt/__manifest__.py index 7e0209f0c0..651d118cd3 100644 --- a/auth_jwt/__manifest__.py +++ b/auth_jwt/__manifest__.py @@ -1,12 +1,12 @@ # Copyright 2021 ACSONE SA/NV -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). { "name": "Auth JWT", "summary": """ JWT bearer token authentication.""", - "version": "14.0.1.1.0", - "license": "AGPL-3", + "version": "15.0.1.0.0", + "license": "LGPL-3", "author": "ACSONE SA/NV,Odoo Community Association (OCA)", "maintainers": ["sbidoul"], "website": "https://github.com/OCA/server-auth", diff --git a/auth_jwt/exceptions.py b/auth_jwt/exceptions.py index dbebaff04d..22ea748edf 100644 --- a/auth_jwt/exceptions.py +++ b/auth_jwt/exceptions.py @@ -1,5 +1,5 @@ # Copyright 2021 ACSONE SA/NV -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). from werkzeug.exceptions import InternalServerError, Unauthorized diff --git a/auth_jwt/i18n/auth_jwt.pot b/auth_jwt/i18n/auth_jwt.pot index 5d22a8cac2..ad04f9a66f 100644 --- a/auth_jwt/i18n/auth_jwt.pot +++ b/auth_jwt/i18n/auth_jwt.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 14.0\n" +"Project-Id-Version: Odoo Server 15.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" diff --git a/auth_jwt/models/auth_jwt_validator.py b/auth_jwt/models/auth_jwt_validator.py index 8fd37bf219..41451abee2 100644 --- a/auth_jwt/models/auth_jwt_validator.py +++ b/auth_jwt/models/auth_jwt_validator.py @@ -1,5 +1,5 @@ # Copyright 2021 ACSONE SA/NV -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). import logging from functools import partial @@ -114,7 +114,7 @@ def _decode(self, token): header = jwt.get_unverified_header(token) except Exception as e: _logger.info("Invalid token: %s", e) - raise UnauthorizedInvalidToken() + raise UnauthorizedInvalidToken() from e key = self._get_key(header.get("kid")) algorithm = self.public_key_algorithm try: @@ -133,7 +133,7 @@ def _decode(self, token): ) except Exception as e: _logger.info("Invalid token: %s", e) - raise UnauthorizedInvalidToken() + raise UnauthorizedInvalidToken() from e return payload def _get_uid(self, payload): @@ -194,8 +194,8 @@ def _unregister_auth_method(self): try: delattr(IrHttp.__class__, f"_auth_method_jwt_{rec.name}") delattr(IrHttp.__class__, f"_auth_method_public_or_jwt_{rec.name}") - except AttributeError: - pass + except AttributeError as e: + _logger.info("AttributeError: %s", e) @api.model_create_multi def create(self, vals): diff --git a/auth_jwt/models/ir_http.py b/auth_jwt/models/ir_http.py index aad11b9854..f90b5824c2 100644 --- a/auth_jwt/models/ir_http.py +++ b/auth_jwt/models/ir_http.py @@ -1,5 +1,5 @@ # Copyright 2021 ACSONE SA/NV -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). import logging import re diff --git a/auth_jwt/static/description/index.html b/auth_jwt/static/description/index.html index d5564eb61b..bc64cd8a7d 100644 --- a/auth_jwt/static/description/index.html +++ b/auth_jwt/static/description/index.html @@ -367,7 +367,7 @@

Auth JWT

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/server-auth Translate me on Weblate Try me on Runbot

+

Beta License: LGPL-3 OCA/server-auth Translate me on Weblate Try me on Runbot

JWT bearer token authentication.

Table of contents

@@ -442,7 +442,7 @@

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -feedback.

+feedback.

Do not contact contributors directly about support or help with technical issues.

@@ -468,7 +468,7 @@

Maintainers

promote its widespread use.

Current maintainer:

sbidoul

-

This module is part of the OCA/server-auth project on GitHub.

+

This module is part of the OCA/server-auth project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

diff --git a/auth_jwt/tests/test_auth_jwt.py b/auth_jwt/tests/test_auth_jwt.py index 097312072b..937778c521 100644 --- a/auth_jwt/tests/test_auth_jwt.py +++ b/auth_jwt/tests/test_auth_jwt.py @@ -1,5 +1,5 @@ # Copyright 2021 ACSONE SA/NV -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). import contextlib import time diff --git a/auth_jwt/views/auth_jwt_validator_views.xml b/auth_jwt/views/auth_jwt_validator_views.xml index 11c9c42e75..90df5557f3 100644 --- a/auth_jwt/views/auth_jwt_validator_views.xml +++ b/auth_jwt/views/auth_jwt_validator_views.xml @@ -1,4 +1,5 @@ + auth.jwt.validator.form diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000000..48d247de30 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +# generated from manifests external_dependencies +cryptography +pyjwt diff --git a/setup/auth_jwt/odoo/addons/auth_jwt b/setup/auth_jwt/odoo/addons/auth_jwt new file mode 120000 index 0000000000..33f0cb5934 --- /dev/null +++ b/setup/auth_jwt/odoo/addons/auth_jwt @@ -0,0 +1 @@ +../../../../auth_jwt \ No newline at end of file diff --git a/setup/auth_jwt/setup.py b/setup/auth_jwt/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/auth_jwt/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)