Introduced `ApiKeyAuthOptions` for API key configuration, including a `Key` property and `SectionName` for binding. Updated `ApiKeyAuthMiddleware` to validate the `X-Api-Key` header against the configured API key. Added conditional middleware application in `Program.cs` based on the presence of a configured API key. Bound the `ApiKey` section in `appsettings.json` and `appsettings.Development.json` to store the API key, with a default value of `null`. This improves security and centralizes API key management.
DigitalData.TaskFlow.API
Dieses Projekt stellt die HTTP-Schnittstelle fuer externe Konsumenten bereit.
Zweck
Die API-Schicht nimmt HTTP-Requests entgegen, leitet diese an die Application-Schicht weiter und liefert standardisierte Responses zurueck.
Aktueller Inhalt
Program.cs- Startpunkt der ASP.NET-Core-Anwendung.
- Registriert Application- und Infrastructure-Dienste.
- Enthält Grundkonfiguration fuer Controller und OpenAPI/Swagger.
appsettings.json- Allgemeine Runtime-Konfiguration (Logging, ConnectionString, MediatR-Lizenz, Swagger-Optionen).
Controllers/- Zielordner fuer HTTP-Controller (aktuell noch leer).
Options/- API-spezifische Konfigurationsmodelle (z. B.
SwaggerOptions).
- API-spezifische Konfigurationsmodelle (z. B.
Geplante Inhalte (naechste Phasen)
- Controller fuer:
GET /workflows/{wisagid}POST /workflows/{wisagid}/{source}/{processid}/closingGET /documents/{id}
- Middleware fuer:
- FluentValidation-Fehlerbehandlung
- Generelle Exception-Behandlung
- OpenAPI-Dokumentation:
- Swagger in Development, optional in Production
- Firmen-/Produkt-Metadaten
- Scalar als alternative UI
Architektur-Regeln
- Keine direkte SQL- oder EF-Core-Logik im Controller.
- Transport-spezifische Aufgaben bleiben in API; fachliche Verarbeitung erfolgt in Application.
- Einheitliches Response-Schema gemaess Ticket-Vorgabe (
meta.code,meta.message).
Rolle im Gesamtsystem
Die API ist das Eingangstor fuer externe Systeme (z. B. fabrik19) und sorgt fuer stabile, versionierbare und gut dokumentierte Endpunkte.