-
Notifications
You must be signed in to change notification settings - Fork 37
Update MsalProvider to use native account broker #169
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 7 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
c1cfd03
Updated MsalProvider to use local account broker when possible.
shweaver-MSFT da28c50
Added license header
shweaver-MSFT b13c0bf
Fixed bad reference from netstandard2.0 to 1.4 in auth project
shweaver-MSFT 5798591
Updated MsalProvider configuration to support toggling org account lo…
shweaver-MSFT 9324b8b
Reverting CT.Auth package to netstandard2.0 and fixing min version re…
shweaver-MSFT 971bb25
Re-adding SDK version header logic
shweaver-MSFT c3fbd6d
Removed PublicClientApplicationConfig
shweaver-MSFT 615a0d6
Added token cache example to wpf sample app.
shweaver-MSFT ef6148a
Added missing file header
shweaver-MSFT 01c5f9a
Renamed WpfMsalProviderSample to WpfNet5WindowsMsalProviderSample and…
shweaver-MSFT 6a4c070
Added mising license headers to new Wpf NetCore MsalProvider sample
shweaver-MSFT 59829d3
Added bug workaround to fix CI build
shweaver-MSFT 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
5 changes: 3 additions & 2 deletions
5
CommunityToolkit.Authentication.Msal/CommunityToolkit.Authentication.Msal.csproj
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
35 changes: 35 additions & 0 deletions
35
CommunityToolkit.Authentication.Msal/MsalProviderExtensions.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,35 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
| // See the LICENSE file in the project root for more information. | ||
|
|
||
| using System.Diagnostics; | ||
| using System.Threading.Tasks; | ||
| using Microsoft.Identity.Client.Extensions.Msal; | ||
|
|
||
| namespace CommunityToolkit.Authentication.Msal | ||
| { | ||
| /// <summary> | ||
| /// Helpers for working with the MsalProvider. | ||
| /// </summary> | ||
| public static class MsalProviderExtensions | ||
| { | ||
| /// <summary> | ||
| /// Helper function to initialize the token cache for non-UWP apps. MSAL handles this automatically on UWP. | ||
| /// </summary> | ||
| /// <param name="provider">The instance of <see cref="MsalProvider"/> to init the cache for.</param> | ||
| /// <param name="storageProperties">Properties for configuring the storage cache.</param> | ||
| /// <param name="logger">Passing null uses the default TraceSource logger.</param> | ||
| /// <returns>A <see cref="Task"/> representing the result of the asynchronous operation.</returns> | ||
| public static async Task InitTokenCacheAsync( | ||
| this MsalProvider provider, | ||
| StorageCreationProperties storageProperties, | ||
| TraceSource logger = null) | ||
| { | ||
| #if !WINDOWS_UWP | ||
| // Token cache persistence (not required on UWP as MSAL does it for you) | ||
| var cacheHelper = await MsalCacheHelper.CreateAsync(storageProperties, logger); | ||
| cacheHelper.RegisterCache(provider.Client.UserTokenCache); | ||
| #endif | ||
| } | ||
| } | ||
| } |
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
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.