Skip to content

Commit 520ef2b

Browse files
authored
Update regional tests. (#4378)
1 parent 7696e10 commit 520ef2b

File tree

3 files changed

+5
-25
lines changed

3 files changed

+5
-25
lines changed

tests/Microsoft.Identity.Test.Integration.netfx/HeadlessTests/ClientCredentialsTests.WithRegion.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,8 @@
77
using System.Linq;
88
using System.Net;
99
using System.Net.Http;
10-
using System.Security.Cryptography.X509Certificates;
1110
using System.Threading.Tasks;
1211
using Microsoft.Identity.Client;
13-
using Microsoft.Identity.Client.Cache;
14-
using Microsoft.Identity.Client.Internal;
1512
using Microsoft.Identity.Client.PlatformsCommon.Factories;
1613
#if NET_CORE
1714
using Microsoft.Identity.Client.PlatformsCommon.Shared;
@@ -31,10 +28,6 @@ namespace Microsoft.Identity.Test.Integration.HeadlessTests
3128
public class RegionalAuthIntegrationTests
3229
{
3330
private KeyVaultSecretsProvider _keyVault;
34-
private Dictionary<string, string> _dict = new Dictionary<string, string>
35-
{
36-
["allowestsrnonmsi"] = "true"
37-
};
3831

3932
private const string RegionalHost = "centralus.login.microsoft.com";
4033
private const string GlobalHost = "login.microsoftonline.com";
@@ -158,7 +151,6 @@ private async Task<AuthenticationResult> GetAuthenticationResultAsync(
158151
bool withForceRefresh = false)
159152
{
160153
var result = await _confidentialClientApplication.AcquireTokenForClient(scope)
161-
.WithExtraQueryParameters(_dict)
162154
.WithForceRefresh(withForceRefresh)
163155
.ExecuteAsync()
164156
.ConfigureAwait(false);
@@ -199,8 +191,8 @@ private static string GetSignedClientAssertionUsingMsalInternal(string clientId,
199191
var manager = PlatformProxyFactory.CreatePlatformProxy(null).CryptographyManager;
200192

201193
var jwtToken = new Client.Internal.JsonWebToken(manager, clientId, TestConstants.ClientCredentialAudience, claims);
202-
var cert = ConfidentialAppSettings.GetSettings(Cloud.Public).GetCertificate();
203-
194+
var cert = ConfidentialAppSettings.GetSettings(Cloud.Public).GetCertificate();
195+
204196
return jwtToken.Sign(cert, Base64UrlHelpers.Encode(cert.GetCertHash()), true);
205197
}
206198
}

tests/Microsoft.Identity.Test.Integration.netfx/HeadlessTests/OnBehalfOfTests.cs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ public async Task WithMultipleUsers_TestAsync()
241241
public async Task ArlingtonWebAPIAccessingGraphOnBehalfOfUserTestAsync()
242242
{
243243
var arligntonUser = (await LabUserHelper.GetArlingtonUserAsync().ConfigureAwait(false)).User;
244-
244+
245245
var msalPublicClient = PublicClientApplicationBuilder.Create("cb7faed4-b8c0-49ee-b421-f5ed16894c83")
246246
.WithAuthority("https://login.microsoftonline.us/organizations")
247247
.WithRedirectUri(TestConstants.RedirectUri)
@@ -417,7 +417,7 @@ private async Task<IConfidentialClientApplication> RunOnBehalfOfTestAsync(
417417
.WithTestLogging()
418418
.Build();
419419
s_inMemoryTokenCache.Bind(pca.UserTokenCache);
420-
420+
421421
try
422422
{
423423
authResult = await pca
@@ -498,11 +498,7 @@ private ConfidentialClientApplication BuildCca(string tenantId, bool withRegion
498498
if (withRegion)
499499
{
500500
builder
501-
.WithAzureRegion(TestConstants.Region)
502-
.WithExtraQueryParameters(new Dictionary<string, string>
503-
{
504-
["allowestsrnonmsi"] = "true" // allow regional for testing
505-
});
501+
.WithAzureRegion(TestConstants.Region);
506502
}
507503

508504
return builder.BuildConcrete();

tests/devapps/RegionalTestApp/Program.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
// Licensed under the MIT License.
33

44
using System;
5-
using System.Collections.Generic;
65
using System.Threading.Tasks;
7-
using Microsoft.Identity.Client;
8-
using Microsoft.Identity.Test.Integration.NetFx.Infrastructure;
96

107
/**
118
* Note: Restart the application between the test cases to clear the statics.
@@ -174,10 +171,6 @@ private static async Task AcquireTokenAsync(string region, bool setEnvVariable =
174171
}
175172

176173
string[] scopes = new string[] { $"{s_appSettings.ClientId}/.default", };
177-
Dictionary<string, string> dict = new Dictionary<string, string>
178-
{
179-
["allowestsrnonmsi"] = "true"
180-
};
181174

182175
var builder = ConfidentialClientApplicationBuilder.Create(s_appSettings.ClientId)
183176
.WithAuthority(s_appSettings.Authority, false)
@@ -195,7 +188,6 @@ private static async Task AcquireTokenAsync(string region, bool setEnvVariable =
195188
Console.WriteLine($"CCA created. Is regional:{region}, Set env var:{setEnvVariable}.");
196189

197190
AuthenticationResult result = await cca.AcquireTokenForClient(scopes)
198-
.WithExtraQueryParameters(dict)
199191
.ExecuteAsync()
200192
.ConfigureAwait(false);
201193

0 commit comments

Comments
 (0)