Reputation: 1389
I'm using the Graph API Client library in my Web API project to check if the user belongs to a Group for security reasons. I realized that it is too slow, it takes almost 2 seconds to query the Azure AD. Is there a way to cache this information? Or does someone have any advice on how to handle this situation?
Upvotes: 3
Views: 1076
Reputation: 11256
Rather than trying to cache this you should leverage the new group claims feature in Azure AD. This will deliver group membership claims to your Web API application as claims in the JWT token for your authenticated user.
Here is a link from the Azure AD blog describing the feature.
Here is a link to blog I recently wrote on this subject that shows how to do this from your Web API.
http://justazure.com/azure-active-directory-part-4-group-claims/
Upvotes: 2