Skip to content

Introduce ClientAssertionFactory to allow refreshing of Client Assertions during retries#343

Merged
Erwinvandervalk merged 1 commit intomainfrom
fix/dpop-client-assertion-identity-model
Mar 16, 2026
Merged

Introduce ClientAssertionFactory to allow refreshing of Client Assertions during retries#343
Erwinvandervalk merged 1 commit intomainfrom
fix/dpop-client-assertion-identity-model

Conversation

@Erwinvandervalk
Copy link
Copy Markdown
Contributor

@Erwinvandervalk Erwinvandervalk commented Mar 16, 2026

Summary

  • Add ClientAssertionFactory to ProtocolRequest for on-demand client assertion generation, preventing stale assertions on DPoP nonce retry
  • Wire up assertion creators in token request and PAR extension methods
  • Add ClientAssertions sample project and update public API verification

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an on-demand client assertion generation mechanism to IdentityModel requests to avoid replay/staleness problems (notably during DPoP nonce retries), and provides a runnable sample demonstrating the pattern.

Changes:

  • Introduce ProtocolRequest.ClientAssertionFactory and a well-known ProtocolRequestOptions.ClientAssertionFactory options key.
  • Wire factory invocation + propagation into token and PAR request sending paths.
  • Add a new ClientAssertions sample project and update public API verification output.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
identity-model/src/IdentityModel/Client/Messages/ProtocolRequest.cs Adds ClientAssertionFactory to requests and exposes an options key for handler chains.
identity-model/src/IdentityModel/Client/HttpClientTokenRequestExtensions.cs Invokes the factory and stores it on HttpRequestMessage.Options for token requests.
identity-model/src/IdentityModel/Client/HttpClientPushedAuthorizationExtensions.cs Invokes the factory and stores it on HttpRequestMessage.Options for PAR requests.
identity-model/test/IdentityModel.Tests/Verifications/PublicApiVerificationTests.VerifyPublicApi.verified.txt Updates verified public API surface for new members/types.
identity-model/samples/ClientAssertions/Program.cs Adds sample usage showing ClientAssertionFactory in a client credentials flow.
identity-model/samples/ClientAssertions/ClientAssertions.csproj New sample project definition.
identity-model/samples/ClientAssertions/ClientAssertionService.cs Sample helper that creates private_key_jwt client assertions.
identity-model/identity-model.slnf Adds the new sample and additional projects to the solution filter.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

client assertions which allows for scenarios
like DPoP where a new assertion needs to be
generated for each token request attempt.
@Erwinvandervalk Erwinvandervalk force-pushed the fix/dpop-client-assertion-identity-model branch from 68933eb to eae9f10 Compare March 16, 2026 13:19
@Erwinvandervalk Erwinvandervalk changed the title Fix stale ClientAssertion on DPoP nonce retry - IdentityModel Introduce ClientAssertionFactory to allow refreshing of Client Assertions during retries Mar 16, 2026
@Erwinvandervalk Erwinvandervalk added the area/foss/im Issues related to Identity Model label Mar 16, 2026
@Erwinvandervalk Erwinvandervalk merged commit a79814a into main Mar 16, 2026
4 checks passed
@Erwinvandervalk Erwinvandervalk deleted the fix/dpop-client-assertion-identity-model branch March 16, 2026 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/foss/im Issues related to Identity Model

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants