MinApiLib.Oidc.DPoP 1.0.0

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

MinApiLib.Oidc.DPoP

The building blocks of DPoP (RFC 9449, OAuth 2.0 Demonstrating Proof of Possession), shared by the clients (MinApiLib.Oidc.Http, MinApiLib.Oidc.Authentication), the APIs (MinApiLib.Oidc.JwtBearer) and the server (MinApiLib.Oidc.Server). It only depends on Microsoft.IdentityModel.JsonWebTokens, and targets net10.0 and net11.0.

Most applications use it through those packages. Use it directly for requests you build yourself.

Keys

using var key = DPoPKey.CreateECDsa();          // ES256; or DPoPKey.CreateRsa() for PS256
var jwk = key.ToJwk();                          // the private key as a JWK, to store it protected
using var again = DPoPKey.FromJwk(jwk);

key.Thumbprint is the RFC 7638 thumbprint that bound tokens carry in cnf.jkt and that dpop_jkt sends. DPoPKey.ComputeThumbprint computes it for any public JWK.

Proofs

var proof = DPoPProof.Create(key, HttpMethod.Get, new Uri("https://orders.example.com/orders"), accessToken, nonce);
request.Headers.Add(DPoPConstants.HeaderName, proof);

Each proof has a new jti, the method (htm), the URL without query or fragment (htu), the time (iat), and, when given, the access token hash (ath) and the server's nonce. DPoPProof.HashAccessToken computes ath.

Nonces

DPoPNonceStore keeps the last DPoP-Nonce each server sent, by origin, to put in the next proofs.

Validating proofs

Servers check proofs with DPoPProofValidator: the form of the proof, its signature by the key in its header, the method and URL, its age, the access token hash, and that its jti was not seen before. The token endpoint of MinApiLib.Oidc.Server and the APIs of MinApiLib.Oidc.JwtBearer use it, with the same rules and error messages.

var validator = new DPoPProofValidator(new DPoPProofValidationOptions(), new InMemoryDPoPReplayCache(TimeProvider.System), TimeProvider.System);
var result = await validator.ValidateAsync(proof, "GET", requestUrl, accessToken);
// result.IsValid, result.Error, result.Thumbprint (compare it with cnf.jkt), result.Nonce

IDPoPReplayCache remembers the accepted proofs. InMemoryDPoPReplayCache serves a single instance; APIs on several instances need a shared one, such as DistributedDPoPReplayCache in MinApiLib.Oidc.JwtBearer, which does all of this for ASP.NET Core APIs.

Names

DPoPConstants has the headers, the token type, the typ of proofs, the dpop_jkt parameter, the discovery metadata, the errors (invalid_dpop_proof, use_dpop_nonce) and the claims of the RFC.

License

Apache License 2.0, like MinApiLib.Oidc.Server. The repository's NOTICE holds the attribution.

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.  net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on MinApiLib.Oidc.DPoP:

Package Downloads
MinApiLib.Oidc.Http

Access tokens for HttpClient without ASP.NET Core: client credentials tokens sent as bearer tokens or DPoP-bound (RFC 9449), with caching, renewal and DPoP nonces, plus the token endpoint client and the handler base that MinApiLib.Oidc.Authentication builds on. Works with any OAuth 2.0 server.

MinApiLib.Oidc.Server

OpenID Connect and OAuth 2.0 server for ASP.NET Core built on MinApiLib endpoints and attribute-based dependency injection. Includes code derived from IdentityServer4 4.1.2 (Apache-2.0); it does not depend on any IdentityServer package.

MinApiLib.Oidc.JwtBearer

DPoP (RFC 9449) for ASP.NET Core JWT bearer authentication: accepts Authorization: DPoP, validates the proof of DPoP-bound access tokens against cnf.jkt, rejects them as bearer tokens, issues DPoP nonces and answers with DPoP challenges. Works with any OAuth 2.0 server.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 53 11/17/2026