From dc1412bd61932f3b5b61b7b2639aaf2577643d33 Mon Sep 17 00:00:00 2001 From: Alexander_Kabui Date: Thu, 26 Jun 2025 15:58:01 +0300 Subject: feat: Add check for anonymous metadata. --- gn3/api/llm.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'gn3/api/llm.py') diff --git a/gn3/api/llm.py b/gn3/api/llm.py index a127eb7..e654188 100644 --- a/gn3/api/llm.py +++ b/gn3/api/llm.py @@ -66,11 +66,12 @@ def clean_query(query:str) -> str: def is_verified_anonymous_user(request): """This function should verify autheniticity of metadate from gn2 """ - anony_id = request.headers.get("anonymous_id") #should verify this + metadata signature - user_status = request.headers.get("anonymous_status", "") - _user_signed_metadata = request.headers.get("anony_metadata", "") # verify this for integrity + anony_id = request.headers.get("Anonymous-Id") #should verify this + metadata signature + user_status = request.headers.get("Anonymous-Status", "") + _user_signed_metadata = request.headers.get("Anony-Metadata", "") # verify this for integrity return bool(anony_id) and user_status.lower() == "verified" + def with_gnqna_fallback(view_func): """Allow fallback to GNQNA user if token auth fails.""" @wraps(view_func) -- cgit 1.4.1