question

aidangarnish avatar image
0 Votes"
aidangarnish asked ·

Azure AD B2C SQL Token Cache

I have set up a .Net core web application and web API and secured them using Azure AD B2C based on the following sample - https://docs.microsoft.com/en-us/samples/azure-samples/active-directory-b2c-dotnetcore-webapp/an-aspnet-core-web-app-with-azure-ad-b2c/

This is great for initial development but uses a static in memory cache so whenever the web app is restarted the token cache is cleared. I would like to implement SQL token caching using IDistributedCache but can only find samples that are Azure AD (not B2C) specific or out of date and using previous versions of MSAL.net (I am currently using v3).

Does anyone know of any examples that provide details for implementing a SQL token cache with Azure AD B2C?

azure-active-directory
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

MarileeTurscak avatar image
0 Votes"
MarileeTurscak answered ·

There is no example specifically for this that I am aware of.

I believe this exists for regular AD but not for B2C. https://github.com/Azure-Samples/active-directory-aspnetcore-webapp-openidconnect-v2

I would highly recommend making a feature request in User Voice, where the product team can respond directly to you. https://feedback.azure.com/forums/169401-azure-active-directory/category/160596-b2c

I am happy to upvote any request that you make if you link it here.

· 1 · Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks for your reply. I had a look at the Azure AD samples but wasn't able to convert these across to B2C effectively.

I have raised a UserVoce request here - https://feedback.azure.com/forums/169401-azure-active-directory/suggestions/39202885-add-sample-project-for-azure-ad-b2c-sql-token-cach

For now I have returned to using ASP.Net core Identity as, for me, the overhead of implementing this is much lower and is better supported by the docs and community.

0 Votes 0 · ·