File tree Expand file tree Collapse file tree 1 file changed +11
-11
lines changed
hvalfangst_function/upload_csv Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change 44import jwt
55
66
7- def main (req : func .HttpRequest , outbound : func .Out [str ]) -> func .HttpResponse :
7+ def validate_jwt (token : str , audience : str ) -> bool :
8+ try :
9+ decoded = jwt .decode (token , audience = audience , options = {"verify_signature" : False })
10+ # Optionally check claims like roles or scopes
11+ return True
12+ except Exception as e :
13+ logging .error (f"JWT validation failed: { e } " )
14+ return False
15+
16+
17+ def main (req : func .HttpRequest , outbound : func .Out [str ]):
818 try :
919 logging .info ("Received HTTP request to upload CSV" )
1020
@@ -32,13 +42,3 @@ def main(req: func.HttpRequest, outbound: func.Out[str]) -> func.HttpResponse:
3242 except Exception as e :
3343 logging .error ("An error occurred: %s" , str (e ))
3444 return func .HttpResponse (f"Error: { str (e )} " , status_code = 500 )
35-
36-
37- def validate_jwt (token : str , audience : str ) -> bool :
38- try :
39- decoded = jwt .decode (token , audience = audience , options = {"verify_signature" : False })
40- # Optionally check claims like roles or scopes
41- return True
42- except Exception as e :
43- logging .error (f"JWT validation failed: { e } " )
44- return False
You can’t perform that action at this time.
0 commit comments