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 4
4
import jwt
5
5
6
6
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 ]):
8
18
try :
9
19
logging .info ("Received HTTP request to upload CSV" )
10
20
@@ -32,13 +42,3 @@ def main(req: func.HttpRequest, outbound: func.Out[str]) -> func.HttpResponse:
32
42
except Exception as e :
33
43
logging .error ("An error occurred: %s" , str (e ))
34
44
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