-
Notifications
You must be signed in to change notification settings - Fork 344
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
[Feature Request] In-memory shared cache cache in MSAL (like ADAL), with good performance #2849
Comments
I would recommend: appBuilder.WithSharedDefaultCache(bool=false) This is:
If customers use this option and then if they try to add a custom cache (if the serialization events are subscribed to), MSAL.NET should throw with a meaningful exception, as the default cache is incompatible with a serialization. Later we could decide to:
|
I agree with the some of the wording suggestions, but the current proposal:
// looks ok:
appBuilder.WithSharedDefaultCache(enabled: true, maxSize: 1000, ttl: TimeSpan.FromHours(36))
// a configurable non-static cache is confusing:
appBuilder.WithSharedDefaultCache(enabled: false, maxSize: 1000, ttl: TimeSpan.FromHours(36)) Perhaps |
Many customers have problems migrating from ADAL to MSAL because of the token caching. The cache is no longer static / shared.
Our current solutions to this problem are not great because:
Proposal:
Add a feature to allow app developers some control over how tokens are stored in memory, directly from MSAL. This can be added to both PCA and CCA. Should not be exposed on mobile platforms and UWP.
Solution 1
appBuilder.WithStaticMemoryCache()
// this will make the internal storage static / shared and will achieve ADAL parityThis simply involves adding static version of our Accessor objects, which are already thread safe.
Solution 2 (preferred)
A more general approach, allowing us to move to use Wilson's Event based LRU cache which can add eviction policies.
appBuilder.WithMemoryCache(MemoryCacheOptions)
Solution 3
Full extensibility. We would still need to provide a few implementations.
appBuilder.WithMemoryCache(ITokenCacheAccessor)
where ITokenCacheAccessor is our (currently internal) interface https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/blob/cfa8c9193e0797eeca1927729b980acd1dd18b06/src/client/Microsoft.Identity.Client/Cache/ITokenCacheAccessor.csThe text was updated successfully, but these errors were encountered: