This commit is contained in:
parent
afe96fc909
commit
85a40eba83
|
@ -10,7 +10,7 @@ async def check_auth(req) -> str | None:
|
|||
user_id = ""
|
||||
if token:
|
||||
# Logging the authentication token
|
||||
print(f"[services.auth] checking auth token: {token}")
|
||||
# print(f"[services.auth] checking auth token: {token}")
|
||||
query_name = "validate_jwt_token"
|
||||
operation = "ValidateToken"
|
||||
headers = {
|
||||
|
@ -40,6 +40,7 @@ async def check_auth(req) -> str | None:
|
|||
print(f"[services.auth] errors: {errors}")
|
||||
else:
|
||||
user_id = data.get("data", {}).get(query_name, {}).get("claims", {}).get("sub")
|
||||
print(f"[services.auth] got user_id: {user_id}")
|
||||
return user_id
|
||||
except Exception as e:
|
||||
# Handling and logging exceptions during authentication check
|
||||
|
@ -54,9 +55,7 @@ def login_required(f):
|
|||
async def decorated_function(*args, **kwargs):
|
||||
info = args[1]
|
||||
context = info.context
|
||||
print("[login_required] context: " + str(context))
|
||||
req = context.get("request")
|
||||
print("[login_required] request: " + str(req))
|
||||
user_id = await check_auth(req)
|
||||
if user_id:
|
||||
context["user_id"] = user_id
|
||||
|
|
Loading…
Reference in New Issue
Block a user