Merge pull request 'You can access /health without a api key now.' (#3) from features/health-no-auth into master
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #3
This commit is contained in:
commit
43cd57a158
@ -14,7 +14,11 @@ steps:
|
||||
- latest
|
||||
trigger:
|
||||
branch:
|
||||
include:
|
||||
- master
|
||||
event:
|
||||
exclude:
|
||||
- pull_request
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
|
@ -13,6 +13,13 @@ public class ApiKeyAuthAuthentication
|
||||
|
||||
public async Task InvokeAsync(HttpContext context)
|
||||
{
|
||||
// allow access to /health without auth
|
||||
if (context.Request.Path == "/health")
|
||||
{
|
||||
await _next(context);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!context.Request.Headers.TryGetValue(HeaderApiKey, out var extractedApiKey))
|
||||
{
|
||||
context.Response.StatusCode = 401;
|
||||
|
Loading…
Reference in New Issue
Block a user