-
Notifications
You must be signed in to change notification settings - Fork 241
Add token binding scenario #3586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add token binding scenario #3586
Conversation
src/Microsoft.Identity.Web.TokenAcquisition/PublicAPI/net462/PublicAPI.Shipped.txt
Show resolved
Hide resolved
src/Microsoft.Identity.Web.TokenAcquisition/ConfidentialClientApplicationBuilderExtension.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Identity.Web.TokenAcquisition/ConfidentialClientApplicationBuilderExtension.cs
Show resolved
Hide resolved
src/Microsoft.Identity.Web.TokenAcquisition/DefaultAuthorizationHeaderBoundProvider.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Identity.Web.TokenAcquisition/DefaultAuthorizationHeaderBoundProvider.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Identity.Web.TokenAcquisition/DefaultAuthorizationHeaderBoundProvider.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Identity.Web.TokenAcquisition/DefaultAuthorizationHeaderBoundProvider.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Identity.Web.TokenAcquisition/ServiceCollectionExtensions.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Identity.Web.TokenAcquisition/ServiceCollectionExtensions.cs
Outdated
Show resolved
Hide resolved
tests/Microsoft.Identity.Web.Test.Common/Mocks/MockMtlsHttpClientFactory.cs
Show resolved
Hide resolved
bgavrilMS
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments. DevEx needs more clarity.
src/Microsoft.Identity.Web.TokenAcquisition/DefaultAuthorizationHeaderBoundProvider.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Identity.Web.TokenAcquisition/DefaultAuthorizationHeaderProvider.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Identity.Web.TokenAcquisition/DefaultAuthorizationHeaderProvider.cs
Show resolved
Hide resolved
jmprieur
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I forgot to press "Submit review"
src/Microsoft.Identity.Web.TokenAcquisition/DefaultAuthorizationHeaderBoundProvider.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Identity.Web.TokenAcquisition/DefaultAuthorizationHeaderBoundProvider.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Identity.Web.TokenAcquisition/DefaultAuthorizationHeaderBoundProvider.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Identity.Web.TokenAcquisition/DefaultAuthorizationHeaderBoundProvider.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Identity.Web.TokenAcquisition/MsalMtlsHttpClientFactory.cs
Show resolved
Hide resolved
tests/Microsoft.Identity.Web.Test.Common/Mocks/MockMtlsHttpClientFactory.cs
Show resolved
Hide resolved
Co-authored-by: Jean-Marc Prieur <[email protected]>
Co-authored-by: Jean-Marc Prieur <[email protected]>
…m/cpp11nullptr/microsoft-identity-web into iepoly/add-token-binding-scenario
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds token binding support for mTLS (mutual TLS) authentication scenarios. The implementation enables acquiring tokens bound to certificates and using those certificates when calling downstream APIs.
Key Changes
- Introduced
MsalMtlsHttpClientFactoryfor creating HTTP clients configured with binding certificates - Extended
DefaultAuthorizationHeaderProviderto implementIAuthorizationHeaderProvider2for returning binding certificates alongside tokens - Updated
TokenAcquisitionto detect mTLS scenarios via authentication scheme and configure token binding accordingly
Reviewed Changes
Copilot reviewed 37 out of 38 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
MsalMtlsHttpClientFactory.cs |
New factory for creating mTLS-enabled HTTP clients with certificate pooling |
DefaultAuthorizationHeaderProvider.cs |
Extended to support IAuthorizationHeaderProvider2 interface for token binding scenarios |
TokenAcquisition.cs |
Added logic to detect mTLS authentication scheme and enable token binding via WithMtlsProofOfPossession |
DownstreamApi.cs |
Updated to use mTLS HTTP client factory when binding certificate is present |
ConfidentialClientApplicationBuilderExtension.cs |
Added WithBindingCertificateAsync method for configuring binding certificates |
MergedOptions.cs |
Added IsTokenBinding property to track token binding state |
TokenAcquirer.cs |
Updated to populate BindingCertificate in AcquireTokenResult |
| Test files | Comprehensive test coverage for new token binding functionality |
| PublicAPI files | Updated API surface documentation for all target frameworks |
src/Microsoft.Identity.Web.TokenAcquisition/MsalMtlsHttpClientFactory.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Identity.Web.TokenAcquisition/MsalMtlsHttpClientFactory.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <[email protected]>
…m/cpp11nullptr/microsoft-identity-web into iepoly/add-token-binding-scenario
src/Microsoft.Identity.Web.TokenAcquisition/MsalMtlsHttpClientFactory.cs
Show resolved
Hide resolved
src/Microsoft.Identity.Web.TokenAcquisition/MsalMtlsHttpClientFactory.cs
Show resolved
Hide resolved
src/Microsoft.Identity.Web.TokenAcquisition/MsalMtlsHttpClientFactory.cs
Show resolved
Hide resolved
src/Microsoft.Identity.Web.TokenAcquisition/MsalMtlsHttpClientFactory.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Identity.Web.TokenAcquisition/MsalMtlsHttpClientFactory.cs
Show resolved
Hide resolved
src/Microsoft.Identity.Web.TokenAcquisition/MsalMtlsHttpClientFactory.cs
Show resolved
Hide resolved
src/Microsoft.Identity.Web.TokenAcquisition/MsalMtlsHttpClientFactory.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Identity.Web.TokenAcquisition/TokenAcquisitionOptionsHelper.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Identity.Web.TokenAcquisition/DefaultAuthorizationHeaderProvider.cs
Show resolved
Hide resolved
src/Microsoft.Identity.Web.TokenAcquisition/MsalMtlsHttpClientFactory.cs
Show resolved
Hide resolved
|
Reopened as #3622. |
Purpose
Introduce a “token binding scenario” for confidential client (app-only) token acquisition and downstream API calls:
cnfclaim – thumbprint / key reference).AuthorizationHeaderProviderOptions.ProtocolScheme.High-level scenario
ProtocolScheme = "Pop"or futureProtocolScheme = "mtls-pop"/"mtls") inAuthorizationHeaderProviderOptions.cnf) when certificate binding is active.Bearer <token>; protocol-specific transformations for schemes like Pop are applied internally).cnfclaim (x5t thumbprint).