Language

MicrosoftIdentityOptions.PartitionAppTokenCacheByAudience Property

Definition

When set to true, the application token cache (client credentials, i.e. AcquireTokenForClient) is partitioned by the audience (resource) of the requested token.

Applications that acquire app tokens for many resources using the same client and tenant otherwise accumulate all of those tokens in a single cache partition, which makes cache lookups O(n) in the number of resources. Enabling this adds the resource (derived from the requested <resource>/.default scope) as a non-protocol-affecting cache key component, so each resource gets its own partition and cache reads stay O(1).

Defaults to false. This can be set via configuration, e.g. "AzureAd": { "PartitionAppTokenCacheByAudience": true }.

public bool PartitionAppTokenCacheByAudience { get; set; }
member this.PartitionAppTokenCacheByAudience : bool with get, set
Public Property PartitionAppTokenCacheByAudience As Boolean

Property Value

Applies to