Soenneker.Validators.BasicAuth.Functions 11.0.289

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

Soenneker.Validators.BasicAuth.Functions

Validates Azure Functions isolated-worker Basic Authentication credentials against a fixed-cost username comparison and PBKDF2 PHC password hash.

Install

dotnet add package Soenneker.Validators.BasicAuth.Functions

Registration

using Soenneker.Validators.BasicAuth.Functions.Registrars;
using Microsoft.Extensions.DependencyInjection;

services.AddBasicAuthValidatorAsSingleton();

The validator is stateless, so singleton registration is appropriate for most function apps. AddBasicAuthValidatorAsScoped() is also available.

Configure the expected credential pair:

{
  "BasicAuth": {
    "Username": "integration-client",
    "PasswordPhc": "<PBKDF2 PHC hash>"
  }
}

Store the PHC hash in the function app's secret-backed configuration, not the plaintext password.

Validate an HTTP trigger

using System.Net;
using Microsoft.Azure.Functions.Worker;
using Microsoft.Azure.Functions.Worker.Http;
using Soenneker.Validators.BasicAuth.Functions.Abstract;

public sealed class StatusFunction(IBasicAuthValidator validator)
{
    [Function("Status")]
    public HttpResponseData Run(
        [HttpTrigger(AuthorizationLevel.Anonymous, "get")] HttpRequestData request)
    {
        if (!validator.ValidateSafe(request))
            return request.CreateResponse(HttpStatusCode.Unauthorized);

        return request.CreateResponse(HttpStatusCode.OK);
    }
}

ValidateSafe returns false when the request lacks parseable Basic credentials or the username/password does not match. Required-configuration failures and invalid PHC data still throw; “safe” applies to request authentication failures, not application misconfiguration.

Validate performs the same checks but throws UnauthorizedAccessException("Invalid credentials") for request credential failures. Both methods return true on success.

Per-call overrides

bool valid = validator.ValidateSafe(
    request,
    configuredUsername: expectedUsername,
    configuredPasswordPhc: expectedPasswordPhc);

Overrides take precedence independently. A null argument falls back to BasicAuth:Username or BasicAuth:PasswordPhc; it does not disable that check.

Security boundaries

The HTTP trigger is anonymous at the Functions host level in the example because this validator performs the credential check. Ensure every applicable path invokes it before protected work. Require TLS, rate-limit guessable endpoints, and never log the authorization header or plaintext password.

The parser's temporary credential buffer is cleared after every attempt. Usernames use fixed-cost UTF-8 comparison and passwords are verified against PBKDF2 PHC data. The validator does not create a ClaimsPrincipal, issue a Basic challenge response, rotate secrets, or replace a full authentication/authorization system.

Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
11.0.289 56 11/11/2026
11.0.288 47 11/11/2026
11.0.287 53 11/11/2026
11.0.286 53 11/11/2026
11.0.285 50 11/11/2026
11.0.284 51 11/11/2026
11.0.283 136 11/3/2026
11.0.282 113 10/27/2026
11.0.281 109 10/27/2026
11.0.280 95 10/27/2026
11.0.279 104 10/27/2026
11.0.278 100 10/26/2026
11.0.275 96 10/26/2026
11.0.274 97 10/26/2026
11.0.273 99 10/26/2026
11.0.272 97 10/26/2026
4.0.271 105 10/23/2026
4.0.270 115 10/15/2026
4.0.269 99 10/15/2026
4.0.268 99 10/14/2026
Loading failed

Updated Soenneker.Hashing.Pbkdf2 to 11.0.70