Skip to content

Commit

Permalink
Mark WithSignedHttpRequestProofOfPossession as experimental (#5047)
Browse files Browse the repository at this point in the history
shr pop exp

Co-authored-by: Gladwin Johnson <[email protected]>
  • Loading branch information
gladjohn and GladwinJohnson authored Jan 4, 2025
1 parent 0da69c9 commit 4bce221
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ public T WithProofOfPossession(PoPAuthenticationConfiguration popAuthenticationC
/// </remarks>
public T WithSignedHttpRequestProofOfPossession(PoPAuthenticationConfiguration popAuthenticationConfiguration)
{
ValidateUseOfExperimentalFeature();

CommonParameters.PopAuthenticationConfiguration = popAuthenticationConfiguration ?? throw new ArgumentNullException(nameof(popAuthenticationConfiguration));

CommonParameters.AuthenticationOperation = new PopAuthenticationOperation(CommonParameters.PopAuthenticationConfiguration, ServiceBundle);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public async Task HappyPath_Async()
.Create(settings.ClientId)
.WithAuthority(settings.Authority)
.WithClientSecret(settings.GetSecret())
.WithExperimentalFeatures(true)
.WithTestLogging()
.Build();

Expand Down Expand Up @@ -107,6 +108,7 @@ private async Task BearerAndPoP_CanCoexist_Async()
var cca = ConfidentialClientApplicationBuilder
.Create(settings.ClientId)
.WithClientSecret(settings.GetSecret())
.WithExperimentalFeatures(true)
.WithTestLogging()
.WithAuthority(settings.Authority).Build();
ConfigureInMemoryCache(cca);
Expand Down Expand Up @@ -155,7 +157,9 @@ private async Task MultipleKeys_Async()
var cca = ConfidentialClientApplicationBuilder.Create(settings.ClientId)
.WithTestLogging()
.WithAuthority(settings.Authority)
.WithClientSecret(settings.GetSecret()).Build();
.WithClientSecret(settings.GetSecret())
.WithExperimentalFeatures(true)
.Build();
ConfigureInMemoryCache(cca);

var result = await cca
Expand All @@ -176,6 +180,7 @@ private async Task MultipleKeys_Async()
.Create(settings.ClientId)
.WithAuthority(settings.Authority)
.WithClientSecret(settings.GetSecret())
.WithExperimentalFeatures(true)
.WithHttpClientFactory(new NoAccessHttpClientFactory()) // token should be served from the cache, no network access necessary
.Build();
ConfigureInMemoryCache(cca);
Expand Down Expand Up @@ -221,6 +226,7 @@ public async Task PopTestWithConfigObjectAsync()
.Create(settings.ClientId)
.WithAuthority(settings.Authority)
.WithClientSecret(settings.GetSecret())
.WithExperimentalFeatures(true)
.WithTestLogging()
.Build();

Expand Down Expand Up @@ -257,6 +263,7 @@ public async Task PopTestWithRSAAsync()
.Create(settings.ClientId)
.WithAuthority(settings.Authority)
.WithClientSecret(settings.GetSecret())
.WithExperimentalFeatures(true)
.Build();

//RSA provider
Expand Down Expand Up @@ -294,6 +301,7 @@ public async Task ROPC_PopTestWithRSAAsync()
.Create(settings.ClientId)
.WithAuthority(settings.Authority)
.WithClientSecret(settings.GetSecret())
.WithExperimentalFeatures(true)
.Build();

//RSA provider
Expand Down Expand Up @@ -324,6 +332,7 @@ public async Task PopTest_ExternalWilsonSigning_Async()
.Create(settings.ClientId)
.WithAuthority(settings.Authority)
.WithClientSecret(settings.GetSecret())
.WithExperimentalFeatures(true)
.Build();

// Create an RSA key Wilson style (SigningCredentials)
Expand Down Expand Up @@ -389,6 +398,7 @@ public async Task PopTestWithECDAsync()
.Create(settings.ClientId)
.WithAuthority(settings.Authority)
.WithClientSecret(settings.GetSecret())
.WithExperimentalFeatures(true)
.Build();

//ECD Provider
Expand Down Expand Up @@ -520,6 +530,7 @@ public async Task InMemoryCryptoProvider_AlgIsPS256()
.Create(settings.ClientId)
.WithAuthority(settings.Authority)
.WithClientSecret(settings.GetSecret())
.WithExperimentalFeatures(true)
.Build();

// Create a new InMemoryCryptoProvider and get its JWK
Expand Down Expand Up @@ -572,6 +583,7 @@ public async Task InMemoryCryptoProvider_WithGraph()
.Create(settings.ClientId)
.WithAuthority(settings.Authority)
.WithClientSecret(settings.GetSecret())
.WithExperimentalFeatures(true)
.Build();

// Create a new InMemoryCryptoProvider and get its JWK
Expand Down Expand Up @@ -659,6 +671,7 @@ public async Task PoPToken_ShouldHaveCorrectAlgorithm_PS256_Async()
.Create(settings.ClientId)
.WithAuthority(settings.Authority)
.WithClientSecret(settings.GetSecret())
.WithExperimentalFeatures(true)
.Build();

var popConfig = new PoPAuthenticationConfiguration(new Uri(ProtectedUrl))
Expand Down
6 changes: 6 additions & 0 deletions tests/Microsoft.Identity.Test.Unit/pop/PoPTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public async Task POP_ShrValidation_Async()
ConfidentialClientApplication app =
ConfidentialClientApplicationBuilder.Create(TestConstants.ClientId)
.WithClientSecret(TestConstants.ClientSecret)
.WithExperimentalFeatures(true)
.WithHttpManager(httpManager)
.BuildConcrete();

Expand Down Expand Up @@ -91,6 +92,7 @@ public async Task POP_NoHttpRequest_Async()
ConfidentialClientApplication app =
ConfidentialClientApplicationBuilder.Create(TestConstants.ClientId)
.WithClientSecret(TestConstants.ClientSecret)
.WithExperimentalFeatures(true)
.WithHttpManager(httpManager)
.BuildConcrete();

Expand Down Expand Up @@ -128,6 +130,7 @@ public async Task POP_WithCustomNonce_Async()
ConfidentialClientApplication app =
ConfidentialClientApplicationBuilder.Create(TestConstants.ClientId)
.WithClientSecret(TestConstants.ClientSecret)
.WithExperimentalFeatures(true)
.WithHttpManager(httpManager)
.BuildConcrete();

Expand Down Expand Up @@ -403,6 +406,7 @@ public async Task CacheKey_Includes_POPKid_Async()
ConfidentialClientApplication app =
ConfidentialClientApplicationBuilder.Create(TestConstants.ClientId)
.WithClientSecret(TestConstants.ClientSecret)
.WithExperimentalFeatures(true)
.WithHttpManager(httpManager)
.BuildConcrete();
var testTimeService = new TestTimeService();
Expand Down Expand Up @@ -579,6 +583,7 @@ public async Task POP_SignatureValidationWithPS256_Async()
ConfidentialClientApplication app =
ConfidentialClientApplicationBuilder.Create(TestConstants.ClientId)
.WithClientSecret(TestConstants.ClientSecret)
.WithExperimentalFeatures(true)
.WithHttpManager(httpManager)
.BuildConcrete();

Expand Down Expand Up @@ -647,6 +652,7 @@ public async Task TokenGenerationAndValidation_Async()
{
ConfidentialClientApplication app = ConfidentialClientApplicationBuilder.Create(TestConstants.ClientId)
.WithClientSecret(TestConstants.ClientSecret)
.WithExperimentalFeatures(true)
.WithHttpManager(httpManager)
.BuildConcrete();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ public async Task ValidateKeyExpirationAsync()
var app = ConfidentialClientApplicationBuilder.Create(TestConstants.ClientId)
.WithHttpManager(harness.HttpManager)
.WithClientSecret("some-secret")
.WithExperimentalFeatures(true)
.BuildConcrete();

TokenCacheHelper.PopulateCache(app.AppTokenCacheInternal.Accessor);
Expand Down

0 comments on commit 4bce221

Please sign in to comment.