Skip to content

Commit b734011

Browse files
authored
Upgrade MSAL and MSAL extesion library dependencies to latest (Azure#20922)
* Upgrade MSAL and MSAL extesion library dependencies to latest * exclude x-ms-PKeyAuth from record matching
1 parent f863d37 commit b734011

File tree

60 files changed

+2053
-1906
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+2053
-1906
lines changed

eng/Packages.Data.props

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

9090
<!-- Other approved packages -->
9191
<PackageReference Update="Microsoft.Azure.Amqp" Version="2.4.13" />
92-
<PackageReference Update="Microsoft.Identity.Client" Version="4.23.0" />
93-
<PackageReference Update="Microsoft.Identity.Client.Extensions.Msal" Version="2.16.6" />
92+
<PackageReference Update="Microsoft.Identity.Client" Version="4.30.1" />
93+
<PackageReference Update="Microsoft.Identity.Client.Extensions.Msal" Version="2.18.4" />
9494
<!-- TODO: Make sure this package is arch-board approved -->
9595
<PackageReference Update="System.IdentityModel.Tokens.Jwt" Version="5.4.0" />
9696

sdk/identity/Azure.Identity/src/MsalCacheHelperWrapper.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,6 @@ public virtual void UnregisterCache(ITokenCache tokenCache)
6363
_helper.UnregisterCache(tokenCache);
6464
}
6565

66-
/// <summary>
67-
/// Clears the token store.
68-
/// </summary>
69-
public virtual void Clear()
70-
{
71-
_helper.Clear();
72-
}
73-
7466
/// <summary>
7567
/// Extracts the token cache data from the persistent store
7668
/// </summary>

sdk/identity/Azure.Identity/src/TokenCache.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ internal class TokenCache
2424
private DateTimeOffset _lastUpdated;
2525
private ConditionalWeakTable<object, CacheTimestamp> _cacheAccessMap;
2626
internal Func<IPublicClientApplication> _publicClientApplicationFactory;
27-
// we are creating the MsalCacheHelper with a random guid based clientId to work around issue https://github.com/AzureAD/microsoft-authentication-extensions-for-dotnet/issues/98
28-
// This does not impact the functionality of the cacheHelper as the ClientId is only used to iterate accounts in the cache not for authentication purposes.
29-
internal static readonly string s_msalCacheClientId = Guid.NewGuid().ToString();
3027
private readonly bool _allowUnencryptedStorage;
3128
private readonly string _name;
3229
private readonly bool _persistToDisk;
@@ -252,7 +249,7 @@ private async Task<MsalCacheHelperWrapper> GetCacheHelperAsync(bool async, Cance
252249

253250
private async Task<MsalCacheHelperWrapper> GetProtectedCacheHelperAsync(bool async, string name)
254251
{
255-
StorageCreationProperties storageProperties = new StorageCreationPropertiesBuilder(name, Constants.DefaultMsalTokenCacheDirectory, s_msalCacheClientId)
252+
StorageCreationProperties storageProperties = new StorageCreationPropertiesBuilder(name, Constants.DefaultMsalTokenCacheDirectory)
256253
.WithMacKeyChain(Constants.DefaultMsalTokenCacheKeychainService, name)
257254
.WithLinuxKeyring(Constants.DefaultMsalTokenCacheKeyringSchema, Constants.DefaultMsalTokenCacheKeyringCollection, name, Constants.DefaultMsaltokenCacheKeyringAttribute1, Constants.DefaultMsaltokenCacheKeyringAttribute2)
258255
.Build();
@@ -264,7 +261,7 @@ private async Task<MsalCacheHelperWrapper> GetProtectedCacheHelperAsync(bool asy
264261

265262
private async Task<MsalCacheHelperWrapper> GetFallbackCacheHelperAsync(bool async, string name = Constants.DefaultMsalTokenCacheName)
266263
{
267-
StorageCreationProperties storageProperties = new StorageCreationPropertiesBuilder(name, Constants.DefaultMsalTokenCacheDirectory, s_msalCacheClientId)
264+
StorageCreationProperties storageProperties = new StorageCreationPropertiesBuilder(name, Constants.DefaultMsalTokenCacheDirectory)
268265
.WithMacKeyChain(Constants.DefaultMsalTokenCacheKeychainService, name)
269266
.WithLinuxUnprotectedFile()
270267
.Build();

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@ public async Task GetToken()
4848

4949
Assert.AreEqual(token.Token, cachedToken.Token);
5050

51+
var options2 = InstrumentClientOptions(new ClientSecretCredentialOptions());
52+
5153
// ensure new credentials don't share tokens from the cache
52-
var credential2 = new ClientSecretCredential(tenantId, clientId, secret, options);
54+
var credential2 = new ClientSecretCredential(tenantId, clientId, secret, options2);
5355

5456
AccessToken token2 = await credential2.GetTokenAsync(tokenRequestContext);
5557

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ private void InitialzeRecordingSettings()
2626
Matcher.LegacyExcludedHeaders.Add("x-client-SKU");
2727
Matcher.LegacyExcludedHeaders.Add("x-client-CPU");
2828
Matcher.LegacyExcludedHeaders.Add("x-client-Ver");
29+
// x-ms-PKeyAuth is only added on MAC and Linux so recordings made on windows will fail on these platforms and vice-versa
30+
// ignoring this header as CI must run on all platforms
31+
Matcher.LegacyExcludedHeaders.Add("x-ms-PKeyAuth");
2932
Sanitizer = new IdentityRecordedTestSanitizer();
3033
}
3134
}

sdk/identity/Azure.Identity/tests/SessionRecords/ClientCertificateCredentialLiveTests/FromCertificatePath(False).json

Lines changed: 53 additions & 50 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)