TokenCacheAccessContext Class
- java.
lang. Object - com.
microsoft. aad. msal4j. TokenCacheAccessContext
- com.
Implements
public class TokenCacheAccessContext
implements ITokenCacheAccessContext
Context in which the token cache is accessed
For more details, see https://aka.ms/msal4j-token-cache
Method Summary
| Modifier and Type | Method and Description |
|---|---|
| IAccount |
account()
Gets the account associated with the current cache access operation, if any. |
|
static
Token |
builder() |
| java.lang.String |
clientId()
Gets the client ID associated with the current cache access operation. |
| boolean |
hasCacheChanged()
Indicates whether the cache was modified during this operation. |
|
IToken |
tokenCache()
Gets the token cache instance being accessed. |
Methods inherited from java.lang.Object
Method Details
account
public IAccount account()
Gets the account associated with the current cache access operation, if any.
This may be null for operations that are not specific to a user account, such as client credential flow token requests.
builder
public static TokenCacheAccessContext.TokenCacheAccessContextBuilder builder()
clientId
public String clientId()
Gets the client ID associated with the current cache access operation.
This 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.
hasCacheChanged
public boolean hasCacheChanged()
Indicates whether the cache was modified during this operation.
This is particularly useful in the ITokenCacheAccessAspect#afterCacheAccess method to determine whether the cache should be persisted. If no changes were made to the cache, applications can avoid unnecessary write operations.
tokenCache
public ITokenCache tokenCache()
Gets the token cache instance being accessed.
This can be used to read or modify the cache entries during a cache access operation.