]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
📝 Update includes in `docs/en/docs/tutorial/security/oauth2-jwt.md` (#12650)
authorOkeke Chukwuemeka Christian <okekechristian1960@yahoo.com>
Sun, 10 Nov 2024 17:02:51 +0000 (17:02 +0000)
committerGitHub <noreply@github.com>
Sun, 10 Nov 2024 17:02:51 +0000 (17:02 +0000)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
docs/en/docs/tutorial/security/oauth2-jwt.md

index 6ae1507dcbb5e85c50399ddd3e75790f88ae4156..8644db45c20b1a61699ece3a00ca9eceae22499f 100644 (file)
@@ -116,57 +116,7 @@ And another utility to verify if a received password matches the hash stored.
 
 And another one to authenticate and return a user.
 
-//// tab | Python 3.10+
-
-```Python hl_lines="8  49  56-57  60-61  70-76"
-{!> ../../docs_src/security/tutorial004_an_py310.py!}
-```
-
-////
-
-//// tab | Python 3.9+
-
-```Python hl_lines="8  49  56-57  60-61  70-76"
-{!> ../../docs_src/security/tutorial004_an_py39.py!}
-```
-
-////
-
-//// tab | Python 3.8+
-
-```Python hl_lines="8  50  57-58  61-62  71-77"
-{!> ../../docs_src/security/tutorial004_an.py!}
-```
-
-////
-
-//// tab | Python 3.10+ non-Annotated
-
-/// tip
-
-Prefer to use the `Annotated` version if possible.
-
-///
-
-```Python hl_lines="7  48  55-56  59-60  69-75"
-{!> ../../docs_src/security/tutorial004_py310.py!}
-```
-
-////
-
-//// tab | Python 3.8+ non-Annotated
-
-/// tip
-
-Prefer to use the `Annotated` version if possible.
-
-///
-
-```Python hl_lines="8  49  56-57  60-61  70-76"
-{!> ../../docs_src/security/tutorial004.py!}
-```
-
-////
+{* ../../docs_src/security/tutorial004_an_py310.py hl[8,49,56:57,60:61,70:76] *}
 
 /// note
 
@@ -202,57 +152,7 @@ Define a Pydantic Model that will be used in the token endpoint for the response
 
 Create a utility function to generate a new access token.
 
-//// tab | Python 3.10+
-
-```Python hl_lines="4 7  13-15  29-31  79-87"
-{!> ../../docs_src/security/tutorial004_an_py310.py!}
-```
-
-////
-
-//// tab | Python 3.9+
-
-```Python hl_lines="4 7  13-15  29-31  79-87"
-{!> ../../docs_src/security/tutorial004_an_py39.py!}
-```
-
-////
-
-//// tab | Python 3.8+
-
-```Python hl_lines="4 7  14-16  30-32 80-88"
-{!> ../../docs_src/security/tutorial004_an.py!}
-```
-
-////
-
-//// tab | Python 3.10+ non-Annotated
-
-/// tip
-
-Prefer to use the `Annotated` version if possible.
-
-///
-
-```Python hl_lines="3 6  12-14  28-30  78-86"
-{!> ../../docs_src/security/tutorial004_py310.py!}
-```
-
-////
-
-//// tab | Python 3.8+ non-Annotated
-
-/// tip
-
-Prefer to use the `Annotated` version if possible.
-
-///
-
-```Python hl_lines="4 7  13-15  29-31  79-87"
-{!> ../../docs_src/security/tutorial004.py!}
-```
-
-////
+{* ../../docs_src/security/tutorial004_an_py310.py hl[4,7,13:15,29:31,79:87] *}
 
 ## Update the dependencies
 
@@ -262,57 +162,7 @@ Decode the received token, verify it, and return the current user.
 
 If the token is invalid, return an HTTP error right away.
 
-//// tab | Python 3.10+
-
-```Python hl_lines="90-107"
-{!> ../../docs_src/security/tutorial004_an_py310.py!}
-```
-
-////
-
-//// tab | Python 3.9+
-
-```Python hl_lines="90-107"
-{!> ../../docs_src/security/tutorial004_an_py39.py!}
-```
-
-////
-
-//// tab | Python 3.8+
-
-```Python hl_lines="91-108"
-{!> ../../docs_src/security/tutorial004_an.py!}
-```
-
-////
-
-//// tab | Python 3.10+ non-Annotated
-
-/// tip
-
-Prefer to use the `Annotated` version if possible.
-
-///
-
-```Python hl_lines="89-106"
-{!> ../../docs_src/security/tutorial004_py310.py!}
-```
-
-////
-
-//// tab | Python 3.8+ non-Annotated
-
-/// tip
-
-Prefer to use the `Annotated` version if possible.
-
-///
-
-```Python hl_lines="90-107"
-{!> ../../docs_src/security/tutorial004.py!}
-```
-
-////
+{* ../../docs_src/security/tutorial004_an_py310.py hl[90:107] *}
 
 ## Update the `/token` *path operation*
 
@@ -320,57 +170,7 @@ Create a `timedelta` with the expiration time of the token.
 
 Create a real JWT access token and return it.
 
-//// tab | Python 3.10+
-
-```Python hl_lines="118-133"
-{!> ../../docs_src/security/tutorial004_an_py310.py!}
-```
-
-////
-
-//// tab | Python 3.9+
-
-```Python hl_lines="118-133"
-{!> ../../docs_src/security/tutorial004_an_py39.py!}
-```
-
-////
-
-//// tab | Python 3.8+
-
-```Python hl_lines="119-134"
-{!> ../../docs_src/security/tutorial004_an.py!}
-```
-
-////
-
-//// tab | Python 3.10+ non-Annotated
-
-/// tip
-
-Prefer to use the `Annotated` version if possible.
-
-///
-
-```Python hl_lines="115-130"
-{!> ../../docs_src/security/tutorial004_py310.py!}
-```
-
-////
-
-//// tab | Python 3.8+ non-Annotated
-
-/// tip
-
-Prefer to use the `Annotated` version if possible.
-
-///
-
-```Python hl_lines="116-131"
-{!> ../../docs_src/security/tutorial004.py!}
-```
-
-////
+{* ../../docs_src/security/tutorial004_an_py310.py hl[118:133] *}
 
 ### Technical details about the JWT "subject" `sub`