Skip to content

Commit b66ccb3

Browse files
authored
Upgrade MSAL to the latest version (Azure#25974)
* update MSAL
1 parent 8c54268 commit b66ccb3

10 files changed

+7
-34
lines changed

eng/Packages.Data.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@
9898

9999
<!-- Other approved packages -->
100100
<PackageReference Update="Microsoft.Azure.Amqp" Version="2.5.8" />
101-
<PackageReference Update="Microsoft.Identity.Client" Version="4.30.1" />
102-
<PackageReference Update="Microsoft.Identity.Client.Extensions.Msal" Version="2.18.4" />
101+
<PackageReference Update="Microsoft.Identity.Client" Version="4.39.0" />
102+
<PackageReference Update="Microsoft.Identity.Client.Extensions.Msal" Version="2.19.3" />
103103

104104
<!-- TODO: Make sure this package is arch-board approved -->
105105
<PackageReference Update="System.IdentityModel.Tokens.Jwt" Version="5.4.0" />

sdk/identity/Azure.Identity/tests/ClientCertificateCredentialLiveTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ public ClientCertificateCredentialLiveTests(bool isAsync) : base(isAsync, useLeg
2222
public void ClearDiscoveryCache()
2323
{
2424
StaticCachesUtilities.ClearStaticMetadataProviderCache();
25-
StaticCachesUtilities.ClearAuthorityEndpointResolutionManagerCache();
2625
}
2726

2827
[TestCase(true)]

sdk/identity/Azure.Identity/tests/ClientSecretCredentialLiveTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ public ClientSecretCredentialLiveTests(bool isAsync) : base(isAsync, useLegacyTr
2121
public void ClearDiscoveryCache()
2222
{
2323
StaticCachesUtilities.ClearStaticMetadataProviderCache();
24-
StaticCachesUtilities.ClearAuthorityEndpointResolutionManagerCache();
2524
}
2625

2726
[Test]

sdk/identity/Azure.Identity/tests/CredentialTestHelpers.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ public static async Task<string> GetRefreshTokenAsync(IdentityTestEnvironment te
148148
await client.AcquireTokenByUsernamePassword(new[] { testEnvironment.KeyvaultScope }, username, password.ToSecureString()).ExecuteAsync();
149149

150150
StaticCachesUtilities.ClearStaticMetadataProviderCache();
151-
StaticCachesUtilities.ClearAuthorityEndpointResolutionManagerCache();
152151
return retriever.RefreshToken;
153152
}
154153

sdk/identity/Azure.Identity/tests/IdentityRecordedTestBase.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ private void InitialzeRecordingSettings()
2929
// x-ms-PKeyAuth is only added on MAC and Linux so recordings made on windows will fail on these platforms and vice-versa
3030
// ignoring this header as CI must run on all platforms
3131
Matcher.LegacyExcludedHeaders.Add("x-ms-PKeyAuth");
32+
Matcher.LegacyExcludedHeaders.Add("x-client-current-telemetry");
33+
Matcher.LegacyExcludedHeaders.Add("x-client-last-telemetry");
34+
Matcher.LegacyExcludedHeaders.Add("x-anchormailbox");
3235
Sanitizer = new IdentityRecordedTestSanitizer();
3336
}
3437
}

sdk/identity/Azure.Identity/tests/ManagedIdentityCredentialFederatedTokenLiveTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ public ManagedIdentityCredentialFederatedTokenLiveTests(bool isAsync) : base(isA
2626
public void ClearDiscoveryCache()
2727
{
2828
StaticCachesUtilities.ClearStaticMetadataProviderCache();
29-
StaticCachesUtilities.ClearAuthorityEndpointResolutionManagerCache();
3029
}
3130

3231
[NonParallelizable]

sdk/identity/Azure.Identity/tests/StaticCachesUtilities.cs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,6 @@ internal static class StaticCachesUtilities
1919
MethodCallExpression invokeClear = Expression.Call(callConstructor, clearMethod);
2020
return Expression.Lambda<Action>(invokeClear).Compile();
2121
});
22-
23-
private static readonly Lazy<Action> s_clearAuthorityEndpointResolutionManager = new Lazy<Action>(() =>
24-
{
25-
var assembly = typeof(PublicClientApplication).Assembly;
26-
Type authorityEndpointResolutionManagerType = assembly.GetType("Microsoft.Identity.Client.Instance.AuthorityResolutionManager", true);
27-
Type iServiceBundleType = assembly.GetType("Microsoft.Identity.Client.Internal.IServiceBundle", true);
28-
Type booleanType = typeof(bool);
29-
30-
ConstructorInfo[] constructors = authorityEndpointResolutionManagerType.GetConstructors(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
31-
foreach (ConstructorInfo constructor in constructors)
32-
{
33-
var parameters = constructor.GetParameters();
34-
if (parameters.Length == 1 && parameters[0].ParameterType == booleanType)
35-
{
36-
NewExpression callConstructor = Expression.New(constructor, Expression.Constant(true, booleanType));
37-
return Expression.Lambda<Action>(callConstructor).Compile();
38-
}
39-
}
40-
41-
throw new InvalidOperationException("Constructor wasn't found");
42-
});
43-
4422
public static void ClearStaticMetadataProviderCache() => s_clearStaticMetadataProvider.Value();
45-
public static void ClearAuthorityEndpointResolutionManagerCache() => s_clearAuthorityEndpointResolutionManager.Value();
4623
}
4724
}

