Provide JWT and Anonymous Partner authentication to FastAPI routes.
Project description
This module provides the auth_jwt_authenticated_or_anonymous_partner and auth_jwt_authenticated_or_anonymous_partner_auto_create FastAPI dependencies.
Table of contents
Usage
This module provide the following FastAPI dependencies:
def auth_jwt_authenticated_or_anonymous_partner() -> Partner
This dependency returns the authenticated partner from fast_api_auth_jwt auth_jwt_optionally_authenticated_partner. If not authenticated or no partner is found, look for the shopinvader_anonymous_partner cookie in the request and return the corresponding partner.
If no partner is found, raise a 401 (unauthorized).
def auth_jwt_authenticated_or_anonymous_partner_auto_create() -> Partner
This dependency returns the authenticated partner from fast_api_auth_jwt auth_jwt_optionally_authenticated_partner. If not authenticated or no partner is found, look for the shopinvader_anonymous_partner cookie in the request and return the corresponding partner.
If no partner is found, create an anonymous partner, set the corresponding cookie and return the newly created partner.
The record sets returned from these functions are bound either to the Odoo user defined on the JWT validator (if authenticated), or to the Odoo user defined on the FastAPI endpoint.
These dependencies are suitable and intended to override the odoo.addon.fastapi.dependencies.authenticated_partner_impl.
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.
Do not contact contributors directly about support or help with technical issues.
Credits
Maintainers
This module is part of the shopinvader/odoo-shopinvader project on GitHub.
You are welcome to contribute.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file odoo_addon_shopinvader_fastapi_auth_jwt-16.0.1.0.2-py3-none-any.whl
.
File metadata
- Download URL: odoo_addon_shopinvader_fastapi_auth_jwt-16.0.1.0.2-py3-none-any.whl
- Upload date:
- Size: 13.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 14afd3fdc7cff32cc3472fb7795d8ab66cd33c79a55fd3c7d475fd95a1db6a26 |
|
MD5 | 94c37a17ccf75c0e14b539420e6bdde4 |
|
BLAKE2b-256 | 595e6d6cd6a97e4509580861c043b851c2e738602dcec6e7c872d82b057b26b7 |