From 5b4ed0c6ffd5dd7dafa04b1c0c1af22dfa294dbd Mon Sep 17 00:00:00 2001 From: Jeroen Vijgen Date: Wed, 22 Jan 2025 18:19:56 +0200 Subject: [PATCH] Revert previous commit and set actual SUB value --- api/asset_manager/src/modules/auth/router.py | 2 +- api/asset_manager/src/modules/auth/utils.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/asset_manager/src/modules/auth/router.py b/api/asset_manager/src/modules/auth/router.py index ae0ca9c9..a90fab68 100644 --- a/api/asset_manager/src/modules/auth/router.py +++ b/api/asset_manager/src/modules/auth/router.py @@ -36,7 +36,7 @@ async def login(form: Annotated[OAuth2PasswordRequestForm, Depends()]): return JSONResponse( await Token.create( - user=f"id:{user.id}", + user=user.id, access_token=create_token( user_id=user.id, offset=timedelta(settings.ACCESS_TOKEN_EXPIRE_MIN) ), diff --git a/api/asset_manager/src/modules/auth/utils.py b/api/asset_manager/src/modules/auth/utils.py index cb9b59c3..cffe04fa 100644 --- a/api/asset_manager/src/modules/auth/utils.py +++ b/api/asset_manager/src/modules/auth/utils.py @@ -23,7 +23,7 @@ def create_token(user_id: uuid, offset: float) -> str: {"alg": settings.HASHING_SCHEME, "typ": "JWT"}, { "iss": "", - "sub": user_id, + "sub": f"id:{user_id}", "nbf": curr_time, "iat": curr_time, "exp": int(curr_time + offset),