Skip to content

Comments

Enable mTLS PoP with client assertion flow#5659

Closed
Copilot wants to merge 3 commits intomainfrom
copilot/enable-bearer-mtls-assertion-flow
Closed

Enable mTLS PoP with client assertion flow#5659
Copilot wants to merge 3 commits intomainfrom
copilot/enable-bearer-mtls-assertion-flow

Conversation

Copy link
Contributor

Copilot AI commented Jan 15, 2026

Changes proposed in this request

Enables mTLS Proof-of-Possession when using client assertions by selecting the correct assertion type (jwt-pop vs jwt-bearer) based on certificate presence.

Prior to this change, ClientAssertionDelegateCredential ignored the TokenBindingCertificate property when constructing token requests, always using bearer assertions. The certificate setup in InitMtlsPopParametersAsync was never utilized.

Core change:

  • ClientAssertionDelegateCredential.AddConfidentialClientParametersAsync(): Check if mTLS PoP requested and certificate provided, use jwt-pop assertion type accordingly

Usage:

var app = ConfidentialClientApplicationBuilder
    .Create(clientId)
    .WithClientAssertion((opts, ct) => Task.FromResult(new ClientSignedAssertion
    {
        Assertion = "eyJ...",  // Your JWT
        TokenBindingCertificate = cert  // Optional: enables mTLS PoP
    }))
    .WithAzureRegion(region)
    .Build();

// Token request with mTLS binding
var result = await app.AcquireTokenForClient(scopes)
    .WithMtlsProofOfPossession()
    .ExecuteAsync();

// result.BindingCertificate contains the cert used

Testing

Added unit tests:

  • ClientAssertion_WithMtlsPop_SuccessAsync: Validates certificate binding, token type, and cache behavior
  • ClientAssertion_WithMtlsPop_BearerFlow_SuccessAsync: Validates bearer flow when certificate omitted
  • ClientAssertion_WithMtlsPop_SendsJwtPopAssertionTypeAsync: Validates jwt-pop assertion type sent to token endpoint

Performance impact

None. Changes are in assertion type selection logic only.

Documentation

  • All relevant documentation is updated.

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 16, 2026 00:05
Co-authored-by: gladjohn <90415114+gladjohn@users.noreply.github.com>
Co-authored-by: gladjohn <90415114+gladjohn@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement proof of possession using mTLS for client assertion Enable mTLS PoP with client assertion flow Jan 16, 2026
Copilot AI requested a review from gladjohn January 16, 2026 00:12
@gladjohn gladjohn closed this Jan 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants