diff --git a/src/Storm.AzureFrontDoorFilter/AzureFrontDoorFilterMiddleware.cs b/src/Storm.AzureFrontDoorFilter/AzureFrontDoorFilterMiddleware.cs index f1ce517..28ea618 100644 --- a/src/Storm.AzureFrontDoorFilter/AzureFrontDoorFilterMiddleware.cs +++ b/src/Storm.AzureFrontDoorFilter/AzureFrontDoorFilterMiddleware.cs @@ -60,8 +60,13 @@ public async Task InvokeAsync(HttpContext context) } } - private static string GetHeaderValueOrDefault(IHeaderDictionary headers, string headerName, string defaultValue = default) + private static string? GetHeaderValueOrDefault(IHeaderDictionary headers, string headerName, string? defaultValue = default) { + if (headerName is null) + { + throw new ArgumentNullException(nameof(headerName)); + } + if (headers.TryGetValue(headerName, out var headerValue)) { return headerValue; @@ -77,8 +82,8 @@ private bool IsAzureFrontDoorRequest(HttpRequest request) return true; } - var afdId = GetHeaderValueOrDefault(request.Headers, AfdIdHeaderName); - return approvedAfdIds.Contains(afdId); + var afdId = GetHeaderValueOrDefault(request.Headers, AfdIdHeaderName, AllowAllValue); + return approvedAfdIds.Contains(afdId ?? AllowAllValue); } } } diff --git a/src/Storm.AzureFrontDoorFilter/Storm.AzureFrontDoorFilter.csproj b/src/Storm.AzureFrontDoorFilter/Storm.AzureFrontDoorFilter.csproj index ad4094b..2439645 100644 --- a/src/Storm.AzureFrontDoorFilter/Storm.AzureFrontDoorFilter.csproj +++ b/src/Storm.AzureFrontDoorFilter/Storm.AzureFrontDoorFilter.csproj @@ -3,6 +3,13 @@ netstandard2.0 8 + false + Phil Oyston, StormID + Storm ID + Provides middleware to filter access to your web application based on the request originating through a specified set of Azure Front Door resources. + azure front-door dotnet + LICENSE + https://github.com/stormid/storm-azurefrontdoorfilter @@ -12,4 +19,11 @@ + + + True + + + +