Cross.Headers 1.0.0

dotnet add package Cross.Headers --version 1.0.0
                    
NuGet\Install-Package Cross.Headers -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Cross.Headers" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Cross.Headers" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Cross.Headers" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Cross.Headers --version 1.0.0
                    
#r "nuget: Cross.Headers, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Cross.Headers@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Cross.Headers&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Cross.Headers&version=1.0.0
                    
Install as a Cake Tool

Cross.Headers

Install NuGet package

Install the package into your ASP.NET Core project:

dotnet add package Cross.Headers

Services registration

Рекомендуемый способ регистрации — использовать расширение AddHeaders:

builder.Services.AddHeaders(builder.Configuration);

Метод AddHeaders регистрирует IHeadersContextAccessor как scoped-сервис и подготавливает инфраструктуру для работы мидлварей.

Также убедитесь, что вы подключаете аутентификацию OpenIdConnect и настраиваете значения LanguageDefault, CurrencyDefault, CSPFrameAncestors в конфигурации.

Configure middleware

Добавьте мидлвари строго в таком порядке:

app.UseMiddleware<DefaultHeadersMiddleware>(); // заполняет дефолтные значения в IHeadersContextAccessor
app.UseMiddleware<HeadersMiddleware>();        // читает основные данные из заголовков и формирует контекст
app.UseMiddleware<UserHeadersMiddleware>();    // парсит пользовательские данные после установки access token

DefaultHeadersMiddleware отвечает за то, чтобы при отсутствии части заголовков IHeadersContextAccessor был заполнен корректными дефолтными значениями (SystemId, BusinessId, LanguageCode, CurrencyCode и т.п.).

HeadersMiddleware читает технические заголовки (correlation id, system/business id, язык, валюту, user-agent, access token и др.), формирует основной контекст и добавляет технические заголовки в ответ (например, correlation id и CSP).

UserHeadersMiddleware использует уже заполненный access token/claims и достаёт из HttpContext.User пользовательские данные (Id, UserName, флаг IsUser, scopes и т.д.), записывая их в IHeadersContextAccessor.

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Cross.Headers:

Package Downloads
Cross.Identity

Identity and authentication library for .NET: configurable flows (registration, login, forgot password, token, refresh), JWT, Argon2, email/SMS verification, process engine with JSON-defined flows.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 172 2/24/2026