Skip to content

Commit

Permalink
Incorporated OIDC for authenticating towards Azure in GH Action
Browse files Browse the repository at this point in the history
  • Loading branch information
hvalfangst committed Dec 26, 2024
1 parent 1ac8bdb commit 2fe51da
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"build": "GENERATE_SOURCEMAP=false react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
Expand Down
4 changes: 3 additions & 1 deletion hvalfangst_function/function_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,12 @@ def validate_jwt(token: str, audience: str) -> bool:


@app.route(route="upload_csv", auth_level=func.AuthLevel.ANONYMOUS)
@app.blob_output(arg_name="outbound", path="hvalfangstcontainer/in/input.csv", connection="AzureWebJobsStorage")
@app.blob_output(arg_name="outbound", path="hvalfangstcontainer/in/input.csv", connection="")
def upload_csv(req: func.HttpRequest, outbound: func.Out[str]) -> str:
try:
logging.info("Received HTTP request to upload CSV")

# Validate JWT token
token = req.headers.get("Authorization").split(" ")[1] # Extract Bearer token
if not validate_jwt(token, audience=os.environ.get("FUNCTION_APP_CLIENT_ID")):
return func.HttpResponse("Unauthorized", status_code=401)
Expand Down

0 comments on commit 2fe51da

Please sign in to comment.