public interface ITokenCacheAccessAspect
This interface enables applications to hook into the token cache access operations, allowing for serialization and persistence of the token cache. Implementing this interface allows applications to load the cache state from persistent storage before MSAL accesses it, and save changes back to persistent storage after MSAL modifies it.
For more details, see https://aka.ms/msal4j-token-cache
| Modifier and Type | Method and Description |
|---|---|
void |
afterCacheAccess(ITokenCacheAccessContext iTokenCacheAccessContext)
Executes after the token cache is accessed by MSAL.
|
void |
beforeCacheAccess(ITokenCacheAccessContext iTokenCacheAccessContext)
Executes before the token cache is accessed by MSAL.
|
void beforeCacheAccess(ITokenCacheAccessContext iTokenCacheAccessContext)
This method is called by MSAL immediately before it accesses the token cache.
Applications should use this method to load the current cache state from persistent
storage and update the in-memory cache by calling ITokenCacheAccessContext.tokenCache().
This ensures MSAL has access to all previously cached tokens.
iTokenCacheAccessContext - Context object providing access to the token cache and related information.void afterCacheAccess(ITokenCacheAccessContext iTokenCacheAccessContext)
This method is called by MSAL immediately after it accesses (and potentially modifies)
the token cache. Applications should use this method to persist the current state of the
cache to storage if changes were made. The ITokenCacheAccessContext.hasCacheChanged()
method can be used to determine if the cache was modified during the operation.
iTokenCacheAccessContext - Context object providing access to the token cache and related information,
including whether the cache was modified.Copyright © 2013–2025. All rights reserved.