Skip to content

Commit 14065cc

Browse files
committed
[MIG] fastapi_auth_jwt_demo: Migration to 18.0
1 parent 2eef11e commit 14065cc

File tree

4 files changed

+173
-45
lines changed

4 files changed

+173
-45
lines changed

fastapi_auth_jwt_demo/README.rst

Lines changed: 84 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
=====================
2-
FastAPI Auth JWT Test
3-
=====================
1+
======================
2+
FastAPI Auth JWT Model
3+
======================
44

55
..
66
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
77
!! This file is generated by oca-gen-addon-readme !!
88
!! changes will be overwritten. !!
99
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10-
!! source digest: sha256:0808c6ada00df4f17e6f45cad7b22796dec0e945b1dddf2814d39a484e976b78
10+
!! source digest: sha256:7e014d71c6caa0eee959cdf9b1153e4ef259b88623dbdac5ff634a95ccfd0695
1111
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1212
1313
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
@@ -17,47 +17,111 @@ FastAPI Auth JWT Test
1717
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
1818
:alt: License: LGPL-3
1919
.. |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_demo
20+
:target: https://github.com/OCA/rest-framework/tree/18.0/fastapi_auth_jwt_model
2121
:alt: OCA/rest-framework
2222
.. |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_demo
23+
:target: https://translation.odoo-community.org/projects/rest-framework-18-0/rest-framework-18-0-fastapi_auth_jwt_model
2424
:alt: Translate me on Weblate
2525
.. |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=18.0
2727
:alt: Try me on Runboat
2828

2929
|badge1| |badge2| |badge3| |badge4| |badge5|
3030

31-
Tests and demo routes for ``fastapi_auth_jwt``.
32-
33-
The tests and routes are almost identical to those in ``auth_jwt_demo``, and
34-
the JWT validators used are those from ``auth_jwt_demo``.
31+
A prototype routes for ``fastapi_auth_jwt``.
3532

3633
**Table of contents**
3734

3835
.. contents::
3936
:local:
4037

38+
Usage
39+
=====
40+
41+
Example on using the API as a URL having arguments
42+
--------------------------------------------------
43+
44+
.. code:: Bash
45+
46+
curl -X 'GET' \
47+
'http://localhost:8069/fastapi_auth_http_model/whoami' \
48+
-H 'accept: application/json' \
49+
-H 'Authorization: Basic ZGVtbzpkZW1v'
50+
51+
To get Access Key via headers API
52+
53+
.. code:: Bash
54+
55+
curl -X 'POST' \
56+
'http://localhost:8069/fastapi_auth_http_model/get_access_token' \
57+
-H 'accept: application/json' \
58+
-H 'Content-Type: application/json' \
59+
-H 'Authorization: Basic ZGVtbzpkZW1v' \
60+
-d '{
61+
"aud": "auth_jwt_test_api",
62+
"iss": "theissuer",
63+
"exp": 1734650709.8363235,
64+
"email": "string",
65+
"key": "thesecret",
66+
"algorithm": "HS256",
67+
"access_key": "string"
68+
}'
69+
70+
To get Access Key via agumental API
71+
72+
.. code:: Bash
73+
74+
curl -X 'GET' \
75+
'http://localhost:8069/fastapi_auth_http_model/get_access_token/args?aud=auth_jwt_test_api&iss=theissuer&exp=1734651126.588449&email=mark.brown23%40example.com&key=thesecret&algorithm=HS256' \
76+
-H 'accept: application/json' \
77+
-H 'Authorization: Basic ZGVtbzpkZW1v' \
78+
79+
.. code:: Bash
80+
81+
curl -X 'GET' \
82+
'http://localhost:8069/fastapi_auth_http_model/customer' \
83+
-H 'accept: application/json' \
84+
-H 'Authorization: Basic ZGVtbzpkZW1v' \
85+
86+
The encryption is from ``demo:demo``, to test:
87+
88+
encode
89+
90+
.. code:: Bash
91+
92+
echo -n 'demo:demo' | base64
93+
94+
decode
95+
96+
.. code:: Bash
97+
98+
echo -n 'demo:demo' | base64 -d
99+
41100
Bug Tracker
42101
===========
43102

44103
Bugs are tracked on `GitHub Issues <https://github.com/OCA/rest-framework/issues>`_.
45104
In case of trouble, please check there if your issue has already been reported.
46105
If you spotted it first, help us to smash it by providing a detailed and welcomed
47-
`feedback <https://github.com/OCA/rest-framework/issues/new?body=module:%20fastapi_auth_jwt_demo%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
106+
`feedback <https://github.com/OCA/rest-framework/issues/new?body=module:%20fastapi_auth_jwt_model%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
48107

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

