Soenneker.Extensions.HttpRequestDatas 4.0.144

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Soenneker.Extensions.HttpRequestDatas --version 4.0.144
                    
NuGet\Install-Package Soenneker.Extensions.HttpRequestDatas -Version 4.0.144
                    
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.144" />
                    
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.144" />
                    
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.144
                    
#r "nuget: Soenneker.Extensions.HttpRequestDatas, 4.0.144"
                    
#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.144
                    
#: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.144
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Extensions.HttpRequestDatas&version=4.0.144
                    
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 115 9/30/2026
4.0.151 124 9/25/2026
4.0.150 88 9/25/2026
4.0.149 87 9/24/2026
4.0.148 154 9/16/2026
4.0.147 106 9/16/2026
4.0.146 97 9/15/2026
4.0.145 127 9/13/2026
4.0.144 112 9/13/2026
4.0.143 109 9/13/2026
4.0.142 97 9/13/2026
4.0.141 131 9/12/2026
4.0.140 167 9/12/2026
4.0.139 138 9/9/2026
4.0.138 129 9/8/2026
4.0.137 130 9/8/2026
4.0.136 126 9/7/2026
4.0.135 130 9/7/2026
4.0.134 98 9/7/2026
4.0.133 153 9/5/2026
Loading failed

Updated Soenneker.Extensions.String to 4.0.753