Skip to main content

Provide Partner and Anonymous Partner authentication to FastAPI routes.

Project description

Beta License: AGPL-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 not 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 validaator (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

  • Akretion

Maintainers

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

You are welcome to contribute.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file odoo_addon_shopinvader_fastapi_auth_partner-16.0.1.0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for odoo_addon_shopinvader_fastapi_auth_partner-16.0.1.0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 7fb7e9904403b90abc612f6130857656c622368d2a7d5e8b4c245e97ac1f8b72
MD5 78a9fd4a1b77665060476115a9532824
BLAKE2b-256 eca07f1f4e9d3f104c3ed60851cf1a2a726324821b09ae3d1a5cf023dee38b04

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page