diff --git a/Directory.Build.props b/Directory.Build.props index 5d4ed6fd5..0dcf43ac5 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -85,16 +85,35 @@ 3.3.0 4.7.2 4.6.0 - 1.11.4 + 1.17.2 4.6.0 4.36.0 4.57.0-preview - 8.0.5 + 8.0.6 8.0.1 4.14.0 4.14.0 + + 8.0.3 + + + + + 8.0.0 + 8.0.1 + $(CommonMicrosoftExtensionsVersion) + $(CommonMicrosoftExtensionsVersion) + $(CommonMicrosoftExtensionsVersion) + $(CommonMicrosoftExtensionsVersion) + $(CommonMicrosoftExtensionsVersion) + $(CommonMicrosoftExtensionsVersion) + $(CommonMicrosoftExtensionsVersion) @@ -110,6 +129,7 @@ $(SystemSecurityCryptographyServicingVersion) $(SystemSecurityCryptographyServicingVersion) $(NetNineRuntimeVersion) + $(NetNineRuntimeVersion) $(NetNineRuntimeVersion) $(NetNineRuntimeVersion) $(NetNineRuntimeVersion) @@ -129,6 +149,7 @@ $(SystemSecurityCryptographyServicingVersion) $(SystemSecurityCryptographyServicingVersion) $(NetTenRuntimeVersion) + $(NetTenRuntimeVersion) $(NetTenRuntimeVersion) $(NetTenRuntimeVersion) $(NetTenRuntimeVersion) @@ -139,36 +160,19 @@ 8.0.0 8.0.0 8.0.1 - 8.0.0 8.0.1 8.0.1 8.0.3 - 8.0.0 8.0.0 - 8.0.0 - 8.0.0 6.0.0-* 6.0.0-* - 6.0.2 - - 6.0.0 - 3.1.3 6.0.0 7.0.2 6.0.1 - - 6.0.0 - - - 6.0.0 - - - 6.0.0 - 2.1.0 @@ -176,13 +180,6 @@ 7.0.2 4.7.1 - 4.7.1 - 2.1.0 - 2.1.1 - 3.1.3 - 2.1.0 - 2.1.0 - 2.1.0 diff --git a/src/Microsoft.Identity.Web.Certificate/KeyVaultCertificateLoader.cs b/src/Microsoft.Identity.Web.Certificate/KeyVaultCertificateLoader.cs index 1c83b0e19..030366ca6 100644 --- a/src/Microsoft.Identity.Web.Certificate/KeyVaultCertificateLoader.cs +++ b/src/Microsoft.Identity.Web.Certificate/KeyVaultCertificateLoader.cs @@ -66,7 +66,6 @@ public async Task LoadIfNeededAsync(CredentialDescription credentialDescription, ExcludeAzureDeveloperCliCredential = true, ExcludeAzurePowerShellCredential = true, ExcludeInteractiveBrowserCredential = true, - ExcludeSharedTokenCacheCredential = true, ExcludeVisualStudioCodeCredential = true, ExcludeVisualStudioCredential = true }; diff --git a/src/Microsoft.Identity.Web.Certificate/Microsoft.Identity.Web.Certificate.csproj b/src/Microsoft.Identity.Web.Certificate/Microsoft.Identity.Web.Certificate.csproj index 6e523448b..017f6e4a7 100644 --- a/src/Microsoft.Identity.Web.Certificate/Microsoft.Identity.Web.Certificate.csproj +++ b/src/Microsoft.Identity.Web.Certificate/Microsoft.Identity.Web.Certificate.csproj @@ -18,7 +18,7 @@ - + diff --git a/src/Microsoft.Identity.Web.Certificateless/ManagedIdentityClientAssertion.cs b/src/Microsoft.Identity.Web.Certificateless/ManagedIdentityClientAssertion.cs index a049e3499..55ca81ff4 100644 --- a/src/Microsoft.Identity.Web.Certificateless/ManagedIdentityClientAssertion.cs +++ b/src/Microsoft.Identity.Web.Certificateless/ManagedIdentityClientAssertion.cs @@ -138,6 +138,11 @@ private void Log( string message, bool containsPii) { + if (_logger == null) + { + return; + } + switch (level) { case Client.LogLevel.Always: diff --git a/src/Microsoft.Identity.Web.Certificateless/Microsoft.Identity.Web.Certificateless.csproj b/src/Microsoft.Identity.Web.Certificateless/Microsoft.Identity.Web.Certificateless.csproj index 6ae20a75b..72c39b7c3 100644 --- a/src/Microsoft.Identity.Web.Certificateless/Microsoft.Identity.Web.Certificateless.csproj +++ b/src/Microsoft.Identity.Web.Certificateless/Microsoft.Identity.Web.Certificateless.csproj @@ -19,7 +19,7 @@ - + diff --git a/src/Microsoft.Identity.Web.DownstreamApi/DownstreamApi.cs b/src/Microsoft.Identity.Web.DownstreamApi/DownstreamApi.cs index 8d6e97b2f..4fbe5525c 100644 --- a/src/Microsoft.Identity.Web.DownstreamApi/DownstreamApi.cs +++ b/src/Microsoft.Identity.Web.DownstreamApi/DownstreamApi.cs @@ -604,7 +604,7 @@ public Task CallApiForAppAsync( // Otherwise use the default HttpClientFactory with optional named client. HttpClient client = requestResult?.BindingCertificate != null && _msalHttpClientFactory is IMsalMtlsHttpClientFactory msalMtlsHttpClientFactory ? msalMtlsHttpClientFactory.GetHttpClient(requestResult.BindingCertificate) - : (string.IsNullOrEmpty(serviceName) ? _httpClientFactory.CreateClient() : _httpClientFactory.CreateClient(serviceName)); + : (string.IsNullOrEmpty(serviceName) ? _httpClientFactory.CreateClient() : _httpClientFactory.CreateClient(serviceName!)); // Send the HTTP message downstreamApiResult = await client.SendAsync(httpRequestMessage, cancellationToken).ConfigureAwait(false); diff --git a/src/Microsoft.Identity.Web.OWIN/AppBuilderExtension.cs b/src/Microsoft.Identity.Web.OWIN/AppBuilderExtension.cs index 43612febd..458625bfa 100644 --- a/src/Microsoft.Identity.Web.OWIN/AppBuilderExtension.cs +++ b/src/Microsoft.Identity.Web.OWIN/AppBuilderExtension.cs @@ -62,10 +62,10 @@ public static IAppBuilder AddMicrosoftIdentityWebApi( configuration?.GetSection(configurationSection).Bind(option); })); - string instance = configuration.GetValue($"{configurationSection}:Instance"); - string tenantId = configuration.GetValue($"{configurationSection}:TenantId"); - string clientId = configuration.GetValue($"{configurationSection}:ClientId"); - string audience = configuration.GetValue($"{configurationSection}:Audience"); + string? instance = configuration.GetValue($"{configurationSection}:Instance"); + string? tenantId = configuration.GetValue($"{configurationSection}:TenantId"); + string? clientId = configuration.GetValue($"{configurationSection}:ClientId"); + string? audience = configuration.GetValue($"{configurationSection}:Audience"); string authority = instance + tenantId + "/v2.0"; TokenValidationParameters tokenValidationParameters = new() { @@ -121,10 +121,10 @@ public static IAppBuilder AddMicrosoftIdentityWebApp( configuration?.GetSection(configurationSection).Bind(option); })); - string instance = configuration.GetValue($"{configurationSection}:Instance"); - string tenantId = configuration.GetValue($"{configurationSection}:TenantId"); - string clientId = configuration.GetValue($"{configurationSection}:ClientId"); - string postLogoutRedirectUri = configuration.GetValue($"{configurationSection}:SignedOutCallbackPath"); + string? instance = configuration.GetValue($"{configurationSection}:Instance"); + string? tenantId = configuration.GetValue($"{configurationSection}:TenantId"); + string? clientId = configuration.GetValue($"{configurationSection}:ClientId"); + string? postLogoutRedirectUri = configuration.GetValue($"{configurationSection}:SignedOutCallbackPath"); string authority = instance + tenantId + "/v2.0"; OpenIdConnectAuthenticationOptions options = new() diff --git a/src/Microsoft.Identity.Web.OWIN/Microsoft.Identity.Web.OWIN.csproj b/src/Microsoft.Identity.Web.OWIN/Microsoft.Identity.Web.OWIN.csproj index 10156957c..a7c2d2a2b 100644 --- a/src/Microsoft.Identity.Web.OWIN/Microsoft.Identity.Web.OWIN.csproj +++ b/src/Microsoft.Identity.Web.OWIN/Microsoft.Identity.Web.OWIN.csproj @@ -23,8 +23,8 @@ - - + + @@ -48,5 +48,5 @@ - + diff --git a/src/Microsoft.Identity.Web.OWIN/OwinTokenAcquirerFactory.cs b/src/Microsoft.Identity.Web.OWIN/OwinTokenAcquirerFactory.cs index 1e6de0372..a6219c4af 100644 --- a/src/Microsoft.Identity.Web.OWIN/OwinTokenAcquirerFactory.cs +++ b/src/Microsoft.Identity.Web.OWIN/OwinTokenAcquirerFactory.cs @@ -25,15 +25,15 @@ public class OwinTokenAcquirerFactory : TokenAcquirerFactory /// protected override string DefineConfiguration(IConfigurationBuilder builder) { - _ = builder.AddInMemoryCollection(new Dictionary() + _ = builder.AddInMemoryCollection(new Dictionary() { - ["AzureAd:Instance"] = EnsureTrailingSlash(ConfigurationManager.AppSettings["ida:Instance"] ?? ConfigurationManager.AppSettings["ida:AADInstance"] ?? "https://login.microsoftonline.com/"), - ["AzureAd:ClientId"] = ConfigurationManager.AppSettings["ida:ClientId"], - ["AzureAd:TenantId"] = ConfigurationManager.AppSettings["ida:Tenant"] ?? ConfigurationManager.AppSettings["ida:TenantId"], - ["AzureAd:Audience"] = ConfigurationManager.AppSettings["ida:Audience"], - ["AzureAd:ClientSecret"] = ConfigurationManager.AppSettings["ida:ClientSecret"], - ["AzureAd:SignedOutCallbackPath"] = ConfigurationManager.AppSettings["ida:PostLogoutRedirectUri"], - ["AzureAd:RedirectUri"] = ConfigurationManager.AppSettings["ida:RedirectUri"], + ["AzureAd:Instance"] = EnsureTrailingSlash(System.Configuration.ConfigurationManager.AppSettings["ida:Instance"] ?? System.Configuration.ConfigurationManager.AppSettings["ida:AADInstance"] ?? "https://login.microsoftonline.com/"), + ["AzureAd:ClientId"] = System.Configuration.ConfigurationManager.AppSettings["ida:ClientId"], + ["AzureAd:TenantId"] = System.Configuration.ConfigurationManager.AppSettings["ida:Tenant"] ?? System.Configuration.ConfigurationManager.AppSettings["ida:TenantId"], + ["AzureAd:Audience"] = System.Configuration.ConfigurationManager.AppSettings["ida:Audience"], + ["AzureAd:ClientSecret"] = System.Configuration.ConfigurationManager.AppSettings["ida:ClientSecret"], + ["AzureAd:SignedOutCallbackPath"] = System.Configuration.ConfigurationManager.AppSettings["ida:PostLogoutRedirectUri"], + ["AzureAd:RedirectUri"] = System.Configuration.ConfigurationManager.AppSettings["ida:RedirectUri"], }); return HostingEnvironment.MapPath("~/"); diff --git a/src/Microsoft.Identity.Web.TokenAcquisition/Microsoft.Identity.Web.TokenAcquisition.csproj b/src/Microsoft.Identity.Web.TokenAcquisition/Microsoft.Identity.Web.TokenAcquisition.csproj index 99d0c76a6..8d99aad46 100644 --- a/src/Microsoft.Identity.Web.TokenAcquisition/Microsoft.Identity.Web.TokenAcquisition.csproj +++ b/src/Microsoft.Identity.Web.TokenAcquisition/Microsoft.Identity.Web.TokenAcquisition.csproj @@ -25,7 +25,7 @@ - + diff --git a/src/Microsoft.Identity.Web.TokenAcquisition/OptionsMergers/ConfidentialClientApplicationOptionsMerger.cs b/src/Microsoft.Identity.Web.TokenAcquisition/OptionsMergers/ConfidentialClientApplicationOptionsMerger.cs index 017748a51..41bcb2f2b 100644 --- a/src/Microsoft.Identity.Web.TokenAcquisition/OptionsMergers/ConfidentialClientApplicationOptionsMerger.cs +++ b/src/Microsoft.Identity.Web.TokenAcquisition/OptionsMergers/ConfidentialClientApplicationOptionsMerger.cs @@ -16,11 +16,7 @@ public ConfidentialClientApplicationOptionsMerger(IMergedOptionsStore mergedOpti private readonly IMergedOptionsStore _mergedOptionsMonitor; public void PostConfigure( -#if NET7_0_OR_GREATER string? name, -#else - string name, -#endif ConfidentialClientApplicationOptions options) { MergedOptions.UpdateMergedOptionsFromConfidentialClientApplicationOptions(options, _mergedOptionsMonitor.Get(name ?? string.Empty)); diff --git a/src/Microsoft.Identity.Web.TokenAcquisition/OptionsMergers/MicrosoftAuthenticationOptionsMerger.cs b/src/Microsoft.Identity.Web.TokenAcquisition/OptionsMergers/MicrosoftAuthenticationOptionsMerger.cs index f68f5f37f..e4a2ddc5c 100644 --- a/src/Microsoft.Identity.Web.TokenAcquisition/OptionsMergers/MicrosoftAuthenticationOptionsMerger.cs +++ b/src/Microsoft.Identity.Web.TokenAcquisition/OptionsMergers/MicrosoftAuthenticationOptionsMerger.cs @@ -21,11 +21,7 @@ public MicrosoftIdentityApplicationOptionsMerger(IMergedOptionsStore mergedOptio private readonly IMergedOptionsStore _mergedOptionsMonitor; public void PostConfigure( -#if NET7_0_OR_GREATER string? name, -#else - string name, -#endif MicrosoftIdentityApplicationOptions options) { MergedOptions.UpdateMergedOptionsFromMicrosoftIdentityApplicationOptions(options, _mergedOptionsMonitor.Get(name ?? string.Empty)); diff --git a/src/Microsoft.Identity.Web.TokenAcquisition/OptionsMergers/MicrosoftIdentityOptionsMerger.cs b/src/Microsoft.Identity.Web.TokenAcquisition/OptionsMergers/MicrosoftIdentityOptionsMerger.cs index e01729302..27d8b14ee 100644 --- a/src/Microsoft.Identity.Web.TokenAcquisition/OptionsMergers/MicrosoftIdentityOptionsMerger.cs +++ b/src/Microsoft.Identity.Web.TokenAcquisition/OptionsMergers/MicrosoftIdentityOptionsMerger.cs @@ -20,11 +20,7 @@ public MicrosoftIdentityOptionsMerger(IMergedOptionsStore mergedOptions) private readonly IMergedOptionsStore _mergedOptionsMonitor; public void PostConfigure( -#if NET7_0_OR_GREATER string? name, -#else - string name, -#endif MicrosoftIdentityOptions options) { MergedOptions.UpdateMergedOptionsFromMicrosoftIdentityOptions(options, _mergedOptionsMonitor.Get(name ?? string.Empty)); diff --git a/tests/Microsoft.Identity.Web.Test/CacheEncryptionTests.cs b/tests/Microsoft.Identity.Web.Test/CacheEncryptionTests.cs index 66a468ae4..7748f3c8b 100644 --- a/tests/Microsoft.Identity.Web.Test/CacheEncryptionTests.cs +++ b/tests/Microsoft.Identity.Web.Test/CacheEncryptionTests.cs @@ -51,7 +51,7 @@ public async Task EncryptionTestAsync(bool isEncrypted) private byte[] GetFirstCacheValue(MemoryCache memoryCache) { IDictionary memoryCacheContent; -# if NET6_0 || NET462 +# if NET6_0 memoryCacheContent = (memoryCache .GetType() .GetProperty("StringKeyEntriesCollection", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)! @@ -85,10 +85,15 @@ private byte[] GetFirstCacheValue(MemoryCache memoryCache) .GetField("_stringEntries", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic) .GetValue(content1) as IDictionary)!; #else - memoryCacheContent = (memoryCache + // MemoryCache 8.0.x on .NET Framework uses the same internal structure as net8.0 + dynamic content1 = memoryCache .GetType() - .GetField("_entries", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)! - .GetValue(_testCacheAdapter!._memoryCache) as IDictionary)!; + .GetField("_coherentState", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)! + .GetValue(memoryCache)!; + memoryCacheContent = (content1? + .GetType() + .GetField("_stringEntries", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic) + .GetValue(content1) as IDictionary)!; #endif // NET472 var firstEntry = memoryCacheContent.Values.OfType().First(); var firstEntryValue = firstEntry.GetType() diff --git a/tests/Microsoft.Identity.Web.Test/Microsoft.Identity.Web.Test.csproj b/tests/Microsoft.Identity.Web.Test/Microsoft.Identity.Web.Test.csproj index da7c39597..c097ddc28 100644 --- a/tests/Microsoft.Identity.Web.Test/Microsoft.Identity.Web.Test.csproj +++ b/tests/Microsoft.Identity.Web.Test/Microsoft.Identity.Web.Test.csproj @@ -40,8 +40,7 @@ - - +