diff --git a/src/Microsoft.Identity.Web.TokenCache/Microsoft.Identity.Web.xml b/src/Microsoft.Identity.Web.TokenCache/Microsoft.Identity.Web.xml
index 57df3394a..cae223ebf 100644
--- a/src/Microsoft.Identity.Web.TokenCache/Microsoft.Identity.Web.xml
+++ b/src/Microsoft.Identity.Web.TokenCache/Microsoft.Identity.Web.xml
@@ -704,10 +704,11 @@
{
services.Configure<MemoryCacheOptions>(options =>
{
- options.AbsoluteExpirationRelativeToNow = TimeSpan.FromHours(1); // for example
+ options.SizeLimit = 5000000; // in bytes (5 Mb), for example
});
});
+
Don't use this method in ASP.NET Core. Just add use the ConfigureServices method
instead.
diff --git a/src/Microsoft.Identity.Web/MergedOptions.cs b/src/Microsoft.Identity.Web/MergedOptions.cs
index b9d270aa7..781ae856e 100644
--- a/src/Microsoft.Identity.Web/MergedOptions.cs
+++ b/src/Microsoft.Identity.Web/MergedOptions.cs
@@ -44,6 +44,7 @@ public ConfidentialClientApplicationOptions ConfidentialClientApplicationOptions
public LogLevel LogLevel { get; set; }
public string? RedirectUri { get; set; }
public bool EnableCacheSynchronization { get; set; }
+ internal bool MergedWithCca { get; set; }
internal static void UpdateMergedOptionsFromMicrosoftIdentityOptions(MicrosoftIdentityOptions microsoftIdentityOptions, MergedOptions mergedOptions)
{
@@ -254,6 +255,7 @@ internal static void UpdateMergedOptionsFromMicrosoftIdentityOptions(MicrosoftId
internal static void UpdateMergedOptionsFromConfidentialClientApplicationOptions(ConfidentialClientApplicationOptions confidentialClientApplicationOptions, MergedOptions mergedOptions)
{
+ mergedOptions.MergedWithCca = true;
mergedOptions.AadAuthorityAudience = confidentialClientApplicationOptions.AadAuthorityAudience;
mergedOptions.AzureCloudInstance = confidentialClientApplicationOptions.AzureCloudInstance;
if (string.IsNullOrEmpty(mergedOptions.AzureRegion) && !string.IsNullOrEmpty(confidentialClientApplicationOptions.AzureRegion))
diff --git a/src/Microsoft.Identity.Web/Microsoft.Identity.Web.csproj b/src/Microsoft.Identity.Web/Microsoft.Identity.Web.csproj
index c8fd050c3..2a3fb98c8 100644
--- a/src/Microsoft.Identity.Web/Microsoft.Identity.Web.csproj
+++ b/src/Microsoft.Identity.Web/Microsoft.Identity.Web.csproj
@@ -87,8 +87,8 @@
-
-
+
+
diff --git a/src/Microsoft.Identity.Web/TokenAcquisition.cs b/src/Microsoft.Identity.Web/TokenAcquisition.cs
index 89f7f0de3..5d6612696 100644
--- a/src/Microsoft.Identity.Web/TokenAcquisition.cs
+++ b/src/Microsoft.Identity.Web/TokenAcquisition.cs
@@ -82,7 +82,14 @@ public TokenAcquisition(
internal MergedOptions GetOptions(string authenticationScheme)
{
- return _mergedOptionsMonitor.Get(authenticationScheme);
+ var mergedOptions = _mergedOptionsMonitor.Get(authenticationScheme);
+ if (!mergedOptions.MergedWithCca)
+ {
+ var ccaOptionsMonitor = _serviceProvider.GetService>();
+ ccaOptionsMonitor?.Get(authenticationScheme);
+ }
+
+ return mergedOptions;
}
///
@@ -363,13 +370,14 @@ public Task GetAuthenticationResultForAppAsync(
}
authenticationScheme = GetEffectiveAuthenticationScheme(authenticationScheme);
+
MergedOptions mergedOptions = GetOptions(authenticationScheme);
// Case of an anonymous controller, no [Authorize] attribute will trigger the merge options
if (string.IsNullOrEmpty(mergedOptions.Instance))
{
- var mergedOptionsMonitor = _serviceProvider.GetRequiredService>();
- mergedOptionsMonitor.Get(JwtBearerDefaults.AuthenticationScheme);
+ var mergedOptionsMonitor = _serviceProvider.GetService>();
+ mergedOptionsMonitor?.Get(JwtBearerDefaults.AuthenticationScheme);
}
if (string.IsNullOrEmpty(tenant))
diff --git a/tests/WebAppCallsWebApiCallsGraph/gRPC/grpc.csproj b/tests/WebAppCallsWebApiCallsGraph/gRPC/grpc.csproj
index 96bb3e315..27d0a0699 100644
--- a/tests/WebAppCallsWebApiCallsGraph/gRPC/grpc.csproj
+++ b/tests/WebAppCallsWebApiCallsGraph/gRPC/grpc.csproj
@@ -10,7 +10,7 @@
-
+