Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.

Commit b46d32d

Browse files
committed
docs: add starter documentation files
1 parent 32006f4 commit b46d32d

File tree

7 files changed

+299
-2
lines changed

7 files changed

+299
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<p align="center" mar>
2-
<a href=""><img src="./logo.png" alt="FastAPI-allauth" width="80%"/></a>
1+
<p align="center">
2+
<a href=""><img src="./docs/img/logo.png" alt="FastAPI-allauth" width="85%"/></a>
33
</p>
44
<p align="center">
55
<em>⚡ Powerful and Secure Authentication tool for FastAPI ⚡</em>

docs/en/docs/img/favicon.png

8.77 KB
Loading

docs/en/docs/img/logo.svg

Lines changed: 16 additions & 0 deletions
Loading

docs/en/docs/index.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Welcome to MkDocs
2+
3+
For full documentation visit [mkdocs.org](https://www.mkdocs.org).
4+
5+
## Commands
6+
7+
* `mkdocs new [dir-name]` - Create a new project.
8+
* `mkdocs serve` - Start the live-reloading docs server.
9+
* `mkdocs build` - Build the documentation site.
10+
* `mkdocs -h` - Print help message and exit.
11+
12+
## Project layout
13+
14+
mkdocs.yml # The configuration file.
15+
docs/
16+
index.md # The documentation homepage.
17+
... # Other markdown pages, images and other files.

docs/en/mkdocs.yml

Lines changed: 237 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,237 @@
1+
site_name: FastAPI-secure-jwt
2+
site_description: Powerful and Secure Authentication tool for FastAPI
3+
site_author: Nikoloz Naskidashvili
4+
site_url: https://fastapi-secure-jwt.github.io
5+
6+
theme:
7+
name: "material"
8+
highlightjs: true
9+
palette:
10+
- media: '(prefers-color-scheme: light)'
11+
scheme: default
12+
primary: teal
13+
accent: amber
14+
toggle:
15+
icon: material/lightbulb
16+
name: Switch to light mode
17+
- media: '(prefers-color-scheme: dark)'
18+
scheme: slate
19+
primary: teal
20+
accent: amber
21+
toggle:
22+
icon: material/lightbulb-outline
23+
name: Switch to dark mode
24+
features:
25+
- search.suggest
26+
- search.highlight
27+
- content.tabs.link
28+
icon:
29+
repo: fontawesome/brands/github-alt
30+
logo: img/logo.svg
31+
favicon: img/favicon.png
32+
language: en
33+
34+
repo_name: NickNaskida/FastAPI-secure-jwt
35+
repo_url: https://github.com/NickNaskida/FastAPI-secure-jwt
36+
edit_uri: ''
37+
38+
plugins:
39+
- search
40+
#- markdownextradata:
41+
# data: data
42+
43+
#nav:
44+
#- FastAPI: index.md
45+
#- Languages:
46+
# - en: /
47+
# - az: /az/
48+
# - de: /de/
49+
# - es: /es/
50+
# - fa: /fa/
51+
# - fr: /fr/
52+
# - he: /he/
53+
# - id: /id/
54+
# - it: /it/
55+
# - ja: /ja/
56+
# - ko: /ko/
57+
# - nl: /nl/
58+
# - pl: /pl/
59+
# - pt: /pt/
60+
# - ru: /ru/
61+
# - sq: /sq/
62+
# - sv: /sv/
63+
# - tr: /tr/
64+
# - uk: /uk/
65+
# - zh: /zh/
66+
#- features.md
67+
#- fastapi-people.md
68+
#- python-types.md
69+
#- Tutorial - User Guide:
70+
# - tutorial/index.md
71+
# - tutorial/first-steps.md
72+
# - tutorial/path-params.md
73+
# - tutorial/query-params.md
74+
# - tutorial/body.md
75+
# - tutorial/query-params-str-validations.md
76+
# - tutorial/path-params-numeric-validations.md
77+
# - tutorial/body-multiple-params.md
78+
# - tutorial/body-fields.md
79+
# - tutorial/body-nested-models.md
80+
# - tutorial/schema-extra-example.md
81+
# - tutorial/extra-data-types.md
82+
# - tutorial/cookie-params.md
83+
# - tutorial/header-params.md
84+
# - tutorial/response-model.md
85+
# - tutorial/extra-models.md
86+
# - tutorial/response-status-code.md
87+
# - tutorial/request-forms.md
88+
# - tutorial/request-files.md
89+
# - tutorial/request-forms-and-files.md
90+
# - tutorial/handling-errors.md
91+
# - tutorial/path-operation-configuration.md
92+
# - tutorial/encoder.md
93+
# - tutorial/body-updates.md
94+
# - Dependencies:
95+
# - tutorial/dependencies/index.md
96+
# - tutorial/dependencies/classes-as-dependencies.md
97+
# - tutorial/dependencies/sub-dependencies.md
98+
# - tutorial/dependencies/dependencies-in-path-operation-decorators.md
99+
# - tutorial/dependencies/global-dependencies.md
100+
# - tutorial/dependencies/dependencies-with-yield.md
101+
# - Security:
102+
# - tutorial/security/index.md
103+
# - tutorial/security/first-steps.md
104+
# - tutorial/security/get-current-user.md
105+
# - tutorial/security/simple-oauth2.md
106+
# - tutorial/security/oauth2-jwt.md
107+
# - tutorial/middleware.md
108+
# - tutorial/cors.md
109+
# - tutorial/sql-databases.md
110+
# - tutorial/bigger-applications.md
111+
# - tutorial/background-tasks.md
112+
# - tutorial/metadata.md
113+
# - tutorial/static-files.md
114+
# - tutorial/testing.md
115+
# - tutorial/debugging.md
116+
#- Advanced User Guide:
117+
# - advanced/index.md
118+
# - advanced/path-operation-advanced-configuration.md
119+
# - advanced/additional-status-codes.md
120+
# - advanced/response-directly.md
121+
# - advanced/custom-response.md
122+
# - advanced/additional-responses.md
123+
# - advanced/response-cookies.md
124+
# - advanced/response-headers.md
125+
# - advanced/response-change-status-code.md
126+
# - advanced/advanced-dependencies.md
127+
# - Advanced Security:
128+
# - advanced/security/index.md
129+
# - advanced/security/oauth2-scopes.md
130+
# - advanced/security/http-basic-auth.md
131+
# - advanced/using-request-directly.md
132+
# - advanced/dataclasses.md
133+
# - advanced/middleware.md
134+
# - advanced/sql-databases-peewee.md
135+
# - advanced/async-sql-databases.md
136+
# - advanced/nosql-databases.md
137+
# - advanced/sub-applications.md
138+
# - advanced/behind-a-proxy.md
139+
# - advanced/templates.md
140+
# - advanced/graphql.md
141+
# - advanced/websockets.md
142+
# - advanced/events.md
143+
# - advanced/custom-request-and-route.md
144+
# - advanced/testing-websockets.md
145+
# - advanced/testing-events.md
146+
# - advanced/testing-dependencies.md
147+
# - advanced/testing-database.md
148+
# - advanced/async-tests.md
149+
# - advanced/settings.md
150+
# - advanced/conditional-openapi.md
151+
# - advanced/extending-openapi.md
152+
# - advanced/openapi-callbacks.md
153+
# - advanced/wsgi.md
154+
# - advanced/generate-clients.md
155+
#- async.md
156+
#- Deployment:
157+
# - deployment/index.md
158+
# - deployment/versions.md
159+
# - deployment/https.md
160+
# - deployment/manually.md
161+
# - deployment/concepts.md
162+
# - deployment/deta.md
163+
# - deployment/server-workers.md
164+
# - deployment/docker.md
165+
#- project-generation.md
166+
#- alternatives.md
167+
#- history-design-future.md
168+
#- external-links.md
169+
#- benchmarks.md
170+
#- help-fastapi.md
171+
#- contributing.md
172+
#- release-notes.md
173+
#markdown_extensions:
174+
#- toc:
175+
# permalink: true
176+
#- markdown.extensions.codehilite:
177+
# guess_lang: false
178+
#- mdx_include:
179+
# base_path: docs
180+
#- admonition
181+
#- codehilite
182+
#- extra
183+
#- pymdownx.superfences:
184+
# custom_fences:
185+
# - name: mermaid
186+
# class: mermaid
187+
# format: !!python/name:pymdownx.superfences.fence_code_format ''
188+
#- pymdownx.tabbed:
189+
# alternate_style: true
190+
#- attr_list
191+
#- md_in_html
192+
#extra:
193+
# analytics:
194+
# provider: google
195+
# property: UA-133183413-1
196+
# social:
197+
# - icon: fontawesome/brands/github-alt
198+
# link: https://github.com/tiangolo/fastapi
199+
# - icon: fontawesome/brands/discord
200+
# link: https://discord.gg/VQjSZaeJmf
201+
# - icon: fontawesome/brands/twitter
202+
# link: https://twitter.com/fastapi
203+
# - icon: fontawesome/brands/linkedin
204+
# link: https://www.linkedin.com/in/tiangolo
205+
# - icon: fontawesome/brands/dev
206+
# link: https://dev.to/tiangolo
207+
# - icon: fontawesome/brands/medium
208+
# link: https://medium.com/@tiangolo
209+
# - icon: fontawesome/solid/globe
210+
# link: https://tiangolo.com
211+
# alternate:
212+
# - link: /
213+
# name: en - English
214+
# - link: /az/
215+
# name: az
216+
# - link: /de/
217+
# name: de
218+
# - link: /es/
219+
# name: es - español
220+
# - link: /fa/
221+
# name: fa
222+
# - link: /fr/
223+
# name: fr - français
224+
# - link: /he/
225+
# name: he
226+
# - link: /id/
227+
# name: id
228+
# - link: /it/
229+
# name: it - italiano
230+
# - link: /ja/
231+
# name: ja - 日本語
232+
# - link: /ko/
233+
# name: ko - 한국어
234+
# - link: /nl/
235+
# name: nl
236+
# - link: /pl/
237+
# name: pl
File renamed without changes.

example/main.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from fastapi import FastAPI
22

33
from fastapi_secure_jwt.router.auth import auth_router
4+
from fastapi_secure_jwt.jwt import generate_jwt_token, decode_jwt_token
45

56
app = FastAPI()
67
app.include_router(
@@ -9,6 +10,8 @@
910
tags=["auth"],
1011
)
1112

13+
SECRET_KEY = "NOT_A_SECRET_KEY"
14+
1215

1316
@app.get("/")
1417
async def root():
@@ -18,3 +21,27 @@ async def root():
1821
@app.get("/hello/{name}")
1922
async def say_hello(name: str):
2023
return {"message": f"Hello {name}"}
24+
25+
26+
@app.get("/token")
27+
async def get_token():
28+
return generate_jwt_token(
29+
"NickNaskida",
30+
"access",
31+
SECRET_KEY,
32+
lifetime=60 * 15,
33+
claims={
34+
"name": "Nick Naskidashvili",
35+
"email": "nick@gmail.com",
36+
"age": 25,
37+
"role": "admin"
38+
}
39+
)
40+
41+
42+
@app.get("/decode-token")
43+
async def decode_token(token: str):
44+
return decode_jwt_token(
45+
token,
46+
SECRET_KEY
47+
)

0 commit comments

Comments
 (0)