diff --git a/auth_api_key/README.rst b/auth_api_key/README.rst index b598112e9e..8c4f7f0f8b 100644 --- a/auth_api_key/README.rst +++ b/auth_api_key/README.rst @@ -17,26 +17,29 @@ Auth Api Key :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/16.0/auth_api_key + :target: https://github.com/OCA/server-auth/tree/17.0/auth_api_key :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-16-0/server-auth-16-0-auth_api_key + :target: https://translation.odoo-community.org/projects/server-auth-17-0/server-auth-17-0-auth_api_key :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/server-auth&target_branch=16.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/server-auth&target_branch=17.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| Authenticate http requests from an API key. -API keys are codes passed in (in the http header API-KEY) -by programs calling an API in order to identify -in this case- the calling program's user. +API keys are codes passed in (in the http header API-KEY) by programs +calling an API in order to identify -in this case- the calling program's +user. -Take care while using this kind of mechanism since information into http headers are visible in clear. -Thus, use it only to authenticate requests from known sources. +Take care while using this kind of mechanism since information into http +headers are visible in clear. Thus, use it only to authenticate requests +from known sources. -For unknown sources, it is a good practice to filter out this header at proxy level. +For unknown sources, it is a good practice to filter out this header at +proxy level. **Table of contents** @@ -47,23 +50,26 @@ Configuration ============= The api key menu is available into Settings > Technical in debug mode. -By default, when you create an API key, the key is saved into the database. +By default, when you create an API key, the key is saved into the +database. -If you want to manage them via serve environment settings use `auth_api_key_server_env`. +If you want to manage them via serve environment settings use +auth_api_key_server_env. Usage ===== -To apply this authentication system to your http request you must set 'api_key' -as value for the 'auth' parameter of your route definition into your controller. +To apply this authentication system to your http request you must set +'api_key' as value for the 'auth' parameter of your route definition +into your controller. -.. code-block:: python +.. code:: python - class MyController(Controller): + class MyController(Controller): - @route('/my_service', auth='api_key', ...) - def my_service(self, *args, **kwargs): - pass + @route('/my_service', auth='api_key', ...) + def my_service(self, *args, **kwargs): + pass Bug Tracker =========== @@ -71,7 +77,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 to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -79,21 +85,21 @@ Credits ======= Authors -~~~~~~~ +------- * ACSONE SA/NV Contributors -~~~~~~~~~~~~ +------------ -* Denis Robinet -* Laurent Mignon -* Quentin Groulard -* Sébastien Beau -* Chafique Delli +- Denis Robinet +- Laurent Mignon +- Quentin Groulard +- Sébastien Beau +- Chafique Delli Maintainers -~~~~~~~~~~~ +----------- This module is maintained by the OCA. @@ -105,6 +111,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -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_api_key/models/auth_api_key.py b/auth_api_key/models/auth_api_key.py index 4913fc7b63..61ee34c17b 100644 --- a/auth_api_key/models/auth_api_key.py +++ b/auth_api_key/models/auth_api_key.py @@ -51,13 +51,13 @@ def _clear_key_cache(self): @api.model_create_multi def create(self, vals_list): - records = super(AuthApiKey, self).create(vals_list) + records = super().create(vals_list) if any(["key" in vals or "user_id" in vals for vals in vals_list]): self._clear_key_cache() return records def write(self, vals): - super(AuthApiKey, self).write(vals) + super().write(vals) if "key" in vals or "user_id" in vals: self._clear_key_cache() return True diff --git a/auth_api_key/pyproject.toml b/auth_api_key/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/auth_api_key/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/auth_api_key/readme/CONFIGURE.md b/auth_api_key/readme/CONFIGURE.md new file mode 100644 index 0000000000..f791dd13ab --- /dev/null +++ b/auth_api_key/readme/CONFIGURE.md @@ -0,0 +1,6 @@ +The api key menu is available into Settings \> Technical in debug mode. +By default, when you create an API key, the key is saved into the +database. + +If you want to manage them via serve environment settings use +auth_api_key_server_env. diff --git a/auth_api_key/readme/CONFIGURE.rst b/auth_api_key/readme/CONFIGURE.rst deleted file mode 100644 index ad40ead98a..0000000000 --- a/auth_api_key/readme/CONFIGURE.rst +++ /dev/null @@ -1,4 +0,0 @@ -The api key menu is available into Settings > Technical in debug mode. -By default, when you create an API key, the key is saved into the database. - -If you want to manage them via serve environment settings use `auth_api_key_server_env`. diff --git a/auth_api_key/readme/CONTRIBUTORS.md b/auth_api_key/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..1168b409a3 --- /dev/null +++ b/auth_api_key/readme/CONTRIBUTORS.md @@ -0,0 +1,5 @@ +- Denis Robinet \<\> +- Laurent Mignon \<\> +- Quentin Groulard \<\> +- Sébastien Beau \<\> +- Chafique Delli \<\> diff --git a/auth_api_key/readme/CONTRIBUTORS.rst b/auth_api_key/readme/CONTRIBUTORS.rst deleted file mode 100644 index a0cd887895..0000000000 --- a/auth_api_key/readme/CONTRIBUTORS.rst +++ /dev/null @@ -1,5 +0,0 @@ -* Denis Robinet -* Laurent Mignon -* Quentin Groulard -* Sébastien Beau -* Chafique Delli diff --git a/auth_api_key/readme/DESCRIPTION.md b/auth_api_key/readme/DESCRIPTION.md new file mode 100644 index 0000000000..6d09ff29d8 --- /dev/null +++ b/auth_api_key/readme/DESCRIPTION.md @@ -0,0 +1,12 @@ +Authenticate http requests from an API key. + +API keys are codes passed in (in the http header API-KEY) by programs +calling an API in order to identify -in this case- the calling program's +user. + +Take care while using this kind of mechanism since information into http +headers are visible in clear. Thus, use it only to authenticate requests +from known sources. + +For unknown sources, it is a good practice to filter out this header at +proxy level. diff --git a/auth_api_key/readme/DESCRIPTION.rst b/auth_api_key/readme/DESCRIPTION.rst deleted file mode 100644 index 81c98219c7..0000000000 --- a/auth_api_key/readme/DESCRIPTION.rst +++ /dev/null @@ -1,9 +0,0 @@ -Authenticate http requests from an API key. - -API keys are codes passed in (in the http header API-KEY) -by programs calling an API in order to identify -in this case- the calling program's user. - -Take care while using this kind of mechanism since information into http headers are visible in clear. -Thus, use it only to authenticate requests from known sources. - -For unknown sources, it is a good practice to filter out this header at proxy level. diff --git a/auth_api_key/readme/USAGE.md b/auth_api_key/readme/USAGE.md new file mode 100644 index 0000000000..547d48759c --- /dev/null +++ b/auth_api_key/readme/USAGE.md @@ -0,0 +1,11 @@ +To apply this authentication system to your http request you must set +'api_key' as value for the 'auth' parameter of your route definition +into your controller. + +``` python +class MyController(Controller): + + @route('/my_service', auth='api_key', ...) + def my_service(self, *args, **kwargs): + pass +``` diff --git a/auth_api_key/readme/USAGE.rst b/auth_api_key/readme/USAGE.rst deleted file mode 100644 index d8ff4460eb..0000000000 --- a/auth_api_key/readme/USAGE.rst +++ /dev/null @@ -1,10 +0,0 @@ -To apply this authentication system to your http request you must set 'api_key' -as value for the 'auth' parameter of your route definition into your controller. - -.. code-block:: python - - class MyController(Controller): - - @route('/my_service', auth='api_key', ...) - def my_service(self, *args, **kwargs): - pass diff --git a/auth_api_key/static/description/index.html b/auth_api_key/static/description/index.html index c0b4ff4a13..dcb30768c9 100644 --- a/auth_api_key/static/description/index.html +++ b/auth_api_key/static/description/index.html @@ -369,13 +369,16 @@

