-
Notifications
You must be signed in to change notification settings - Fork 266
Add IConfidentialClientApplicationProvider and CachePartitionKey support #3822
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3c05788
Add IConfidentialClientApplicationProvider and CachePartitionKey support
iNinja 60c2f1e
Bump MSAL to 4.84.1 and fix PublicAPI entries
iNinja 0c9a6f6
Include IConfidentialClientApplicationProvider in DI assertion tests
iNinja a974586
Address Copilot review: DI registration check and Clone comparer
iNinja eb8a828
Add comment noting CachePartitionKey is not applied in ROPC silent path
iNinja b0f0e10
Address Bogdan's review feedback
iNinja File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
29 changes: 29 additions & 0 deletions
29
...icrosoft.Identity.Web.TokenAcquisition/Extensibility/TokenAcquisitionOptionsExtensions.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System.Collections.Generic; | ||
|
|
||
| namespace Microsoft.Identity.Web.Extensibility | ||
| { | ||
| /// <summary> | ||
| /// Extension methods for <see cref="TokenAcquisitionOptions"/> in extensibility scenarios. | ||
| /// </summary> | ||
| public static class TokenAcquisitionOptionsExtensions | ||
| { | ||
| /// <summary> | ||
| /// Sets cache partition key-value pairs on the options. When set, the token cache | ||
| /// lookup and storage will include these components, isolating cached tokens from | ||
| /// entries that have different (or no) partition keys. | ||
| /// </summary> | ||
| /// <param name="options">The token acquisition options.</param> | ||
| /// <param name="partitionKeys">The partition key-value pairs.</param> | ||
| /// <returns>The options instance for chaining.</returns> | ||
| public static TokenAcquisitionOptions WithCachePartitionKeys( | ||
| this TokenAcquisitionOptions options, | ||
| IDictionary<string, string> partitionKeys) | ||
| { | ||
| options.CachePartitionKeys = partitionKeys; | ||
| return options; | ||
| } | ||
| } | ||
| } |
27 changes: 27 additions & 0 deletions
27
src/Microsoft.Identity.Web.TokenAcquisition/IConfidentialClientApplicationProvider.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System.Threading.Tasks; | ||
| using Microsoft.Identity.Client; | ||
|
|
||
| namespace Microsoft.Identity.Web.Extensibility | ||
| { | ||
| /// <summary> | ||
| /// Provides access to the <see cref="IConfidentialClientApplication"/> managed by | ||
| /// Microsoft.Identity.Web for a given authentication scheme. Use this when you need | ||
| /// to call MSAL directly (e.g., for custom token acquisition flows) while reusing | ||
| /// the same application instance, credentials, and token cache that IdWeb manages. | ||
| /// </summary> | ||
| public interface IConfidentialClientApplicationProvider | ||
| { | ||
| /// <summary> | ||
| /// Gets the <see cref="IConfidentialClientApplication"/> for the specified authentication scheme. | ||
| /// </summary> | ||
| /// <param name="authenticationScheme"> | ||
| /// The authentication scheme name. If null, the effective default scheme is used. | ||
| /// </param> | ||
| /// <returns>The confidential client application instance.</returns> | ||
| Task<IConfidentialClientApplication> GetConfidentialClientApplicationAsync( | ||
| string? authenticationScheme = null); | ||
| } | ||
| } |
4 changes: 4 additions & 0 deletions
4
src/Microsoft.Identity.Web.TokenAcquisition/PublicAPI/NetCore/PublicAPI.Unshipped.txt
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,5 @@ | ||
| #nullable enable | ||
| Microsoft.Identity.Web.Extensibility.IConfidentialClientApplicationProvider | ||
| Microsoft.Identity.Web.Extensibility.IConfidentialClientApplicationProvider.GetConfidentialClientApplicationAsync(string? authenticationScheme = null) -> System.Threading.Tasks.Task<Microsoft.Identity.Client.IConfidentialClientApplication!>! | ||
| Microsoft.Identity.Web.Extensibility.TokenAcquisitionOptionsExtensions | ||
| static Microsoft.Identity.Web.Extensibility.TokenAcquisitionOptionsExtensions.WithCachePartitionKeys(this Microsoft.Identity.Web.TokenAcquisitionOptions! options, System.Collections.Generic.IDictionary<string!, string!>! partitionKeys) -> Microsoft.Identity.Web.TokenAcquisitionOptions! |
4 changes: 4 additions & 0 deletions
4
src/Microsoft.Identity.Web.TokenAcquisition/PublicAPI/NetFramework/PublicAPI.Unshipped.txt
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,5 @@ | ||
| #nullable enable | ||
| Microsoft.Identity.Web.Extensibility.IConfidentialClientApplicationProvider | ||
| Microsoft.Identity.Web.Extensibility.IConfidentialClientApplicationProvider.GetConfidentialClientApplicationAsync(string? authenticationScheme = null) -> System.Threading.Tasks.Task<Microsoft.Identity.Client.IConfidentialClientApplication!>! | ||
| Microsoft.Identity.Web.Extensibility.TokenAcquisitionOptionsExtensions | ||
| static Microsoft.Identity.Web.Extensibility.TokenAcquisitionOptionsExtensions.WithCachePartitionKeys(this Microsoft.Identity.Web.TokenAcquisitionOptions! options, System.Collections.Generic.IDictionary<string!, string!>! partitionKeys) -> Microsoft.Identity.Web.TokenAcquisitionOptions! |
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
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.