Soenneker.Extensions.HttpRequestDatas 4.0.152

Prefix Reserved
dotnet add package Soenneker.Extensions.HttpRequestDatas --version 4.0.152
                    
NuGet\Install-Package Soenneker.Extensions.HttpRequestDatas -Version 4.0.152
                    
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="Soenneker.Extensions.HttpRequestDatas" Version="4.0.152" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Extensions.HttpRequestDatas" Version="4.0.152" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Extensions.HttpRequestDatas" />
                    
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 Soenneker.Extensions.HttpRequestDatas --version 4.0.152
                    
#r "nuget: Soenneker.Extensions.HttpRequestDatas, 4.0.152"
                    
#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 Soenneker.Extensions.HttpRequestDatas@4.0.152
                    
#: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=Soenneker.Extensions.HttpRequestDatas&version=4.0.152
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Extensions.HttpRequestDatas&version=4.0.152
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

alternate text is missing from this package README image Soenneker.Extensions.HttpRequestDatas

Bearer-token parsing and unauthorized-response helpers for .NET isolated Azure Functions.

Installation

dotnet add package Soenneker.Extensions.HttpRequestDatas

Read a bearer token

using Soenneker.Extensions.HttpRequestDatas;

if (!request.TryGetBearer(out ReadOnlySpan<char> token, out string? authorizationHeader))
{
    await request.WriteUnauthorized("A bearer token is required");
    return;
}

bool valid = token.SequenceEqual(expectedToken);

TryGetBearer() reads the first nonblank Authorization header and accepts the Bearer scheme case-insensitively. Leading and trailing whitespace around the header and token are ignored. Empty tokens, tokens containing whitespace, other schemes, and headers larger than 8 KiB return false.

The returned token is a span over authorizationHeader; it does not allocate a second string. Keep the backing string in scope while using the span. If the token must survive an await or be stored, copy it first:

if (request.TryGetBearer(out ReadOnlySpan<char> token, out string? authorizationHeader))
{
    string tokenText = token.ToString();
    await ValidateToken(tokenText, cancellationToken);
}

The method extracts the credential but does not validate its signature, issuer, audience, expiry, or permissions.

Write an unauthorized result

await request.WriteUnauthorized("Invalid credentials");
return;

WriteUnauthorized() creates a 401 Unauthorized response, writes the supplied message as the body, and assigns the response to the current invocation result. A null message produces an empty body. It does not stop the function, so return immediately unless further processing is intentional.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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 Soenneker.Extensions.HttpRequestDatas:

Package Downloads
Soenneker.Entra.Middlewares.JwtAuth.Functions

Middleware for Azure Functions that validates Microsoft Entra JWTs

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.152 86 9/30/2026
4.0.151 123 9/25/2026
4.0.150 87 9/25/2026
4.0.149 86 9/24/2026
4.0.148 153 9/16/2026
4.0.147 104 9/16/2026
4.0.146 95 9/15/2026
4.0.145 126 9/13/2026
4.0.144 111 9/13/2026
4.0.143 108 9/13/2026
4.0.142 96 9/13/2026
4.0.141 130 9/12/2026
4.0.140 166 9/12/2026
4.0.139 137 9/9/2026
4.0.138 128 9/8/2026
4.0.137 129 9/8/2026
4.0.136 125 9/7/2026
4.0.135 129 9/7/2026
4.0.134 96 9/7/2026
4.0.133 152 9/5/2026
Loading failed

Updated Soenneker.Extensions.String to 4.0.770