Skip to content

Commit 7d65f51

Browse files
committed
Change bindings model to v1
1 parent 695f9de commit 7d65f51

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

hvalfangst_function/upload_csv/__init__.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,17 @@
44
import 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

0 commit comments

Comments
 (0)