Skip to main content
Odoo Community Association

Shopinvader Auth JWT authentication for FastAPI endpoints

Beta License: LGPL-3 shopinvader/odoo-shopinvader

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

Authors

  • ACSONE SA/NV

Maintainers

This module is part of the shopinvader/odoo-shopinvader project on GitHub.

You are welcome to contribute.

Metadata

Release files for odoo-addon-shopinvader-fastapi-auth-jwt 18.0.1.0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for odoo-addon-shopinvader-fastapi-auth-jwt 18.0.1.0.0.2
File Interpreter ABI Platform
odoo_addon_shopinvader_fastapi_auth_jwt-18.0.1.0.0.2-py3-none-any.whl Python 3 none any Details

Release files / odoo_addon_shopinvader_fastapi_auth_jwt-18.0.1.0.0.2-py3-none-any.whl

Download URL odoo_addon_shopinvader_fastapi_auth_jwt-18.0.1.0.0.2-py3-none-any.whl
Size 14.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
26ece9806bc3e31277beb62c2552a39b0bdcc3870dec1c4852ea52edb55ac834
BLAKE2b-256 checksum
How to use checksums
1681c7dfc6e85c3f6a807e196842201feb5a26ae859a44033301846c2ce8e47f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

18.0.1.0.0.2 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page