You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add custom key-based authentication to HTTP triggers (#12)
Related to #10
Add custom key-based authentication to HTTP triggers.
* **README.md**: Add instructions for setting up custom key-based authentication.
* **BaseHttpTrigger.cs**: Add `ValidateCustomKey` method to perform custom key-based authentication. Update `Authorize` method to accept a custom key and validate it using `ValidateCustomKey`.
* **UserDetailsTrigger.cs**: Update `Run` method to use `AuthorizationLevel.Function` and pass a custom key to the `Authorize` method.
* **HealthCheckTrigger.cs**: Update `Run` method to use `AuthorizationLevel.Function` and pass a custom key to the `Authorize` method. Add custom key validation in the `Run` method.
---
For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/palkalaiselvand/Azure_HTTPTriggerFunctionSample/issues/10?shareId=XXXX-XXXX-XXXX-XXXX).
2. Update your HTTP trigger functions to use the custom key for authentication. For example, in `UserDetailsTrigger.cs`, pass the custom key to the `Authorize` method:
122
+
123
+
```csharp
124
+
[FunctionName(nameof(UserDetailsTrigger))]
125
+
public async Task<IActionResult> Run([HttpTrigger(AuthorizationLevel.Function, "post", Route = "v1/userdetails")] HttpRequest req,
0 commit comments