Repository navigation
feat: centralize HTTP middleware ordering - #17
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2d98bac3a8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f39e5b76a8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1ff42f0577
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
UseHttp()включает CORS, authentication и authorization внутрь обработки исключений и логирования запроса. Ответы 401/403, CORS preflight и ошибки аутентификации получают итоговый HTTP completion-лог. Порядок: forwarded headers → request logging → exception handling → HTTPS redirection → routing → CORS → authentication → authorization → antiforgery.AddHttp()всегда регистрирует базовые сервисы черезAddAuthentication(),AddAuthorization()иAddCors().UseHttp()безусловно подключает middleware; проверки DI и временные scope для определения сервисов удалены. Приложение по-прежнему настраивает схемы и политики. Настройки сохраняются независимо от порядка регистрации. CORS использует настроенную default- или endpoint-политику и работает до авторизации, в том числе с DI безIServiceProviderIsService.HttpRequestLogScopeсоздаёт обычные словари: базовые поля фиксируются в начале запроса, endpoint — после routing, пользователь (subс fallback наNameIdentifier) — после authentication. Итоговая запись получает конечный контекст, включая endpoint из обработанного исключения. Значения scope сохраняются при отложенном экспорте. Клиентская отмена до начала ответа остаётся 499 / Warning; остальные 4xx — Warning, 5xx — Error. Обработчики исключений не дублируют completion-лог.Путь health endpoint настраивается через
HealthCheckOptions.Path, по умолчанию/health. Регистрация и маппинг вынесены вHealthChecksConfiguration. Пустой или относительный путь отклоняется при запуске; при переопределении маппится только выбранный адрес. Проверены default и custom path, ответы 200/503 и невалидные настройки.Собственные настройки находятся в
Options/ScalarиOptions/HealthCheck:ScalarOptionsиHealthCheckOptions, рядом — ихIValidateOptions<T>-валидаторы. Проверки выполняются черезValidateOnStart(). Секция Scalar остаётсяScalarConfiguration; секция health —HealthCheckOptions. ПустыеTitle/Faviconсохраняют прежнее поведение, пустые имена Bearer-схем отклоняются при запуске.MiddlewareConfigurationрегистрирует exception handlers, подключает request logging перед exception handling и содержит регистрацию endpoint/user scope.LoggingMiddlewareотвечает за обработку запроса и итоговый лог.UseHttp()явно подключает HTTPS redirection, routing и endpoint scope; user scope подключается после authentication вAuthenticationConfiguration. Порядок выполнения сохранён. Удалены все 23 явные проверкиArgumentNullException.ThrowIfNullи единственныйArgumentException.ThrowIfNullOrWhiteSpace; non-nullable параметры по-прежнему требуют ненулевые аргументы, отдельный контракт исключений дляnullбольше не поддерживается. Удалены только девять тестов этих проверок.AddHttp()напрямую вызываетAddAntiforgery(), аUseHttp()—UseAntiforgery()после authentication/authorization. JSON-запросы без antiforgery metadata продолжают работать без токена. Для[FromForm]иIFormFileтребуются токен и cookie: отсутствующий или неверный токен даёт 400 / Warning. Bearer сам по себе проверку не отключает; для endpoint, использующих только Bearer, доступен.DisableAntiforgery(). Выдачу токенов иAntiforgeryOptionsнастраивает приложение.Версия — 5.0. В приложении используется один
UseHttp().Проверено локально:
dotnet restore,dotnet format, Release-сборка без предупреждений и ошибок; анализаторы уровня Info в изменённых файлах.AddHttp(); OpenAPI без default authentication scheme.AddHttp(), совместимость JSON и ручного чтения form-urlencoded, OpenIddict Bearer, 401/403 до проверки токена и явный opt-out.