51110
Credits
52111
=======
53112

54113
Authors
55-
~~~~~~~
114+
-------
115+
116+
* kobros-tech
117+
118+
Contributors
119+
------------
56120

57-
* ACSONE SA/NV
121+
Mohamed Alkobrosli <[email protected]>
58122

59123
Maintainers
60-
~~~~~~~~~~~
124+
-----------
61125

62126
This module is maintained by the OCA.
63127

@@ -69,14 +133,14 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
69133
mission is to support the collaborative development of Odoo features and
70134
promote its widespread use.
71135

72-
.. |maintainer-sbidoul| image:: https://github.com/sbidoul.png?size=40px
73-
:target: https://github.com/sbidoul
74-
:alt: sbidoul
136+
.. |maintainer-kobros-tech| image:: https://github.com/kobros-tech.png?size=40px
137+
:target: https://github.com/kobros-tech
138+
:alt: kobros-tech
75139

76140
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
77141

78-
|maintainer-sbidoul|
142+
|maintainer-kobros-tech|
79143

80-
This module is part of the `OCA/rest-framework <https://github.com/OCA/rest-framework/tree/16.0/fastapi_auth_jwt_demo>`_ project on GitHub.
144+
This module is part of the `OCA/rest-framework <https://github.com/OCA/rest-framework/tree/18.0/fastapi_auth_jwt_model>`_ project on GitHub.
81145

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

fastapi_auth_jwt_demo/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["whool"]
3+
build-backend = "whool.buildapi"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Mohamed Alkobrosli \<<[email protected]>\>

fastapi_auth_jwt_demo/static/description/index.html

Lines changed: 85 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
<?xml version="1.0" encoding="utf-8"?>
21
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
32
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
43
<head>
54
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
65
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
7-
<title>FastAPI Auth JWT Test</title>
6+
<title>FastAPI Auth JWT Model</title>
87
<style type="text/css">
98