sdk/identity/Azure.Identity/tests/TokenCacheTests.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -424,9 +424,7 @@ public async Task UnsafeOptions()
424424

425425
private static TokenCacheNotificationArgs GetMockArgs(Mock<ITokenCacheSerializer> mockSerializer, bool hasStateChanged)
426426
{
427-
TokenCacheNotificationArgs mockArgs = (TokenCacheNotificationArgs)FormatterServices.GetUninitializedObject(typeof(TokenCacheNotificationArgs));
428-
var ctor = typeof(TokenCacheNotificationArgs).GetConstructors(BindingFlags.NonPublic | BindingFlags.Instance);
429-
mockArgs = (TokenCacheNotificationArgs)ctor[0].Invoke(new object[] { mockSerializer.Object, "foo", null, hasStateChanged, true, true, null });
427+
var mockArgs = new TokenCacheNotificationArgs(mockSerializer.Object, "foo", null, hasStateChanged, true, "key", true, null, default );
430428
return mockArgs;
431429
}
432430

sdk/identity/Azure.Identity/tests/TokenCredentialOptionsTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public void EnviornmentSpecifiedNonHttpsAuthorityHostFails()
9393
{
9494
Assert.Throws<ArgumentException>(() => new ClientCertificateCredential(tenantId, clientId, certificatePath, new ClientCertificateCredentialOptions()));
9595
Assert.Throws<ArgumentException>(() => new ClientSecretCredential(tenantId, clientId, password, new TokenCredentialOptions()));
96-
Assert.Throws<ArgumentException>(() => new DefaultAzureCredential(new DefaultAzureCredentialOptions()));
96+
Assert.Throws(Is.TypeOf<ArgumentException>().Or.TypeOf<TypeInitializationException>(), () => new DefaultAzureCredential(new DefaultAzureCredentialOptions()));
9797
Assert.Throws<ArgumentException>(() => new DeviceCodeCredential(new DeviceCodeCredentialOptions()));
9898
Assert.Throws<ArgumentException>(() => new InteractiveBrowserCredential(new InteractiveBrowserCredentialOptions()));
9999
Assert.Throws<ArgumentException>(() => new SharedTokenCacheCredential(new SharedTokenCacheCredentialOptions()));

sdk/identity/Azure.Identity/tests/UsernamePasswordCredentialLiveTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ public UsernamePasswordCredentialLiveTests(bool isAsync) : base(isAsync, useLega
5050
public void ClearDiscoveryCache()
5151
{
5252
StaticCachesUtilities.ClearStaticMetadataProviderCache();
53-
StaticCachesUtilities.ClearAuthorityEndpointResolutionManagerCache();
5453
}
5554

5655
// !!!!!! WARNING !!!!!

0 commit comments

Comments
 (0)