-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8b5ce6a
commit 2dbdd31
Showing
13 changed files
with
172 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ var/ | |
|
||
# coverage | ||
.coverage | ||
htmlcov/ | ||
|
||
# testing py | ||
test.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
## 0.3.0 | ||
* **(Deprecated)** environment variable support | ||
* Change name function **load_end()** -> **load_config()** | ||
* Change name function **get_jwt_identity()** -> **get_jwt_subject()** | ||
* Change name identity claims to standard claims sub *(Thanks to @rassie for suggestion)* | ||
* Additional headers in claims | ||
* Get additional headers claims from request or parsing token directly | ||
* Leeway exp claim decode token | ||
* Dynamic token expires time | ||
* Change name **blacklist** -> **denylist** | ||
* Denylist custom check refresh and access tokens | ||
* Issuer claim | ||
* Audience claim | ||
* Jwt decode algorithms | ||
* Dynamic algorithm create token | ||
* Token multiple location | ||
* Support RSA encryption *(Thanks to @jet10000 for make issues)* | ||
* Custom header name and type | ||
* Custom error message key and status code | ||
* JWT in cookies *(Thanks to @m4nuC for make issues)* | ||
* Add Additional claims | ||
* Add Documentation *(#9 by @paulussimanjuntak)* | ||
|
||
## 0.2.0 | ||
|
||
* Call create_token and get_jti function must be from dependency injection | ||
* Improve blacklist loader | ||
* Can load env from pydantic | ||
* Add docs on readme how to use without dependency injection and example on multiple files | ||
* Fix raise jwt exception PR #1 by @ironslob | ||
|
||
## 0.1.0 | ||
|
||
* Initial release. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
## Sharing feedback | ||
|
||
This project is still quite new and therefore having your feedback will really help to | ||
prioritize relevant feature developments :rocket:. If you want to contribute thankss a lot :smile:, you can | ||
open an <a href="https://github.com/IndominusByte/fastapi-jwt-auth/issues/new">issue</a> on Github. | ||
|
||
## Developing | ||
|
||
If you already cloned the repository and you know that you need to deep dive in the code, here are some guidelines to set up your environment. | ||
|
||
## Docs | ||
|
||
The documentation uses <a href="https://www.mkdocs.org/" class="external-link" target="_blank">MkDocs</a>. | ||
|
||
All the documentation is in Markdown format in the directory `./docs`. | ||
|
||
Many of the sections in the User Guide have blocks of code. | ||
|
||
In fact, those blocks of code are not written inside the Markdown, they are Python files in the `./examples/` directory. | ||
|
||
And those Python files are included/injected in the documentation when generating the site. | ||
|
||
### Docs for tests | ||
|
||
Most of the tests actually run against the example source files in the documentation. | ||
|
||
This helps making sure that: | ||
|
||
* The documentation is up to date. | ||
* The documentation examples can be run as is. | ||
* Most of the features are covered by the documentation, ensured by test coverage. | ||
|
||
During local development, there is a script that builds the site and checks for any changes, live-reloading: | ||
|
||
```bash | ||
$ bash scripts/docs-live.sh | ||
``` | ||
|
||
It will serve the documentation on `http://0.0.0.0:5000`. | ||
|
||
That way, you can edit the documentation/source files and see the changes live. | ||
|
||
## Tests | ||
|
||
There is a script that you can run locally to test all the code and generate coverage reports in HTML: | ||
|
||
```bash | ||
bash scripts/tests.sh | ||
``` | ||
|
||
This command generates a directory `./htmlcov/`, if you open the file `./htmlcov/index.html` in your browser, you can explore interactively the regions of code that are covered by the tests, and notice if there is any region missing. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
a.external-link::after { | ||
/* \00A0 is a non-breaking space | ||
to make the mark be on the same line as the link | ||
*/ | ||
content: "\00A0[↪]"; | ||
} | ||
|
||
a.internal-link::after { | ||
/* \00A0 is a non-breaking space | ||
to make the mark be on the same line as the link | ||
*/ | ||
content: "\00A0↪"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{!../CHANGELOG.md!} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
from .auth_jwt import AuthJWT | ||
"""FastAPI extension that provides JWT Auth support (secure, easy to use and lightweight)""" | ||
|
||
__version__ = "0.3.0" | ||
|
||
from .auth_jwt import AuthJWT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
[build-system] | ||
requires = ["flit_core >=2,<4"] | ||
build-backend = "flit_core.buildapi" | ||
|
||
[tool.flit.metadata] | ||
module = "fastapi_jwt_auth" | ||
author = "Nyoman Pradipta Dewantara" | ||
author-email = "nyomanpradipta120@gmail.com" | ||
home-page = "https://github.com/IndominusByte/fastapi-jwt-auth" | ||
|
||
classifiers = [ | ||
"Environment :: Web Environment", | ||
"Intended Audience :: Developers", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.6", | ||
"Programming Language :: Python :: 3.7", | ||
"Programming Language :: Python :: 3.8", | ||
"License :: OSI Approved :: MIT License", | ||
"Operating System :: OS Independent", | ||
"Topic :: Internet :: WWW/HTTP :: Dynamic Content", | ||
"Topic :: Software Development :: Libraries :: Python Modules" | ||
] | ||
|
||
requires = [ | ||
"fastapi>=0.61.0", | ||
"PyJWT>=1.7.1,<2.0.0" | ||
] | ||
|
||
description-file = "README.md" | ||
requires-python = ">=3.6" | ||
|
||
[tool.flit.metadata.requires-extra] | ||
test = [ | ||
"pytest==6.0.1", | ||
"pytest-cov==2.10.0" | ||
] | ||
|
||
doc = [ | ||
"mkdocs >=1.1.2,<2.0.0", | ||
"mkdocs-material >=5.5.0,<6.0.0", | ||
"markdown-include >=0.5.1,<0.6.0" | ||
] | ||
|
||
dev = [ | ||
"cryptography>=2.6,<4.0.0", | ||
"uvicorn >=0.11.5,<0.12.0" | ||
] | ||
|
||
asymmetric = ["cryptography>=2.6,<4.0.0"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
mkdocs serve -a 0.0.0.0:5000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
pytest --cov=tests --cov-report=term-missing --cov-report=html -v |