|
| 1 | +.. image:: https://odoo-community.org/readme-banner-image |
| 2 | + :target: https://odoo-community.org/get-involved?utm_source=readme |
| 3 | + :alt: Odoo Community Association |
| 4 | + |
| 5 | +==================== |
| 6 | +Fastapi Auth Partner |
| 7 | +==================== |
| 8 | + |
| 9 | +.. |
| 10 | + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 11 | + !! This file is generated by oca-gen-addon-readme !! |
| 12 | + !! changes will be overwritten. !! |
| 13 | + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 14 | + !! source digest: sha256:959857e48fbc660ca7012f4a8364b02247c1622d785239a293e7fd4d69e474cc |
| 15 | + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 16 | +
|
| 17 | +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png |
| 18 | + :target: https://odoo-community.org/page/development-status |
| 19 | + :alt: Beta |
| 20 | +.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png |
| 21 | + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html |
| 22 | + :alt: License: AGPL-3 |
| 23 | +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Frest--framework-lightgray.png?logo=github |
| 24 | + :target: https://github.com/OCA/rest-framework/tree/18.0/fastapi_auth_partner |
| 25 | + :alt: OCA/rest-framework |
| 26 | +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png |
| 27 | + :target: https://translation.odoo-community.org/projects/rest-framework-18-0/rest-framework-18-0-fastapi_auth_partner |
| 28 | + :alt: Translate me on Weblate |
| 29 | +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png |
| 30 | + :target: https://runboat.odoo-community.org/builds?repo=OCA/rest-framework&target_branch=18.0 |
| 31 | + :alt: Try me on Runboat |
| 32 | + |
| 33 | +|badge1| |badge2| |badge3| |badge4| |badge5| |
| 34 | + |
| 35 | +This module is the FastAPI implementation of |
| 36 | +`auth_partner <../auth_partner>`__ it provides all the routes to manage |
| 37 | +the authentication of partners. |
| 38 | + |
| 39 | +**Table of contents** |
| 40 | + |
| 41 | +.. contents:: |
| 42 | + :local: |
| 43 | + |
| 44 | +Usage |
| 45 | +===== |
| 46 | + |
| 47 | +First you have to add the auth router to your FastAPI endpoint and the |
| 48 | +authentication dependency to your app dependencies: |
| 49 | + |
| 50 | +.. code:: python |
| 51 | +
|
| 52 | + from odoo.addons.fastapi import dependencies |
| 53 | + from odoo.addons.fastapi_auth_partner.dependencies import ( |
| 54 | + auth_partner_authenticated_partner, |
| 55 | + ) |
| 56 | + from odoo.addons.fastapi_auth_partner.routers.auth import auth_router |
| 57 | +
|
| 58 | + class FastapiEndpoint(models.Model): |
| 59 | + _inherit = "fastapi.endpoint" |
| 60 | +
|
| 61 | + def _get_fastapi_routers(self): |
| 62 | + if self.app == "myapp": |
| 63 | + return [ |
| 64 | + auth_router, |
| 65 | + ] |
| 66 | + return super()._get_fastapi_routers() |
| 67 | +
|
| 68 | + def _get_app_dependencies_overrides(self): |
| 69 | + res = super()._get_app_dependencies_overrides() |
| 70 | + if self.app == "myapp": |
| 71 | + res.update( |
| 72 | + { |
| 73 | + dependencies.authenticated_partner_impl: auth_partner_authenticated_partner, |
| 74 | + } |
| 75 | + ) |
| 76 | + return res |
| 77 | +
|
| 78 | +Next you can manage your authenticable partners and directories in the |
| 79 | +Odoo interface: |
| 80 | + |
| 81 | +FastAPI > Authentication > Partner |
| 82 | + |
| 83 | +and |
| 84 | + |
| 85 | +FastAPI > Authentication > Directory |
| 86 | + |
| 87 | +Next you must set the directory used for the authentication in the |
| 88 | +FastAPI endpoint: |
| 89 | + |
| 90 | +FastAPI > FastAPI Endpoint > myapp > Directory |
| 91 | + |
| 92 | +Then you can use the auth router to authenticate your requests: |
| 93 | + |
| 94 | +- POST /auth/register to register a partner |
| 95 | +- POST /auth/login to authenticate a partner |
| 96 | +- POST /auth/logout to unauthenticate a partner |
| 97 | +- POST /auth/validate_email to validate a partner email |
| 98 | +- POST /auth/request_reset_password to request a password reset |
| 99 | +- POST /auth/set_password to set a new password |
| 100 | +- GET /auth/profile to get the partner profile |
| 101 | +- GET /auth/impersonate to impersonate a partner |
| 102 | + |
| 103 | +Bug Tracker |
| 104 | +=========== |
| 105 | + |
| 106 | +Bugs are tracked on `GitHub Issues <https://github.com/OCA/rest-framework/issues>`_. |
| 107 | +In case of trouble, please check there if your issue has already been reported. |
| 108 | +If you spotted it first, help us to smash it by providing a detailed and welcomed |
| 109 | +`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**>`_. |
| 110 | + |
| 111 | +Do not contact contributors directly about support or help with technical issues. |
| 112 | + |
| 113 | +Credits |
| 114 | +======= |
| 115 | + |
| 116 | +Authors |
| 117 | +------- |
| 118 | + |
| 119 | +* Akretion |
| 120 | + |
| 121 | +Contributors |
| 122 | +------------ |
| 123 | + |
| 124 | +- `Akretion <https://www.akretion.com>`__: |
| 125 | + |
| 126 | + - Sébastien Beau |
| 127 | + - Florian Mounier |
| 128 | + |
| 129 | +Maintainers |
| 130 | +----------- |
| 131 | + |
| 132 | +This module is maintained by the OCA. |
| 133 | + |
| 134 | +.. image:: https://odoo-community.org/logo.png |
| 135 | + :alt: Odoo Community Association |
| 136 | + :target: https://odoo-community.org |
| 137 | + |
| 138 | +OCA, or the Odoo Community Association, is a nonprofit organization whose |
| 139 | +mission is to support the collaborative development of Odoo features and |
| 140 | +promote its widespread use. |
| 141 | + |
| 142 | +This module is part of the `OCA/rest-framework <https://github.com/OCA/rest-framework/tree/18.0/fastapi_auth_partner>`_ project on GitHub. |
| 143 | + |
| 144 | +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
0 commit comments