aboutsummaryrefslogtreecommitdiffstats
path: root/backend/authentication
diff options
context:
space:
mode:
authorGravatar decorator-factory <[email protected]>2020-12-15 08:13:37 +0300
committerGravatar decorator-factory <[email protected]>2020-12-15 08:13:37 +0300
commit947a30f7406b7d025cf2e5754b59389af4213718 (patch)
treec6236edb812db32f583ac0acc9099be33d1a0e2b /backend/authentication
parentAdd ks123 (GH ks129) to CODEOWNERS (diff)
fix various type annotation issues
Diffstat (limited to 'backend/authentication')
-rw-r--r--backend/authentication/backend.py4
-rw-r--r--backend/authentication/user.py2
2 files changed, 3 insertions, 3 deletions
diff --git a/backend/authentication/backend.py b/backend/authentication/backend.py
index 38668eb..e4699bd 100644
--- a/backend/authentication/backend.py
+++ b/backend/authentication/backend.py
@@ -14,7 +14,7 @@ class JWTAuthenticationBackend(authentication.AuthenticationBackend, ABC):
"""Custom Starlette authentication backend for JWT."""
@staticmethod
- def get_token_from_header(header: str) -> t.Optional[str]:
+ def get_token_from_header(header: str) -> str:
"""Parse JWT token from header value."""
try:
prefix, token = header.split()
@@ -32,7 +32,7 @@ class JWTAuthenticationBackend(authentication.AuthenticationBackend, ABC):
async def authenticate(
self, request: Request
- ) -> t.Optional[t.Tuple[authentication.AuthCredentials, authentication.BaseUser]]:
+ ) -> t.Optional[tuple[authentication.AuthCredentials, authentication.BaseUser]]:
"""Handles JWT authentication process."""
if "Authorization" not in request.headers:
return
diff --git a/backend/authentication/user.py b/backend/authentication/user.py
index afa243f..3bed0a1 100644
--- a/backend/authentication/user.py
+++ b/backend/authentication/user.py
@@ -7,7 +7,7 @@ from starlette.authentication import BaseUser
class User(BaseUser, ABC):
"""Starlette BaseUser implementation for JWT authentication."""
- def __init__(self, token: str, payload: t.Dict) -> None:
+ def __init__(self, token: str, payload: dict[str, t.Any]) -> None:
self.token = token
self.payload = payload