@@ -7,7 +7,7 @@ FastAPI Auth JWT support
7
7
!! This file is generated by oca-gen-addon-readme !!
8
8
!! changes will be overwritten. !!
9
9
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10
- !! source digest: sha256:2829a34d48a1906819029e7b796d33a1ee2ad2a47693396da96f92ede04ec17d
10
+ !! source digest: sha256:a7c4a8b4ef360ff91c0b2bcb7ee4ce90308f98ee56c94dd2d651e35ceb92011c
11
11
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12
12
13
13
.. |badge1 | image :: https://img.shields.io/badge/maturity-Beta-yellow.png
@@ -17,19 +17,20 @@ FastAPI Auth JWT support
17
17
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
18
18
:alt: License: LGPL-3
19
19
.. |badge3 | image :: https://img.shields.io/badge/github-OCA%2Frest--framework-lightgray.png?logo=github
20
- :target: https://github.com/OCA/rest-framework/tree/16 .0/fastapi_auth_jwt
20
+ :target: https://github.com/OCA/rest-framework/tree/17 .0/fastapi_auth_jwt
21
21
:alt: OCA/rest-framework
22
22
.. |badge4 | image :: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23
- :target: https://translation.odoo-community.org/projects/rest-framework-16 -0/rest-framework-16 -0-fastapi_auth_jwt
23
+ :target: https://translation.odoo-community.org/projects/rest-framework-17 -0/rest-framework-17 -0-fastapi_auth_jwt
24
24
:alt: Translate me on Weblate
25
25
.. |badge5 | image :: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26
- :target: https://runboat.odoo-community.org/builds?repo=OCA/rest-framework&target_branch=16 .0
26
+ :target: https://runboat.odoo-community.org/builds?repo=OCA/rest-framework&target_branch=17 .0
27
27
:alt: Try me on Runboat
28
28
29
29
|badge1 | |badge2 | |badge3 | |badge4 | |badge5 |
30
30
31
- This module provides ``FastAPI `` ``Depends `` to allow authentication with `auth_jwt
32
- <https://github.com/OCA/server-auth/tree/16.0/auth_jwt> `_.
31
+ This module provides ``FastAPI `` ``Depends `` to allow authentication
32
+ with
33
+ `auth_jwt <https://github.com/OCA/server-auth/tree/16.0/auth_jwt >`__.
33
34
34
35
**Table of contents **
35
36
@@ -39,83 +40,90 @@ This module provides ``FastAPI`` ``Depends`` to allow authentication with `auth_
39
40
Usage
40
41
=====
41
42
42
- The following FastAPI dependencies are provided and importable from
43
+ The following FastAPI dependencies are provided and importable from
43
44
``odoo.addons.fastapi_auth_jwt.dependencies ``:
44
45
45
46
``def auth_jwt_authenticated_payload() -> Payload ``
46
47
47
- Return the authenticated JWT payload. Raise a 401 (unauthorized) if absent or invalid.
48
+ Return the authenticated JWT payload. Raise a 401 (unauthorized) if
49
+ absent or invalid.
48
50
49
51
``def auth_jwt_optionally_authenticated_payload() -> Payload | None ``
50
52
51
- Return the authenticated JWT payload, or ``None `` if the ``Authorization `` header and
52
- cookie are absent. Raise a 401 (unauthorized) if present and invalid.
53
+ Return the authenticated JWT payload, or ``None `` if the
54
+ ``Authorization `` header and cookie are absent. Raise a 401
55
+ (unauthorized) if present and invalid.
53
56
54
57
``def auth_jwt_authenticated_partner() -> Partner ``
55
58
56
- Obtain the authenticated partner corresponding to the provided JWT token, according to
57
- the partner strategy defined on the ``auth_jwt `` validator. Raise a 401 (unauthorized)
58
- if the partner could not be determined for any reason.
59
+ Obtain the authenticated partner corresponding to the provided JWT
60
+ token, according to the partner strategy defined on the ``auth_jwt ``
61
+ validator. Raise a 401 (unauthorized) if the partner could not be
62
+ determined for any reason.
59
63
60
- This is function suitable and intended to override
61
- ``odoo.addons.fastapi.dependencies.authenticated_partner_impl ``.
64
+ This is function suitable and intended to override
65
+ ``odoo.addons.fastapi.dependencies.authenticated_partner_impl ``.
62
66
63
- The partner record returned by this function is bound to an environment that uses the
64
- Odoo user obtained from the user strategy defined on the ``auth_jwt `` validator. When
65
- used ``authenticated_partner_impl `` this in turn ensures that
66
- ``odoo.addons.fastapi.dependencies.authenticated_partner_env `` is also bound to the
67
- correct Odoo user.
67
+ The partner record returned by this function is bound to an
68
+ environment that uses the Odoo user obtained from the user strategy
69
+ defined on the ``auth_jwt `` validator. When used
70
+ ``authenticated_partner_impl `` this in turn ensures that
71
+ ``odoo.addons.fastapi.dependencies.authenticated_partner_env `` is
72
+ also bound to the correct Odoo user.
68
73
69
74
``def auth_jwt_optionally_authenticated_partner() -> Partner ``
70
75
71
- Same as ``auth_jwt_partner `` except it returns an empty recordset bound to the
72
- ``public `` user if the ``Authorization `` header and cookie are absent, or if the JWT
73
- validator could not find the partner and declares that the partner is not required.
76
+ Same as ``auth_jwt_partner `` except it returns an empty recordset
77
+ bound to the ``public `` user if the ``Authorization `` header and
78
+ cookie are absent, or if the JWT validator could not find the partner
79
+ and declares that the partner is not required.
74
80
75
81
``def auth_jwt_authenticated_odoo_env() -> Environment ``
76
82
77
- Return an Odoo environment using the the Odoo user obtained from the user strategy
78
- defined on the ``auth_jwt `` validator, if the request could be authenticated using a
79
- JWT validator. Raise a 401 (unauthorized) otherwise.
83
+ Return an Odoo environment using the the Odoo user obtained from the
84
+ user strategy defined on the ``auth_jwt `` validator, if the request
85
+ could be authenticated using a JWT validator. Raise a 401
86
+ (unauthorized) otherwise.
80
87
81
- This is function suitable and intended to override
82
- ``odoo.addons.fastapi.dependencies.authenticated_odoo_env_impl ``.
88
+ This is function suitable and intended to override
89
+ ``odoo.addons.fastapi.dependencies.authenticated_odoo_env_impl ``.
83
90
84
91
``def auth_jwt_default_validator_name() -> str | None ``
85
92
86
- Return the name of the default JWT validator to use.
93
+ Return the name of the default JWT validator to use.
87
94
88
- The default implementation returns ``None `` meaning only one active JWT validator is
89
- allowed. This dependency is meant to be overridden.
95
+ The default implementation returns ``None `` meaning only one active
96
+ JWT validator is allowed. This dependency is meant to be overridden.
90
97
91
98
``def auth_jwt_http_header_authorization() -> str | None ``
92
99
93
- By default, return the credentials part of the ``Authorization `` header, or ``None ``
94
- if absent. This dependency is meant to be overridden, in particular with
95
- ``fastapi.security.OAuth2AuthorizationCodeBearer `` to let swagger handle OAuth2
96
- authorization (such override is only necessary for comfort when using the swagger
97
- interface).
100
+ By default, return the credentials part of the ``Authorization ``
101
+ header, or ``None `` if absent. This dependency is meant to be
102
+ overridden, in particular with
103
+ ``fastapi.security.OAuth2AuthorizationCodeBearer `` to let swagger
104
+ handle OAuth2 authorization (such override is only necessary for
105
+ comfort when using the swagger interface).
98
106
99
107
Bug Tracker
100
108
===========
101
109
102
110
Bugs are tracked on `GitHub Issues <https://github.com/OCA/rest-framework/issues >`_.
103
111
In case of trouble, please check there if your issue has already been reported.
104
112
If you spotted it first, help us to smash it by providing a detailed and welcomed
105
- `feedback <https://github.com/OCA/rest-framework/issues/new?body=module:%20fastapi_auth_jwt%0Aversion:%2016 .0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior** >`_.
113
+ `feedback <https://github.com/OCA/rest-framework/issues/new?body=module:%20fastapi_auth_jwt%0Aversion:%2017 .0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior** >`_.
106
114
107
115
Do not contact contributors directly about support or help with technical issues.
108
116
109
117
Credits
110
118
=======
111
119
112
120
Authors
113
- ~~~~~~~
121
+ -------
114
122
115
123
* ACSONE SA/NV
116
124
117
125
Maintainers
118
- ~~~~~~~~~~~
126
+ -----------
119
127
120
128
This module is maintained by the OCA.
121
129
@@ -135,6 +143,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
135
143
136
144
|maintainer-sbidoul |
137
145
138
- This module is part of the `OCA/rest-framework <https://github.com/OCA/rest-framework/tree/16 .0/fastapi_auth_jwt >`_ project on GitHub.
146
+ This module is part of the `OCA/rest-framework <https://github.com/OCA/rest-framework/tree/17 .0/fastapi_auth_jwt >`_ project on GitHub.
139
147
140
148
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
0 commit comments