109
/*
1110
:Author: David Goodger ([email protected])
12-
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
11+
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
1312
:Copyright: This stylesheet has been placed in the public domain.
1413
1514
Default cascading style sheet for the HTML output of Docutils.
15+
Despite the name, some widely supported CSS2 features are used.
1616
1717
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
1818
customize this style sheet.
@@ -275,7 +275,7 @@
275275
margin-left: 2em ;
276276
margin-right: 2em }
277277

278-
pre.code .ln { color: grey; } /* line numbers */
278+
pre.code .ln { color: gray; } /* line numbers */
279279
pre.code, code { background-color: #eeeeee }
280280
pre.code .comment, code .comment { color: #5C6576 }
281281
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
@@ -301,7 +301,7 @@
301301
span.pre {
302302
white-space: pre }
303303

304-
span.problematic {
304+
span.problematic, pre.problematic {
305305
color: red }
306306

307307
span.section-subtitle {
@@ -360,56 +360,116 @@
360360
</style>
361361
</head>
362362
<body>
363-
<div class="document" id="fastapi-auth-jwt-test">
364-
<h1 class="title">FastAPI Auth JWT Test</h1>
363+
<div class="document" id="fastapi-auth-jwt-model">
364+
<h1 class="title">FastAPI Auth JWT Model</h1>
365365

366366
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
367367
!! This file is generated by oca-gen-addon-readme !!
368368
!! changes will be overwritten. !!
369369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370-
!! source digest: sha256:0808c6ada00df4f17e6f45cad7b22796dec0e945b1dddf2814d39a484e976b78
370+
!! source digest: sha256:7e014d71c6caa0eee959cdf9b1153e4ef259b88623dbdac5ff634a95ccfd0695
371371
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372-
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/rest-framework/tree/16.0/fastapi_auth_jwt_demo"><img alt="OCA/rest-framework" src="https://img.shields.io/badge/github-OCA%2Frest--framework-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/rest-framework-16-0/rest-framework-16-0-fastapi_auth_jwt_demo"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/rest-framework&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373-
<p>Tests and demo routes for <tt class="docutils literal">fastapi_auth_jwt</tt>.</p>
374-
<p>The tests and routes are almost identical to those in <tt class="docutils literal">auth_jwt_demo</tt>, and
375-
the JWT validators used are those from <tt class="docutils literal">auth_jwt_demo</tt>.</p>
372+
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/rest-framework/tree/18.0/fastapi_auth_jwt_model"><img alt="OCA/rest-framework" src="https://img.shields.io/badge/github-OCA%2Frest--framework-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/rest-framework-18-0/rest-framework-18-0-fastapi_auth_jwt_model"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/rest-framework&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373+
<p>A prototype routes for <tt class="docutils literal">fastapi_auth_jwt</tt>.</p>
376374
<p><strong>Table of contents</strong></p>
377375
<div class="contents local topic" id="contents">
378376
<ul class="simple">
379-
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-1">Bug Tracker</a></li>
380-
<li><a class="reference internal" href="#credits" id="toc-entry-2">Credits</a><ul>
381-
<li><a class="reference internal" href="#authors" id="toc-entry-3">Authors</a></li>
382-
<li><a class="reference internal" href="#maintainers" id="toc-entry-4">Maintainers</a></li>
377+
<li><a class="reference internal" href="#usage" id="toc-entry-1">Usage</a><ul>
378+
<li><a class="reference internal" href="#example-on-using-the-api-as-a-url-having-arguments" id="toc-entry-2">Example on using the API as a URL having arguments</a></li>
383379
</ul>
384380
</li>
381+
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-3">Bug Tracker</a></li>
382+
<li><a class="reference internal" href="#credits" id="toc-entry-4">Credits</a><ul>
383+
<li><a class="reference internal" href="#authors" id="toc-entry-5">Authors</a></li>
384+
<li><a class="reference internal" href="#contributors" id="toc-entry-6">Contributors</a></li>
385+
<li><a class="reference internal" href="#maintainers" id="toc-entry-7">Maintainers</a></li>
385386
</ul>
387+
</li>
388+
</ul>
389+
</div>
390+
<div class="section" id="usage">
391+
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
392+
<div class="section" id="example-on-using-the-api-as-a-url-having-arguments">
393+
<h2><a class="toc-backref" href="#toc-entry-2">Example on using the API as a URL having arguments</a></h2>
394+
<pre class="code Bash literal-block">
395+
curl<span class="w"> </span>-X<span class="w"> </span><span class="s1">'GET'</span><span class="w"> </span><span class="se">\
396+
</span><span class="w"> </span><span class="s1">'http://localhost:8069/fastapi_auth_http_model/whoami'</span><span class="w"> </span><span class="se">\
397+
</span><span class="w"> </span>-H<span class="w"> </span><span class="s1">'accept: application/json'</span><span class="w"> </span><span class="se">\
398+
</span><span class="w"> </span>-H<span class="w"> </span><span class="s1">'Authorization: Basic ZGVtbzpkZW1v'</span>
399+
</pre>
400+
<p>To get Access Key via headers API</p>
401+
<pre class="code Bash literal-block">
402+
curl<span class="w"> </span>-X<span class="w"> </span><span class="s1">'POST'</span><span class="w"> </span><span class="se">\
403+
</span><span class="w"> </span><span class="s1">'http://localhost:8069/fastapi_auth_http_model/get_access_token'</span><span class="w"> </span><span class="se">\
404+
</span><span class="w"> </span>-H<span class="w"> </span><span class="s1">'accept: application/json'</span><span class="w"> </span><span class="se">\
405+
</span><span class="w"> </span>-H<span class="w"> </span><span class="s1">'Content-Type: application/json'</span><span class="w"> </span><span class="se">\
406+
</span><span class="w"> </span>-H<span class="w"> </span><span class="s1">'Authorization: Basic ZGVtbzpkZW1v'</span><span class="w"> </span><span class="se">\
407+
</span><span class="w"> </span>-d<span class="w"> </span><span class="s1">'{
408+
&quot;aud&quot;: &quot;auth_jwt_test_api&quot;,
409+
&quot;iss&quot;: &quot;theissuer&quot;,
410+
&quot;exp&quot;: 1734650709.8363235,
411+
&quot;email&quot;: &quot;string&quot;,
412+
&quot;key&quot;: &quot;thesecret&quot;,
413+
&quot;algorithm&quot;: &quot;HS256&quot;,
414+
&quot;access_key&quot;: &quot;string&quot;
415+
}'</span>
416+
</pre>
417+
<p>To get Access Key via agumental API</p>
418+
<pre class="code Bash literal-block">
419+
curl<span class="w"> </span>-X<span class="w"> </span><span class="s1">'GET'</span><span class="w"> </span><span class="se">\
420+
</span><span class="w"> </span><span class="s1">'http://localhost:8069/fastapi_auth_http_model/get_access_token/args?aud=auth_jwt_test_api&amp;iss=theissuer&amp;exp=1734651126.588449&amp;email=mark.brown23%40example.com&amp;key=thesecret&amp;algorithm=HS256'</span><span class="w"> </span><span class="se">\
421+
</span><span class="w"> </span>-H<span class="w"> </span><span class="s1">'accept: application/json'</span><span class="w"> </span><span class="se">\
422+
</span><span class="w"> </span>-H<span class="w"> </span><span class="s1">'Authorization: Basic ZGVtbzpkZW1v'</span><span class="w"> </span><span class="se">\</span>
423+
</pre>
424+
<pre class="code Bash literal-block">
425+
curl<span class="w"> </span>-X<span class="w"> </span><span class="s1">'GET'</span><span class="w"> </span><span class="se">\
426+
</span><span class="w"> </span><span class="s1">'http://localhost:8069/fastapi_auth_http_model/customer'</span><span class="w"> </span><span class="se">\
427+
</span><span class="w"> </span>-H<span class="w"> </span><span class="s1">'accept: application/json'</span><span class="w"> </span><span class="se">\
428+
</span><span class="w"> </span>-H<span class="w"> </span><span class="s1">'Authorization: Basic ZGVtbzpkZW1v'</span><span class="w"> </span><span class="se">\</span>
429+
</pre>
430+
<p>The encryption is from <tt class="docutils literal">demo:demo</tt>, to test:</p>
431+
<p>encode</p>
432+
<pre class="code Bash literal-block">
433+
<span class="nb">echo</span><span class="w"> </span>-n<span class="w"> </span><span class="s1">'demo:demo'</span><span class="w"> </span><span class="p">|</span><span class="w"> </span>base64
434+
</pre>
435+
<p>decode</p>
436+
<pre class="code Bash literal-block">
437+
<span class="nb">echo</span><span class="w"> </span>-n<span class="w"> </span><span class="s1">'demo:demo'</span><span class="w"> </span><span class="p">|</span><span class="w"> </span>base64<span class="w"> </span>-d
438+
</pre>
439+
</div>
386440
</div>
387441
<div class="section" id="bug-tracker">
388-
<h1><a class="toc-backref" href="#toc-entry-1">Bug Tracker</a></h1>
442+
<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
389443
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/rest-framework/issues">GitHub Issues</a>.
390444
In case of trouble, please check there if your issue has already been reported.
391445
If you spotted it first, help us to smash it by providing a detailed and welcomed
392-
<a class="reference external" href="https://github.com/OCA/rest-framework/issues/new?body=module:%20fastapi_auth_jwt_demo%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
446+
<a class="reference external" href="https://github.com/OCA/rest-framework/issues/new?body=module:%20fastapi_auth_jwt_model%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
393447
<p>Do not contact contributors directly about support or help with technical issues.</p>
394448
</div>
395449
<div class="section" id="credits">
396-
<h1><a class="toc-backref" href="#toc-entry-2">Credits</a></h1>
450+
<h1><a class="toc-backref" href="#toc-entry-4">Credits</a></h1>
397451
<div class="section" id="authors">
398-
<h2><a class="toc-backref" href="#toc-entry-3">Authors</a></h2>
452+
<h2><a class="toc-backref" href="#toc-entry-5">Authors</a></h2>
399453
<ul class="simple">
400-
<li>ACSONE SA/NV</li>
454+
<li>kobros-tech</li>
401455
</ul>
402456
</div>
457+
<div class="section" id="contributors">
458+
<h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
459+
<p>Mohamed Alkobrosli &lt;<a class="reference external" href="mailto:alkobroslymohamed&#64;gmail.com">alkobroslymohamed&#64;gmail.com</a>&gt;</p>
460+
</div>
403461
<div class="section" id="maintainers">
404-
<h2><a class="toc-backref" href="#toc-entry-4">Maintainers</a></h2>
462+
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
405463
<p>This module is maintained by the OCA.</p>
406-
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
464+
<a class="reference external image-reference" href="https://odoo-community.org">
465+
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
466+
</a>
407467
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
408468
mission is to support the collaborative development of Odoo features and
409469
promote its widespread use.</p>
410470
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
411-
<p><a class="reference external image-reference" href="https://github.com/sbidoul"><img alt="sbidoul" src="https://github.com/sbidoul.png?size=40px" /></a></p>
412-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/rest-framework/tree/16.0/fastapi_auth_jwt_demo">OCA/rest-framework</a> project on GitHub.</p>
471+
<p><a class="reference external image-reference" href="https://github.com/kobros-tech"><img alt="kobros-tech" src="https://github.com/kobros-tech.png?size=40px" /></a></p>
472+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/rest-framework/tree/18.0/fastapi_auth_jwt_model">OCA/rest-framework</a> project on GitHub.</p>
413473
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
414474
</div>
415475
</div>

0 commit comments

Comments
 (0)