Skip to content

Commit 48b002d

Browse files
Removal of ExperimentalFeatures flag on WithMtlsProofOfPossession API: (#5402)
exp flag remove Co-authored-by: Gladwin Johnson <[email protected]>
1 parent f3810f5 commit 48b002d

File tree

6 files changed

+8
-31
lines changed

6 files changed

+8
-31
lines changed

src/client/Microsoft.Identity.Client/ApiConfig/AcquireTokenForClientParameterBuilder.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,6 @@ public AcquireTokenForClientParameterBuilder WithSendX5C(bool withSendX5C)
9696
/// <returns>The current instance of <see cref="AcquireTokenForClientParameterBuilder"/> to enable method chaining.</returns>
9797
public AcquireTokenForClientParameterBuilder WithMtlsProofOfPossession()
9898
{
99-
ValidateUseOfExperimentalFeature();
100-
10199
if (ServiceBundle.Config.ClientCredential is not CertificateClientCredential certificateCredential)
102100
{
103101
throw new MsalClientException(

tests/Microsoft.Identity.Test.Integration.netcore/HeadlessTests/ClientCredentialsMtlsPopTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ public async Task Sni_Gets_Pop_Token_Successfully_TestAsync()
4040
.WithAuthority("https://login.microsoftonline.com/bea21ebe-8b64-4d06-9f6d-6a889b120a7c")
4141
.WithAzureRegion("westus3") //test slice region
4242
.WithCertificate(cert, true)
43-
.WithExperimentalFeatures()
4443
.WithTestLogging()
4544
.Build();
4645

tests/Microsoft.Identity.Test.Unit/ExceptionTests/ExperimentalFeatureTests.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
using System.Collections.Generic;
66
using System.Globalization;
77
using System.Linq;
8+
using System.Net.Http;
89
using System.Reflection;
910
using System.Text;
1011
using System.Threading.Tasks;
1112
using Microsoft.Identity.Client;
13+
using Microsoft.Identity.Client.AppConfig;
1214
using Microsoft.Identity.Test.Common.Core.Helpers;
1315
using Microsoft.VisualStudio.TestTools.UnitTesting;
1416

@@ -22,12 +24,16 @@ public class ExperimentalFeatureTests
2224
[TestMethod]
2325
public async Task ExperimentalFeatureExceptionAsync()
2426
{
27+
PoPAuthenticationConfiguration popConfig = new PoPAuthenticationConfiguration(new Uri("https://www.contoso.com/path1/path2?queryParam1=a&queryParam2=b"));
28+
popConfig.HttpMethod = HttpMethod.Get;
29+
2530
IConfidentialClientApplication cca = ConfidentialClientApplicationBuilder
2631
.Create(Guid.NewGuid().ToString())
2732
.WithCertificate(CertHelper.GetOrCreateTestCert()).Build();
2833

2934
MsalClientException ex = await AssertException.TaskThrowsAsync<MsalClientException>(
30-
() => cca.AcquireTokenForClient(s_scopes).WithMtlsProofOfPossession().ExecuteAsync())
35+
() => cca.AcquireTokenForClient(s_scopes)
36+
.WithSignedHttpRequestProofOfPossession(popConfig).ExecuteAsync())
3137
.ConfigureAwait(false);
3238

3339
Assert.AreEqual(MsalError.ExperimentalFeature, ex.ErrorCode);

tests/Microsoft.Identity.Test.Unit/ManagedIdentityTests/ManagedIdentityTests.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,6 @@ public async Task ManagedIdentityWithClaimsTestAsync(
369369
SetEnvironmentVariables(managedIdentitySource, endpoint);
370370

371371
var miBuilder = ManagedIdentityApplicationBuilder.Create(ManagedIdentityId.SystemAssigned)
372-
.WithExperimentalFeatures(true)
373372
.WithHttpManager(httpManager);
374373

375374
// Disabling shared cache options to avoid cross test pollution.
@@ -811,7 +810,6 @@ public async Task ManagedIdentityInvalidRefreshOnThrowsAsync()
811810
SetEnvironmentVariables(ManagedIdentitySource.AppService, AppServiceEndpoint);
812811

813812
var miBuilder = ManagedIdentityApplicationBuilder.Create(ManagedIdentityId.SystemAssigned)
814-
.WithExperimentalFeatures()
815813
.WithHttpManager(httpManager);
816814

817815
// Disabling shared cache options to avoid cross test pollution.

tests/Microsoft.Identity.Test.Unit/PublicApiTests/MtlsPopTests.cs

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ public async Task MtlsPop_AadAuthorityWithoutCertificateAsync()
5555
IConfidentialClientApplication app = ConfidentialClientApplicationBuilder
5656
.Create(TestConstants.ClientId)
5757
.WithAuthority("https://login.microsoftonline.com/123456-1234-2345-1234561234")
58-
.WithExperimentalFeatures()
5958
.Build();
6059

6160
MsalClientException ex = await AssertException.TaskThrowsAsync<MsalClientException>(() =>
@@ -74,7 +73,6 @@ public async Task MtlsPopWithoutCertificateAsync()
7473
IConfidentialClientApplication app = ConfidentialClientApplicationBuilder
7574
.Create(TestConstants.ClientId)
7675
.WithClientSecret(TestConstants.ClientSecret)
77-
.WithExperimentalFeatures()
7876
.Build();
7977

8078
// Set WithMtlsProofOfPossession on the request without a certificate
@@ -98,7 +96,6 @@ public async Task MtlsPopWithoutCertificateWithClientClaimsAsync()
9896
IConfidentialClientApplication app = ConfidentialClientApplicationBuilder
9997
.Create(TestConstants.ClientId)
10098
.WithClientClaims(s_testCertificate, ipAddress)
101-
.WithExperimentalFeatures()
10299
.Build();
103100

104101
// Expecting an exception because MTLS PoP requires a certificate to sign the claims
@@ -117,7 +114,6 @@ public async Task MtlsPopWithoutCertificateWithClientAssertionAsync()
117114
IConfidentialClientApplication app = ConfidentialClientApplicationBuilder
118115
.Create(TestConstants.ClientId)
119116
.WithClientAssertion(() => { return TestConstants.DefaultClientAssertion; })
120-
.WithExperimentalFeatures()
121117
.Build();
122118

123119
// Expecting an exception because MTLS PoP requires a certificate to sign the claims
@@ -146,7 +142,6 @@ public async Task MtlsPop_WithoutRegion_ThrowsException(bool setAzureRegion)
146142
.WithCertificate(s_testCertificate)
147143
// Setting Azure region to ConfidentialClientApplicationBuilder.DisableForceRegion overrides the AzureRegion to null.
148144
.WithAzureRegion(ConfidentialClientApplicationBuilder.DisableForceRegion)
149-
.WithExperimentalFeatures()
150145
.Build();
151146
}
152147
else
@@ -155,7 +150,6 @@ public async Task MtlsPop_WithoutRegion_ThrowsException(bool setAzureRegion)
155150
.Create(TestConstants.ClientId)
156151
.WithAuthority(TestConstants.AuthorityTenant)
157152
.WithCertificate(s_testCertificate)
158-
.WithExperimentalFeatures()
159153
.Build();
160154
}
161155

@@ -177,7 +171,6 @@ public async Task MtlsPop_WithUnsupportedNonTenantedAuthorityAsync_ThrowsExcepti
177171
IConfidentialClientApplication app = ConfidentialClientApplicationBuilder
178172
.Create(TestConstants.ClientId)
179173
.WithCertificate(s_testCertificate)
180-
.WithExperimentalFeatures()
181174
.Build();
182175

183176
// Set WithMtlsProofOfPossession on the request without specifying an authority
@@ -220,7 +213,7 @@ private static string ComputeExpectedKeyId(X509Certificate2 certificate)
220213
public void GetTokenRequestParams_ExpectedValues()
221214
{
222215
var scheme = new MtlsPopAuthenticationOperation(s_testCertificate);
223-
System.Collections.Generic.IReadOnlyDictionary<string, string> parameters = scheme.GetTokenRequestParams();
216+
IReadOnlyDictionary<string, string> parameters = scheme.GetTokenRequestParams();
224217

225218
Assert.AreEqual(Constants.MtlsPoPTokenType, parameters[OAuth2Parameter.TokenType]);
226219
}
@@ -248,7 +241,6 @@ public async Task AcquireTokenForClient_WithMtlsProofOfPossession_SuccessAsync()
248241
.WithCertificate(s_testCertificate)
249242
.WithAuthority($"https://login.microsoftonline.com/123456-1234-2345-1234561234")
250243
.WithAzureRegion(ConfidentialClientApplication.AttemptRegionDiscovery)
251-
.WithExperimentalFeatures()
252244
.WithHttpManager(httpManager)
253245
.BuildConcrete();
254246

@@ -308,7 +300,6 @@ public async Task AcquireMtlsPopTokenForClientWithTenantId_SuccessAsync()
308300
.WithCertificate(s_testCertificate)
309301
.WithTenantId("123456-1234-2345-1234561234")
310302
.WithAzureRegion(ConfidentialClientApplication.AttemptRegionDiscovery)
311-
.WithExperimentalFeatures()
312303
.WithHttpManager(httpManager)
313304
.BuildConcrete();
314305

@@ -355,7 +346,6 @@ public async Task MtlsPop_KnownRegionAsync()
355346
.WithAuthority(authorityUrl)
356347
.WithAzureRegion(region)
357348
.WithHttpManager(httpManager)
358-
.WithExperimentalFeatures()
359349
.BuildConcrete();
360350

361351
AuthenticationResult result = await app.AcquireTokenForClient(TestConstants.s_scope)
@@ -388,15 +378,13 @@ public async Task MtlsPop_RegionalTokenCacheInterchangeabilityAsync()
388378
.WithAzureRegion(region)
389379
.WithAuthority(authority)
390380
.WithHttpManager(httpManager)
391-
.WithExperimentalFeatures()
392381
.BuildConcrete();
393382

394383
IConfidentialClientApplication regionalApp2 = ConfidentialClientApplicationBuilder.Create(TestConstants.ClientId)
395384
.WithCertificate(s_testCertificate)
396385
.WithAzureRegion(region)
397386
.WithAuthority(authority)
398387
.WithHttpManager(httpManager)
399-
.WithExperimentalFeatures()
400388
.BuildConcrete();
401389

402390
var memoryTokenCache = new InMemoryTokenCache();
@@ -443,7 +431,6 @@ public async Task MtlsPop_ThrowsExceptionWhenRegionAutoDetectFailsAsync()
443431
.WithCertificate(s_testCertificate)
444432
.WithAuthority("https://login.microsoftonline.com/123456-1234-2345-1234561234")
445433
.WithAzureRegion(ConfidentialClientApplication.AttemptRegionDiscovery)
446-
.WithExperimentalFeatures()
447434
.WithHttpManager(httpManager)
448435
.BuildConcrete();
449436

@@ -471,7 +458,6 @@ public async Task MtlsPop_NonAadAuthorityAsync(string authorityUrl, string autho
471458
.Create(TestConstants.ClientId)
472459
.WithCertificate(s_testCertificate)
473460
.WithAuthority(authorityUrl)
474-
.WithExperimentalFeatures()
475461
.Build();
476462

477463
// Set WithMtlsProofOfPossession on the request with a non-AAD authority
@@ -510,7 +496,6 @@ public async Task MtlsPop_WithUnsupportedNonTenantedAuthorityAsync_ThrowsExcepti
510496
.WithCertificate(s_testCertificate)
511497
.WithAuthority($"{authorityUrl}/{nonTenantValue}")
512498
.WithAzureRegion(ConfidentialClientApplication.AttemptRegionDiscovery)
513-
.WithExperimentalFeatures()
514499
.WithHttpManager(httpManager)
515500
.BuildConcrete();
516501

@@ -567,7 +552,6 @@ public async Task MtlsPop_ValidateExpectedUrlAsync()
567552
.WithHttpManager(harness.HttpManager)
568553
.WithAzureRegion(ConfidentialClientApplication.AttemptRegionDiscovery)
569554
.WithCertificate(s_testCertificate)
570-
.WithExperimentalFeatures(true)
571555
.Build();
572556

573557
// Act
@@ -615,7 +599,6 @@ public async Task PublicAndSovereignCloud_UsesPreferredNetwork_AndNoDiscovery_As
615599
.WithHttpManager(harness.HttpManager)
616600
.WithAzureRegion(ConfidentialClientApplication.AttemptRegionDiscovery)
617601
.WithCertificate(s_testCertificate)
618-
.WithExperimentalFeatures(true)
619602
.Build();
620603

621604
AuthenticationResult result = await app
@@ -678,7 +661,6 @@ public async Task AcquireTokenForClient_WithMtlsPop_NonStandardCloudAsync()
678661
.WithAzureRegion(ConfidentialClientApplication.AttemptRegionDiscovery)
679662
.WithCertificate(s_testCertificate)
680663
.WithInstanceDiscovery(false)
681-
.WithExperimentalFeatures(true)
682664
.Build();
683665

684666
AuthenticationResult result = await app
@@ -727,7 +709,6 @@ public async Task AcquireTokenForClient_WithMtlsPop_Dsts_SuccessAsync()
727709
var app = ConfidentialClientApplicationBuilder.Create(TestConstants.ClientId)
728710
.WithCertificate(s_testCertificate)
729711
.WithAuthority(authorityUrl)
730-
.WithExperimentalFeatures()
731712
.WithHttpManager(httpManager)
732713
.BuildConcrete();
733714

@@ -763,7 +744,6 @@ public async Task MtlsPop_WithUnsupportedNonTenantedAuthorityAsyncForDsts_Throws
763744
.Create(TestConstants.ClientId)
764745
.WithAuthority(authorityUrl)
765746
.WithCertificate(s_testCertificate)
766-
.WithExperimentalFeatures()
767747
.Build();
768748

769749
// Set WithMtlsProofOfPossession on the request specifying an authority
@@ -793,7 +773,6 @@ public async Task BindingCertificate_PopulatedForMtlsPop_AndNullForBearerAsync()
793773
.WithCertificate(s_testCertificate)
794774
.WithAuthority("https://login.microsoftonline.com/123456-1234-2345-1234561234")
795775
.WithAzureRegion(ConfidentialClientApplication.AttemptRegionDiscovery)
796-
.WithExperimentalFeatures()
797776
.WithHttpManager(httpManager)
798777
.BuildConcrete();
799778

tests/devapps/NetCoreTestApp/Program.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -437,9 +437,6 @@ private static IConfidentialClientApplication CreateCcaForMtlsPop(string region)
437437

438438
ccaBuilder = ccaBuilder.WithCertificate(s_confidentialClientCertificate, true);
439439

440-
//Add Experimental feature for MTLS PoP
441-
ccaBuilder = ccaBuilder.WithExperimentalFeatures();
442-
443440
IConfidentialClientApplication ccapp = ccaBuilder.Build();
444441

445442
// Optionally set cache settings or other configurations if needed

0 commit comments

Comments
 (0)