Sascha Manns

My personal Blog about Linux, Windows Programming and other random stuff.

.NET

Minimal API-Key Lösung

Problem Ich suchte nach eine Lösung, um mit minimalem Aufwand eine minimale Lösung für API-Key-Überpüfungen. Lösung public class ApiKeyMiddleware { private readonly RequestDelegate _next; private const string APIKEYNAME = "ApiKey"; public ApiKeyMiddleware(RequestDelegate next) { _next = next; } public async Task InvokeAsync( …
.NET ASP .NET Core Lesson learned

Minimal API-Key Solution

Problem I was looking for a solution to provide a minimal solution for API key checks with minimal effort. Solution ApiKeyMiddleware.cs: public class ApiKeyMiddleware { private readonly RequestDelegate _next; private const string APIKEYNAME = "ApiKey"; public ApiKeyMiddleware(RequestDelegate next) { _next = next; } public async Task InvokeAsync(HttpContext …
.NET ASP .NET Core Lesson learned
  • 1