Conversation
There was a problem hiding this comment.
Pull request overview
Adds support for sending attribute_tokens on confidential-client token requests (auth code, client credentials, and OBO) via new WithAttributeTokens(...) builder APIs, updates the public API baselines, and introduces unit tests validating request-body behavior and (for client credentials) cache partitioning.
Changes:
- Added
WithAttributeTokens(IEnumerable<string>)to auth code, client credentials, and OBO parameter builders. - Introduced
OAuth2Parameter.AttributeTokensconstant ("attribute_tokens"). - Updated PublicAPI
Unshippedbaselines across TFMs and added new unit tests.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Microsoft.Identity.Test.Unit/PublicApiTests/WithAttributeTokensTests.cs | Adds unit coverage for WithAttributeTokens formatting, null validation, and client-credentials caching behavior. |
| src/client/Microsoft.Identity.Client/ApiConfig/AcquireTokenByAuthorizationCodeParameterBuilder.cs | Adds auth-code builder API to attach attribute_tokens to the token request body. |
| src/client/Microsoft.Identity.Client/ApiConfig/AcquireTokenForClientParameterBuilder.cs | Adds client-credentials builder API to attach attribute_tokens (via extra body params). |
| src/client/Microsoft.Identity.Client/ApiConfig/AcquireTokenOnBehalfOfParameterBuilder.cs | Adds OBO builder API to attach attribute_tokens to the token request body. |
| src/client/Microsoft.Identity.Client/OAuth2/OAuthConstants.cs | Adds OAuth2Parameter.AttributeTokens constant. |
| src/client/Microsoft.Identity.Client/PublicApi/*/PublicAPI.Unshipped.txt | Registers new public API methods for all supported TFMs. |
…ehalfOfParameterBuilder.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
bgavrilMS
left a comment
There was a problem hiding this comment.
Too much code duplication. No token caching.
|
OBO cache-partition limitation is undocumented in the API The test This is a significant behavioral footgun that isn't mentioned anywhere in the public XML docs for |
|
Does this need to be closed @4gust ? |
|
@Robbie-Microsoft Good catch, I have updated the method documentation and added a few tests. I skipped one scenario due to a bug. I’ve opened a tracking issue here: #5963 |
|
@copilot resolve the merge conflicts in this pull request |
Agent-Logs-Url: https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/sessions/e5a56670-973e-4af2-81cc-8caedc258b28 Co-authored-by: 4gust <107404295+4gust@users.noreply.github.com>
Added the explicit recommendation to use separate
No merge conflicts exist in the branch — the most recent commit (8aa44f7) is already a merge commit that brought in the latest |
Added support for
WithAttributeTokensfor CCA acquisition methodsThis pull request adds support for specifying attribute tokens in token acquisition requests across multiple authentication flows in the Microsoft Identity Client library. It introduces new
WithAttributeTokensmethods to the parameter builders for authorization code, client credentials, and on-behalf-of flows, allowing developers to include custom attribute tokens in requests via theattribute_tokensparameter.The most important changes include:
New API Surface:
Added
WithAttributeTokens(IEnumerable<string> attributeTokens)methods toAcquireTokenByAuthorizationCodeParameterBuilder,AcquireTokenForClientParameterBuilder, andAcquireTokenOnBehalfOfParameterBuilder, enabling the inclusion of attribute tokens in token requests. These methods validate input, join the tokens, and add them to the request body. [1] [2] [3]Updated the public API files for all supported frameworks to register the new
WithAttributeTokensmethods, ensuring they are part of the public API surface.OAuth2 Parameter Support:
AttributeTokensto theOAuth2Parameterclass for use as the key in the request body parameter.Fixes #
Testing
Unit test added.