Soenneker.Validators.BasicAuth.Functions
4.0.211
Prefix Reserved
See the version list below for details.
dotnet add package Soenneker.Validators.BasicAuth.Functions --version 4.0.211
NuGet\Install-Package Soenneker.Validators.BasicAuth.Functions -Version 4.0.211
<PackageReference Include="Soenneker.Validators.BasicAuth.Functions" Version="4.0.211" />
<PackageVersion Include="Soenneker.Validators.BasicAuth.Functions" Version="4.0.211" />
<PackageReference Include="Soenneker.Validators.BasicAuth.Functions" />
paket add Soenneker.Validators.BasicAuth.Functions --version 4.0.211
#r "nuget: Soenneker.Validators.BasicAuth.Functions, 4.0.211"
#:package Soenneker.Validators.BasicAuth.Functions@4.0.211
#addin nuget:?package=Soenneker.Validators.BasicAuth.Functions&version=4.0.211
#tool nuget:?package=Soenneker.Validators.BasicAuth.Functions&version=4.0.211
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 | Versions 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. |
-
net10.0
- Soenneker.Extensions.Configuration (>= 4.0.867)
- Soenneker.Hashing.Pbkdf2 (>= 4.0.31)
- Soenneker.Security.Parsers.BasicAuth.Functions (>= 4.0.30)
- Soenneker.Security.Util (>= 4.0.40)
- Soenneker.Validators.Validator (>= 4.0.736)
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 |
|---|---|---|
| 4.0.213 | 0 | 8/31/2026 |
| 4.0.212 | 0 | 8/31/2026 |
| 4.0.211 | 31 | 8/31/2026 |
| 4.0.210 | 35 | 8/30/2026 |
| 4.0.209 | 33 | 8/30/2026 |
| 4.0.208 | 32 | 8/30/2026 |
| 4.0.207 | 33 | 8/30/2026 |
| 4.0.206 | 33 | 8/30/2026 |
| 4.0.205 | 43 | 8/30/2026 |
| 4.0.204 | 42 | 8/29/2026 |
| 4.0.203 | 48 | 8/29/2026 |
| 4.0.201 | 36 | 8/29/2026 |
| 4.0.200 | 43 | 8/26/2026 |
| 4.0.199 | 40 | 8/26/2026 |
| 4.0.198 | 52 | 8/25/2026 |
| 4.0.197 | 94 | 8/22/2026 |
| 4.0.196 | 105 | 8/18/2026 |
| 4.0.195 | 96 | 8/12/2026 |
| 4.0.194 | 87 | 8/12/2026 |
| 4.0.193 | 85 | 8/12/2026 |
Update dependency Soenneker.Hashing.Pbkdf2 to 4.0.31 (#493)