Skip to content
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] Provide glue to integrate IConfidentialClientApplication and IMsalTokenCacheProvider #1448

Open
rymeskar opened this issue Sep 16, 2021 · 4 comments
Labels
enhancement New feature or request more info needed R9 Internal 1P

Comments

@rymeskar
Copy link

It seems like you already today provide the customer the option to register the caches to service collection. You are also creating a separate caching package without the ITokenAcquisition API.

The user might take advantage of the native pattern of registrations the cache implementation to DI. But then the actual cca/cache glue code is provided only within the TokenAcquistion APIs [1,2] not on CCA extension methods.

Could you maybe add an extension to IConfidentialClientApplication method that expects IServiceProvider and another one that directly expects IMsalTokenCacheProvider so that customers can

  1. continue with their DI pattern on app initialization.
  2. not need to know about the specifics of cache integration pattern between CCA and Id.Web
@rymeskar rymeskar added the enhancement New feature or request label Sep 16, 2021
@jmprieur
Copy link
Collaborator

@rymeskar, I'm a bit confused by the question. I believe we already provide extension methods to use the token cache with MSAL directly:
https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-net-token-cache-serialization?tabs=aspnet#distributed-caches

(in Microsoft.Identity.Web.TokenCache)

@rymeskar
Copy link
Author

@jmprieur the current API re-initialize the ServiceCollection from scratch. My proposal is that the user has already registered the Microsoft.Extensions.* caches into his DI (ServiceProvider) already at app startup. IMHO Id.Web should provide a way to work with such ServiceProvider as well. Not just this from-scratch way.

@jmprieur
Copy link
Collaborator

@rymeskar : I'm still confused. Do the following work?

and

?

@rymeskar
Copy link
Author

These are useful at startup (IServiceCollection).

The missing signature I had in mind is:
public static IConfidentialClientApplication AddInMemoryTokenCache( this IConfidentialClientApplication confidentialClientApp, IServiceProvider serviceProvider)

etc.

@jennyf19 jennyf19 added the R9 Internal 1P label Oct 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request more info needed R9 Internal 1P
Projects
None yet
Development

No branches or pull requests

3 participants