Skip to content

Commit

Permalink
Merge pull request #51 from dmtzs/development
Browse files Browse the repository at this point in the history
Update flask_authgent_jwt.py
  • Loading branch information
dmtzs committed Dec 6, 2022
2 parents c5d2003 + df4bbe2 commit e958392
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
[metadata]
name = Flask-authgen-jwt
version = 3.0.0
version = 3.0.1
author = Diego Martinez and Guillermo Ortega
author_email = [email protected]
description = JWT authentication and generator for Flask routes
long_description = file: README.md
long_description_content_type = text/markdown
requires-python = ">=3.9"
license_files = LICENSE
url = https://github.com/dmtzs/Flask-authgen-jwt
project_urls =
Bug Tracker = https://github.com/dmtzs/Flask-authgen-jwt/issues
Expand Down
8 changes: 4 additions & 4 deletions src/flask_authgen_jwt.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

class Core():
basic_auth_callback: Callable[[str, str], bool] = None
enc_dec_jwt_callback: dict[Union[bytes, str]] = None
enc_dec_jwt_callback: dict[str, Union[bytes, str]] = None
get_user_roles_callback: list = None
personal_credentials: tuple[str, str] = None

Expand Down Expand Up @@ -104,7 +104,7 @@ def ensure_sync(self, func: Callable) -> Callable:

class GenJwt(Core):
def __init__(self, rsa_encrypt: bool = False) -> None:
self.jwt_fields_attr: dict = None
self.jwt_fields_attr: dict[str, datetime] = None
self.rsa_encrypt: bool = rsa_encrypt

def __create_jwt_payload(self, bauth_credentials: dict[str, str]) -> dict[str, Union[str, datetime]]:
Expand Down Expand Up @@ -179,7 +179,7 @@ def __encode_jwt(self, payload: dict) -> Optional[str]:
encoded_token = None
return encoded_token

def jwt_claims(self, func: Callable[[None], dict]) -> None:
def jwt_claims(self, func: Callable[[None], dict[str, datetime]]) -> None:
"""Decorator to add the claims to the JWT payload, default fields are:
- username: username of the user
- password: password of the user
Expand Down Expand Up @@ -290,7 +290,7 @@ def __verify_token(self, token: dict) -> None:
if key not in token:
self.gen_abort_error("Credentials to validate for authentication inside token are not correct", 401)

def __authenticate_credentials(self, token: dict) -> bool:
def __authenticate_credentials(self, token: dict[str, str]) -> bool:
"""
Verify the credentials of the user, if the credentials are not correct then the user will be unauthorized
:param token: token to verify the credentials
Expand Down

0 comments on commit e958392

Please sign in to comment.