From f89e5212a77dae6a38e58e8f94d28804494ea7d6 Mon Sep 17 00:00:00 2001 From: Maksym Yankin Date: Wed, 15 Dec 2021 18:27:52 +0200 Subject: [PATCH 1/5] [IMP] auth_jwt: pylint --- auth_jwt/models/auth_jwt_validator.py | 8 ++++---- auth_jwt/views/auth_jwt_validator_views.xml | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/auth_jwt/models/auth_jwt_validator.py b/auth_jwt/models/auth_jwt_validator.py index 5d841888b..41451abee 100644 --- a/auth_jwt/models/auth_jwt_validator.py +++ b/auth_jwt/models/auth_jwt_validator.py @@ -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/views/auth_jwt_validator_views.xml b/auth_jwt/views/auth_jwt_validator_views.xml index 11c9c42e7..90df5557f 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 From 4b805cc66beffb712e14d487cb92e74ad31c9aa1 Mon Sep 17 00:00:00 2001 From: Maksym Yankin Date: Wed, 15 Dec 2021 16:55:23 +0200 Subject: [PATCH 2/5] [MIG] auth_jwt: Migration to 15.0 --- .pre-commit-config.yaml | 1 - auth_jwt/README.rst | 10 +++++----- auth_jwt/__manifest__.py | 4 ++-- auth_jwt/i18n/auth_jwt.pot | 2 +- auth_jwt/static/description/index.html | 6 +++--- setup/auth_jwt/odoo/addons/auth_jwt | 1 + setup/auth_jwt/setup.py | 6 ++++++ 7 files changed, 18 insertions(+), 12 deletions(-) create mode 120000 setup/auth_jwt/odoo/addons/auth_jwt create mode 100644 setup/auth_jwt/setup.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index df23c75f9..e8e1c15db 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,6 @@ exclude: | (?x) # NOT INSTALLABLE ADDONS - ^auth_jwt/| ^auth_jwt_demo/| # END NOT INSTALLABLE ADDONS # Files and folders generated by bots, to avoid loops diff --git a/auth_jwt/README.rst b/auth_jwt/README.rst index 002a5092b..318776611 100644 --- a/auth_jwt/README.rst +++ b/auth_jwt/README.rst @@ -14,13 +14,13 @@ Auth JWT :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 c97318651..cf1728c39 100644 --- a/auth_jwt/__manifest__.py +++ b/auth_jwt/__manifest__.py @@ -5,7 +5,7 @@ "name": "Auth JWT", "summary": """ JWT bearer token authentication.""", - "version": "14.0.1.2.0", + "version": "15.0.1.0.0", "license": "LGPL-3", "author": "ACSONE SA/NV,Odoo Community Association (OCA)", "maintainers": ["sbidoul"], @@ -14,5 +14,5 @@ "external_dependencies": {"python": ["pyjwt", "cryptography"]}, "data": ["security/ir.model.access.csv", "views/auth_jwt_validator_views.xml"], "demo": [], - "installable": False, + "installable": True, } diff --git a/auth_jwt/i18n/auth_jwt.pot b/auth_jwt/i18n/auth_jwt.pot index 5d22a8cac..ad04f9a66 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/static/description/index.html b/auth_jwt/static/description/index.html index bd621ae44..bc64cd8a7 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: LGPL-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/setup/auth_jwt/odoo/addons/auth_jwt b/setup/auth_jwt/odoo/addons/auth_jwt new file mode 120000 index 000000000..33f0cb593 --- /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 000000000..28c57bb64 --- /dev/null +++ b/setup/auth_jwt/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) From 22129e6903858125c8214653e47acb22010a8dc6 Mon Sep 17 00:00:00 2001 From: Maksym Yankin Date: Thu, 16 Dec 2021 12:45:08 +0200 Subject: [PATCH 3/5] [IMP] auth_jwt_demo: eslint --- auth_jwt_demo/tests/spa/index.html | 8 +- .../tests/spa/js/{app.js => app.esm.js} | 3 +- auth_jwt_demo/tests/spa/js/oidc-client.esm.js | 24203 +++++++++++++++ auth_jwt_demo/tests/spa/js/oidc-client.js | 24412 ---------------- 4 files changed, 24212 insertions(+), 24414 deletions(-) rename auth_jwt_demo/tests/spa/js/{app.js => app.esm.js} (97%) create mode 100644 auth_jwt_demo/tests/spa/js/oidc-client.esm.js delete mode 100644 auth_jwt_demo/tests/spa/js/oidc-client.js diff --git a/auth_jwt_demo/tests/spa/index.html b/auth_jwt_demo/tests/spa/index.html index 6fdec21ec..e642799ca 100644 --- a/auth_jwt_demo/tests/spa/index.html +++ b/auth_jwt_demo/tests/spa/index.html @@ -13,7 +13,13 @@

SPA OIDC Authentication Sample