Skip to content

Commit

Permalink
Bump to MSAL 4.64.1 (#3017)
Browse files Browse the repository at this point in the history
* Bump MSAL to 4.64.1

* 2
  • Loading branch information
bgavrilMS authored Sep 19, 2024
1 parent 711234c commit 96e9735
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 80 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -353,4 +353,5 @@ MigrationBackup/

# Playwright e2e testing trace files
/tests/E2E Tests/PlaywrightTraces
/tests/IntegrationTests/PlaywrightTraces
/tests/IntegrationTests/PlaywrightTraces
/.SharedData
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@

<PropertyGroup Label="Common dependency versions">
<MicrosoftIdentityModelVersion Condition="'$(MicrosoftIdentityModelVersion)' == ''">8.0.2</MicrosoftIdentityModelVersion>
<MicrosoftIdentityClientVersion Condition="'$(MicrosoftIdentityClientVersion)' == ''">4.61.3</MicrosoftIdentityClientVersion>
<MicrosoftIdentityClientVersion Condition="'$(MicrosoftIdentityClientVersion)' == ''">4.64.1</MicrosoftIdentityClientVersion>
<FxCopAnalyzersVersion>3.3.0</FxCopAnalyzersVersion>
<SystemTextEncodingsWebVersion>4.7.2</SystemTextEncodingsWebVersion>
<AzureSecurityKeyVaultSecretsVersion>4.6.0</AzureSecurityKeyVaultSecretsVersion>
Expand Down
33 changes: 14 additions & 19 deletions tests/Microsoft.Identity.Web.Test/CacheExtensionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,42 +33,40 @@ public void InMemoryCacheExtensionsTests()
public async Task CacheExtensions_CcaAlreadyExists_TestsAsync()
{
AuthenticationResult result;
TestTelemetryClient testTelemetryClient = new TestTelemetryClient(TestConstants.ClientId);
// new InMemory serializer and new cca
result = await CreateAppAndGetTokenAsync(CacheType.InMemory, testTelemetryClient).ConfigureAwait(false);
result = await CreateAppAndGetTokenAsync(CacheType.InMemory).ConfigureAwait(false);
Assert.Equal(TokenSource.IdentityProvider, result.AuthenticationResultMetadata.TokenSource);
AssertCacheTelemetry(testTelemetryClient, CacheLevel.None);
AssertCacheTelemetry(result, CacheLevel.None);

result = await CreateAppAndGetTokenAsync(CacheType.InMemory, testTelemetryClient, addTokenMock: false).ConfigureAwait(false);
result = await CreateAppAndGetTokenAsync(CacheType.InMemory, addTokenMock: false).ConfigureAwait(false);
Assert.Equal(TokenSource.Cache, result.AuthenticationResultMetadata.TokenSource);
AssertCacheTelemetry(testTelemetryClient, CacheLevel.L1Cache);
AssertCacheTelemetry(result, CacheLevel.L1Cache);

//Resetting token caches due to potential collision with other tests
TokenCacheExtensions.s_serviceProviderFromAction.Clear();

// new DistributedInMemory and same cca
result = await CreateAppAndGetTokenAsync(CacheType.DistributedInMemory, testTelemetryClient).ConfigureAwait(false);
result = await CreateAppAndGetTokenAsync(CacheType.DistributedInMemory).ConfigureAwait(false);
Assert.Equal(TokenSource.IdentityProvider, result.AuthenticationResultMetadata.TokenSource);
AssertCacheTelemetry(testTelemetryClient, CacheLevel.None);
AssertCacheTelemetry(result, CacheLevel.None);

result = await CreateAppAndGetTokenAsync(CacheType.DistributedInMemory, testTelemetryClient, addTokenMock: false).ConfigureAwait(false);
result = await CreateAppAndGetTokenAsync(CacheType.DistributedInMemory, addTokenMock: false).ConfigureAwait(false);
Assert.Equal(TokenSource.Cache, result.AuthenticationResultMetadata.TokenSource);
AssertCacheTelemetry(testTelemetryClient, CacheLevel.L1Cache);
AssertCacheTelemetry(result, CacheLevel.L1Cache);
}

[Fact]
public async Task CacheExtensions_CcaAlreadyExistsL2_TestsAsync()
{
AuthenticationResult result;
TestTelemetryClient testTelemetryClient = new TestTelemetryClient(TestConstants.ClientId);
// new DistributedInMemory serializer with L1 cache disabled
result = await CreateAppAndGetTokenAsync(CacheType.DistributedInMemory, testTelemetryClient, disableL1Cache: true).ConfigureAwait(false);
result = await CreateAppAndGetTokenAsync(CacheType.DistributedInMemory, disableL1Cache: true).ConfigureAwait(false);
Assert.Equal(TokenSource.IdentityProvider, result.AuthenticationResultMetadata.TokenSource);
AssertCacheTelemetry(testTelemetryClient, CacheLevel.None);
AssertCacheTelemetry(result, CacheLevel.None);

result = await CreateAppAndGetTokenAsync(CacheType.DistributedInMemory, testTelemetryClient, addTokenMock: false, disableL1Cache: true).ConfigureAwait(false);
result = await CreateAppAndGetTokenAsync(CacheType.DistributedInMemory, addTokenMock: false, disableL1Cache: true).ConfigureAwait(false);
Assert.Equal(TokenSource.Cache, result.AuthenticationResultMetadata.TokenSource);
AssertCacheTelemetry(testTelemetryClient, CacheLevel.L2Cache);
AssertCacheTelemetry(result, CacheLevel.L2Cache);
}

[Fact]
Expand Down Expand Up @@ -200,7 +198,6 @@ private enum CacheType

private static async Task<AuthenticationResult> CreateAppAndGetTokenAsync(
CacheType cacheType,
ITelemetryClient telemetryClient,
bool addTokenMock = true,
bool disableL1Cache = false)
{
Expand All @@ -221,7 +218,6 @@ private static async Task<AuthenticationResult> CreateAppAndGetTokenAsync(
.WithAuthority(TestConstants.AuthorityCommonTenant)
.WithHttpClientFactory(mockHttp)
.WithClientSecret(TestConstants.ClientSecret)
.WithTelemetryClient(telemetryClient)
.Build();

switch (cacheType)
Expand Down Expand Up @@ -255,10 +251,9 @@ private static async Task<AuthenticationResult> CreateAppAndGetTokenAsync(
return result;
}

private void AssertCacheTelemetry(TestTelemetryClient testTelemetryClient, CacheLevel cacheLevel)
private void AssertCacheTelemetry(AuthenticationResult result, CacheLevel expectedCacheLevel)
{
TelemetryEventDetails eventDetails = testTelemetryClient.TestTelemetryEventDetails;
Assert.Equal(Convert.ToInt64(cacheLevel, new CultureInfo("en-US")), eventDetails.Properties["CacheLevel"]);
Assert.Equal(result.AuthenticationResultMetadata.CacheLevel, expectedCacheLevel);
}

private IConfidentialClientApplication CreateCca() =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
<Compile Include="Certificates\DefaultCertificateLoaderTests.cs" />
<Compile Include="CacheExtensionsTests.cs" />
<Compile Include="CacheEncryptionTests.cs" />
<Compile Include="TestTelemetryClient.cs" />
<Compile Include="TestDistributedCache.cs" />
</ItemGroup>

Expand Down
58 changes: 0 additions & 58 deletions tests/Microsoft.Identity.Web.Test/TestTelemetryClient.cs

This file was deleted.

0 comments on commit 96e9735

Please sign in to comment.