public class TokenCacheAccessContext extends Object implements ITokenCacheAccessContext
For more details, see https://aka.ms/msal4j-token-cache
| Modifier and Type | Class and Description |
|---|---|
static class |
TokenCacheAccessContext.TokenCacheAccessContextBuilder |
| Modifier and Type | Method and Description |
|---|---|
IAccount |
account()
Gets the account associated with the current cache access operation, if any.
|
static TokenCacheAccessContext.TokenCacheAccessContextBuilder |
builder() |
String |
clientId()
Gets the client ID associated with the current cache access operation.
|
boolean |
hasCacheChanged()
Indicates whether the cache was modified during this operation.
|
ITokenCache |
tokenCache()
Gets the token cache instance being accessed.
|
public static TokenCacheAccessContext.TokenCacheAccessContextBuilder builder()
public ITokenCache tokenCache()
ITokenCacheAccessContextThis can be used to read or modify the cache entries during a cache access operation.
tokenCache in interface ITokenCacheAccessContextITokenCache instance that is being accessed.public String clientId()
ITokenCacheAccessContextThis identifies which client application (registered in Azure AD) is performing the cache access. In multi-tenant or multi-client scenarios, applications may want to partition their token cache by client ID.
clientId in interface ITokenCacheAccessContextpublic IAccount account()
ITokenCacheAccessContextThis may be null for operations that are not specific to a user account, such as client credential flow token requests.
account in interface ITokenCacheAccessContextIAccount instance related to this cache access, or null if
the operation is not account-specific.public boolean hasCacheChanged()
ITokenCacheAccessContext
This is particularly useful in the ITokenCacheAccessAspect.afterCacheAccess(com.microsoft.aad.msal4j.ITokenCacheAccessContext) method
to determine whether the cache should be persisted. If no changes were made to the cache,
applications can avoid unnecessary write operations.
hasCacheChanged in interface ITokenCacheAccessContextCopyright © 2013–2025. All rights reserved.