mirror of
https://github.com/bringout/oca-technical.git
synced 2026-04-18 12:11:59 +02:00
140 lines
4.8 KiB
ReStructuredText
140 lines
4.8 KiB
ReStructuredText
.. 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:2ebd9377ca7b035ab9fb0383513aacb5ca8645f69d5d85c171883b40b439017e
|
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
.. |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/16.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-16-0/rest-framework-16-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=16.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-block:: 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:%2016.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/16.0/fastapi_auth_partner>`_ project on GitHub.
|
|
|
|
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|