Introduce ClientAssertionFactory to allow refreshing of Client Assertions during retries#343
Merged
Erwinvandervalk merged 1 commit intomainfrom Mar 16, 2026
Conversation
This was referenced Mar 16, 2026
Contributor
There was a problem hiding this comment.
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.ClientAssertionFactoryand a well-knownProtocolRequestOptions.ClientAssertionFactoryoptions key. - Wire factory invocation + propagation into token and PAR request sending paths.
- Add a new
ClientAssertionssample 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.
identity-model/samples/ClientAssertions/ClientAssertions.csproj
Outdated
Show resolved
Hide resolved
identity-model/src/IdentityModel/Client/Messages/ProtocolRequest.cs
Outdated
Show resolved
Hide resolved
identity-model/src/IdentityModel/Client/HttpClientTokenRequestExtensions.cs
Outdated
Show resolved
Hide resolved
identity-model/src/IdentityModel/Client/HttpClientTokenRequestExtensions.cs
Show resolved
Hide resolved
identity-model/src/IdentityModel/Client/HttpClientPushedAuthorizationExtensions.cs
Outdated
Show resolved
Hide resolved
identity-model/src/IdentityModel/Client/HttpClientPushedAuthorizationExtensions.cs
Show resolved
Hide resolved
This was referenced Mar 16, 2026
Closed
pgermishuys
approved these changes
Mar 16, 2026
client assertions which allows for scenarios like DPoP where a new assertion needs to be generated for each token request attempt.
68933eb to
eae9f10
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ClientAssertionFactorytoProtocolRequestfor on-demand client assertion generation, preventing stale assertions on DPoP nonce retryClientAssertionssample project and update public API verification