Auth Api Key

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:3adb1ff0898c08651ce6de2c1ee1a91bc08a719dc6411ca880be9598b2f62705 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

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

+

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

Authenticate http requests from an API key.

-

API keys are codes passed in (in the http header API-KEY) -by programs calling an API in order to identify -in this case- the calling program’s user.

-

Take care while using this kind of mechanism since information into http headers are visible in clear. -Thus, use it only to authenticate requests from known sources.

-

For unknown sources, it is a good practice to filter out this header at proxy level.

+

API keys are codes passed in (in the http header API-KEY) by programs +calling an API in order to identify -in this case- the calling program’s +user.

+

Take care while using this kind of mechanism since information into http +headers are visible in clear. Thus, use it only to authenticate requests +from known sources.

+

For unknown sources, it is a good practice to filter out this header at +proxy level.

Table of contents

    @@ -393,13 +396,16 @@

    Auth Api Key

    Configuration

    The api key menu is available into Settings > Technical in debug mode. -By default, when you create an API key, the key is saved into the database.

    -

    If you want to manage them via serve environment settings use auth_api_key_server_env.

    +By default, when you create an API key, the key is saved into the +database.

    +

    If you want to manage them via serve environment settings use +auth_api_key_server_env.

    Usage

    -

    To apply this authentication system to your http request you must set ‘api_key’ -as value for the ‘auth’ parameter of your route definition into your controller.

    +

    To apply this authentication system to your http request you must set +‘api_key’ as value for the ‘auth’ parameter of your route definition +into your controller.

     class MyController(Controller):
     
    @@ -413,7 +419,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 to smash it by providing a detailed and welcomed -feedback.

    +feedback.

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

    @@ -441,7 +447,7 @@

    Maintainers

    OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

    -

    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.