-
Notifications
You must be signed in to change notification settings - Fork 219
Handle L2 cache eviction
In the Distributed cache, when a user signs-out of a web app, Microsoft Identity Web removes their account from the cache, but not cached values relating to the OBO tokens, the tokens acquired by the web API for downstream web API calls.
This is because MSAL.NET has no context into the cached OBO items on the web API.
In this diagram, a user has signed-in to the web app, which calls a web API, which itself calls a downstream web API (please note both the web app and the web API are sharing the same Redis cache). There is both a user token and an OBO token in the Redis cache. The user signs-out, the user token is removed from the cache. The same user signs-in again, and a new user token is cached, as well as a new OBO token. However, notice the previous OBO token is still in the cache. Even though it may or may not be expired, it will not be useable in calling the downstream web API. The number of items in the Redis cache is growing.
Now two different users have signed-in to the web app. Notice the number of OBO tokens are increasing, even though only two are currently valid.
In order to remove the OBO tokens from the Distributed cache, please set the AbsoluteExpirationRelativeToNow
and/or SlidingExpiration
in the DistributedCacheEntryOptions
. We recommend using the SlidingExpiration
, as shown in the diagram below.
By default OBO tokens have a 1 hour lifetime.
Or set the AbsoluteExpirationRelativeToNow
, in conjunction with the SlidingExpiration
.
- Home
- Why use Microsoft Identity Web?
- Web apps
- Web APIs
- Using certificates
- Minimal support for .NET FW Classic
- Logging
- Azure AD B2C limitations
- Samples
- Web apps
- Web app samples
- Web app template
- Call an API from a web app
- Managing incremental consent and conditional access
- Web app troubleshooting
- Deploy to App Services Linux containers or with proxies
- SameSite cookies
- Hybrid SPA
- Web APIs
- Web API samples
- Web API template
- Call an API from a web API
- Token Decryption
- Web API troubleshooting
- web API protected by ACLs instead of app roles
- gRPC apps
- Azure Functions
- Long running processes in web APIs
- Authorization policies
- Generic API
- Customization
- Logging
- Calling graph with specific scopes/tenant
- Multiple Authentication Schemes
- Utility classes
- Setting FIC+MSI
- Mixing web app and web API
- Deploying to Azure App Services
- Azure AD B2C issuer claim support
- Performance
- specify Microsoft Graph scopes and app-permissions
- Integrate with Azure App Services authentication
- Ajax calls and incremental consent and conditional access
- Back channel proxys
- Client capabilities