AddDistributedTokenCaches without enabling MicrosoftIdentityWebAppAuthentication
See original GitHub issueHow to make use of the distributed sqlserver cache without enabling MicrosoftIdentityWebAppAuthentication?
I have a ConfidentialClientApplication which I created using this:
public MsalAuthProvider(IMsalTokenCacheProvider tokenCacheProvider)
{
_app = ConfidentialClientApplicationBuilder.Create("<clientid>")
.WithClientSecret("<clientsecret>")
.WithAuthority("<authority>")
.WithRedirectUri("<redirecturi>")
.Build();
tokenCacheProvider.InitializeAsync(_app.AppTokenCache);
tokenCacheProvider.InitializeAsync(_app.UserTokenCache);
}
In the startup you can register the IMsalTokenCacheProvider
using:
services.AddMicrosoftIdentityWebAppAuthentication()
.EnableTokenAcquisitionToCallDownstreamApi()
.AddDistributedTokenCaches();
services.AddDistributedSqlServerCache(options => { //options... });
I want to use the sql server cache but I do not want to enable authentication towards azuread because it conflicts with my own authentication towards my own IdentityServer
services.AddAuthentication("Bearer")
.AddJwtBearer("Bearer", options => { //options...});
Can I register / inject the IMsalTokenCacheProvider
some other way so I can prevent the usage of AddMicrosoftIdentityWebAppAuthentication
?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:6
Top Results From Across the Web
[Feature Request] Allow AddDistributedTokenCaches to ...
Ideally, we want to only use distributed token cache for the OIDC flow (AcquireTokenByAuthorizationCode) because it is required. A machine in- ...
Read more >Token cache serialization (MSAL.NET) - Microsoft Entra
AddDistributedTokenCaches, The token cache is an adapter against the ASP.NET Core IDistributedCache implementation. It enables you to choose ...
Read more >TokenCacheExtensions.AddDistributedTokenCache Method
Action taking a IServiceCollection and by which you initialize your distributed cache. Returns. IConfidentialClientApplication. The application for chaining.
Read more >Untitled
... option must be provided Enable web app authentication options using Azure … ... social.msdn.microsoft.com AddDistributedTokenCaches without enabling .
Read more >Using MSAL to get access token and cache it in SQL DB ...
I want to authenticate AAD users to access powerBi resources through MSAL by using application ID and secret. So i want to get...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
cool. we can release it after the MSAL .NET release then.
@jennyf19, @henrik-me, as discussed let’s take it in 1.3.1 (which therefore become 1.4.0) I also benefits to MSAL.NET users wanting to use net472