Metadata-Version: 2.1
Name: odoo-addon-fastapi_auth_partner
Version: 18.0.1.0.0.2
Requires-Python: >=3.10
Requires-Dist: itsdangerous
Requires-Dist: odoo-addon-auth_partner==18.0.*
Requires-Dist: odoo-addon-extendable_fastapi==18.0.*
Requires-Dist: odoo==18.0.*
Summary: This provides an implementation of auth_partner for FastAPI
Home-page: https://github.com/OCA/rest-framework
License: AGPL-3
Author: Akretion,Odoo Community Association (OCA)
Author-email: support@odoo-community.org
Classifier: Programming Language :: Python
Classifier: Framework :: Odoo
Classifier: Framework :: Odoo :: 18.0
Classifier: License :: OSI Approved :: GNU Affero General Public License v3
Description-Content-Type: text/x-rst

.. image:: https://odoo-community.org/readme-banner-image
   :target: https://odoo-community.org/get-involved?utm_source=readme
   :alt: Odoo Community Association

====================
Fastapi Auth Partner
====================

.. 
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   !! This file is generated by oca-gen-addon-readme !!
   !! changes will be overwritten.                   !!
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   !! source digest: sha256:959857e48fbc660ca7012f4a8364b02247c1622d785239a293e7fd4d69e474cc
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
    :target: https://odoo-community.org/page/development-status
    :alt: Beta
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
    :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
    :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Frest--framework-lightgray.png?logo=github
    :target: https://github.com/OCA/rest-framework/tree/18.0/fastapi_auth_partner
    :alt: OCA/rest-framework
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
    :target: https://translation.odoo-community.org/projects/rest-framework-18-0/rest-framework-18-0-fastapi_auth_partner
    :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/rest-framework&target_branch=18.0
    :alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module is the FastAPI implementation of
`auth_partner <../auth_partner>`__ it provides all the routes to manage
the authentication of partners.

**Table of contents**

.. contents::
   :local:

Usage
=====

First you have to add the auth router to your FastAPI endpoint and the
authentication dependency to your app dependencies:

.. code:: python

   from odoo.addons.fastapi import dependencies
   from odoo.addons.fastapi_auth_partner.dependencies import (
     auth_partner_authenticated_partner,
   )
   from odoo.addons.fastapi_auth_partner.routers.auth import auth_router

   class FastapiEndpoint(models.Model):
       _inherit = "fastapi.endpoint"

       def _get_fastapi_routers(self):
         if self.app == "myapp":
             return [
                 auth_router,
             ]
         return super()._get_fastapi_routers()

       def _get_app_dependencies_overrides(self):
           res = super()._get_app_dependencies_overrides()
           if self.app == "myapp":
               res.update(
                   {
                       dependencies.authenticated_partner_impl: auth_partner_authenticated_partner,
                   }
               )
           return res

Next you can manage your authenticable partners and directories in the
Odoo interface:

FastAPI > Authentication > Partner

and

FastAPI > Authentication > Directory

Next you must set the directory used for the authentication in the
FastAPI endpoint:

FastAPI > FastAPI Endpoint > myapp > Directory

Then you can use the auth router to authenticate your requests:

- POST /auth/register to register a partner
- POST /auth/login to authenticate a partner
- POST /auth/logout to unauthenticate a partner
- POST /auth/validate_email to validate a partner email
- POST /auth/request_reset_password to request a password reset
- POST /auth/set_password to set a new password
- GET /auth/profile to get the partner profile
- GET /auth/impersonate to impersonate a partner

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/rest-framework/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 <https://github.com/OCA/rest-framework/issues/new?body=module:%20fastapi_auth_partner%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
-------

* Akretion

Contributors
------------

- `Akretion <https://www.akretion.com>`__:

  - Sébastien Beau
  - Florian Mounier

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
   :alt: Odoo Community Association
   :target: https://odoo-community.org

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/rest-framework <https://github.com/OCA/rest-framework/tree/18.0/fastapi_auth_partner>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
