-
Notifications
You must be signed in to change notification settings - Fork 242
Add support for calling WithClientClaims flow for token acquisition #3623
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
base: master
Are you sure you want to change the base?
Conversation
| private static IDictionary<string, string>? GetClientClaimsIfExist(TokenAcquisitionOptions? tokenAcquisitionOptions) | ||
| { | ||
| IDictionary<string, string>? clientClaims = null; | ||
| if (tokenAcquisitionOptions is not null && tokenAcquisitionOptions.ExtraParameters is not null && |
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.
Hmm, im not sure it is best to use client claims with the ExtraParameters collection. This collection is meant for very generic parameters that we dont know all the details of. For example, the attribute feature was not meant to be exposed in MSAL/IdWeb so this generic collection was used. I think in this case, we should expose the client claims in the abstractions because it is a known value for MSAL. CC @bgavrilMS
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.
+1 to what Travis is saying. If developers need to know about it it should be in Abstractions. If we don't want people to mess around with it it should be in ExtraParameters.
Aside:
- is it a per request or per app parameter. If it's considered at CCA building time as it seems to be, shouldn't it be in MicrosoftIdentityApplicationOptions ?
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.
- I think it is a fairly obscure scenario , I am not aware of any 3p needing this. I'm fine either way, with a slight inclination towards keeping it in ExtraParameters
- yeah in MSAL it is on a "per app" basis. I believe the CX needs it on a per app basis as well - @trwalke pls confirm.
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.
@jmprieur Yeah, I added to the application options
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.
@bgavrilMS @trwalke please ping me offline with the customer scenario.
This PR, @trwalke, is not compatible with AzureAD/microsoft-identity-abstractions-for-dotnet#230
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.
Yes, I agree with that comment. This was a PoC. The whole point was to make it work quickly with avoiding having to update abstractions, but then we agreed that it could stay that way (?)
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.
Currently customers were passing it per request with Adal... but Im not sure it would be changing that often. There would probably be a grouping per application.
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.
It could. I just don't understand if it's on the request or the app. I see both in different places in these 2 prs
| public HttpClient GetHttpClient() => _httpClient; | ||
| } | ||
|
|
||
| private class CapturingHandler : HttpMessageHandler |
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.
we already have a mocking framework to capture MSAL traffic and reply with test responses. i can update the tests to use them
see: https://github.com/AzureAD/microsoft-identity-web/blob/master/tests/Microsoft.Identity.Web.Test.Common/Mocks/MockHttpClientFactory.cs
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.
Sounds good to me.
src/Microsoft.Identity.Web.TokenAcquisition/ConfidentialClientApplicationBuilderExtension.cs
Show resolved
Hide resolved
src/Microsoft.Identity.Web.TokenAcquisition/ConfidentialClientApplicationBuilderExtension.cs
Show resolved
Hide resolved
| private static IDictionary<string, string>? GetClientClaimsIfExist(TokenAcquisitionOptions? tokenAcquisitionOptions) | ||
| { | ||
| IDictionary<string, string>? clientClaims = null; | ||
| if (tokenAcquisitionOptions is not null && tokenAcquisitionOptions.ExtraParameters is not null && |
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.
+1 to what Travis is saying. If developers need to know about it it should be in Abstractions. If we don't want people to mess around with it it should be in ExtraParameters.
Aside:
- is it a per request or per app parameter. If it's considered at CCA building time as it seems to be, shouldn't it be in MicrosoftIdentityApplicationOptions ?
Add support for calling WithClientClaims flow for token acquisition
Enabling MSAL's WithClientClaims flavor of client assertions call and exposing it through IdWeb.