5D auth / Swagger 程式 repo 結構檢查與實作前盤點

返回文件索引

1. 現有結構

類型現況
WebApi projectHS.DeviceControl.WebApi.csproj,目前未引用 Swagger / OpenAPI package。
Startup註冊 controllers、mock / in-memory Application services;尚未有 auth / Swagger pipeline。
ControllersTasksControllerDevicesControllerSchemaControllerHealthController
TestsWebApiControllerTests.cs,目前 7 tests passed。

2. 候選檔案

類型候選檔案風險
Auth optionssrc/HS.DeviceControl.WebApi/Security/WebApiAuthOptions.cs不得保存正式 secret。
Auth handlersrc/HS.DeviceControl.WebApi/Security/ApiKeyAuthenticationHandler.cs錯誤訊息不得回顯 credential。
Startupsrc/HS.DeviceControl.WebApi/Startup.cspipeline 順序需測試。
Swagger packageHS.DeviceControl.WebApi.csproj新增套件前需確認版本與範圍;production disabled。
Teststests/HS.DeviceControl.WebApi.Tests需覆蓋 401、403、success、dev-only / production disabled。

3. 必跑測試

dotnet test tests\HS.DeviceControl.WebApi.Tests\HS.DeviceControl.WebApi.Tests.csproj --no-restore、Application tests、solution tests、停止線掃描與 commit 前檢查。