This repository has been archived by the owner on Sep 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 32
Fix for #98 - cache cannot be used with ADFS #130
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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 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 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 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 |
---|---|---|
|
@@ -32,8 +32,8 @@ static async Task Main(string[] args) | |
var cacheHelper = await CreateCacheHelperAsync().ConfigureAwait(false); | ||
cacheHelper.RegisterCache(pca.UserTokenCache); | ||
|
||
// The token cache helper provides a high level event that informs apps about added / removed accounts. | ||
cacheHelper.CacheChanged += (s, e) => | ||
// Advanced scenario for when 2 or more apps share the same cache | ||
cacheHelper.CacheChanged += (s, e) => // this event is very expensive perf wise | ||
{ | ||
Console.BackgroundColor = ConsoleColor.DarkCyan; | ||
Console.WriteLine($"Cache Changed, Added: {e.AccountsAdded.Count()} Removed: {e.AccountsRemoved.Count()}"); | ||
|
@@ -276,8 +276,7 @@ private static async Task<MsalCacheHelper> CreateCacheHelperAsync() | |
{ | ||
storageProperties = new StorageCreationPropertiesBuilder( | ||
Config.CacheFileName, | ||
Config.CacheDir, | ||
Config.ClientId) | ||
Config.CacheDir) | ||
.WithLinuxKeyring( | ||
Config.LinuxKeyRingSchema, | ||
Config.LinuxKeyRingCollection, | ||
|
@@ -287,6 +286,9 @@ private static async Task<MsalCacheHelper> CreateCacheHelperAsync() | |
.WithMacKeyChain( | ||
Config.KeyChainServiceName, | ||
Config.KeyChainAccountName) | ||
.WithCacheChangedEvent( // do NOT use unless really necessary, high perf penalty! | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CacheChanged event is scoped to this (client_id, authority) pair. There isn't (currently) a way to get events about other pairs, except by creating different instances of the MsalCacheHelper object. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does it mean that you won't have changes in the FOCI ? |
||
Config.ClientId, | ||
Config.Authority) | ||
.Build(); | ||
|
||
var cacheHelper = await MsalCacheHelper.CreateAsync( | ||
|
@@ -305,8 +307,7 @@ private static async Task<MsalCacheHelper> CreateCacheHelperAsync() | |
storageProperties = | ||
new StorageCreationPropertiesBuilder( | ||
Config.CacheFileName, | ||
Config.CacheDir, | ||
Config.ClientId) | ||
Config.CacheDir) | ||
.WithLinuxUnprotectedFile() | ||
.WithMacKeyChain( | ||
Config.KeyChainServiceName, | ||
|
@@ -318,7 +319,6 @@ private static async Task<MsalCacheHelper> CreateCacheHelperAsync() | |
|
||
return cacheHelper; | ||
} | ||
|
||
} | ||
|
||
private static IPublicClientApplication CreatePublicClient(string authority) | ||
|
This file contains 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 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 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.
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.
Example usage is here - you can see that Client_ID is no longer a mandatory param. If people need CacheChanged event, they need to configure both "client_id" and "authority". If they don't, they'll get a good error message when subscribing to
CacheChanged