From 17b6cd5ed8452a0408370abbbb9ea856b11f4c1b Mon Sep 17 00:00:00 2001 From: "Sruthi Keerthi Rangavajhula (from Dev Box)" Date: Tue, 18 Jun 2024 23:04:26 -0700 Subject: [PATCH] Add signing key issuer validation test for V2 Authority validating V1 token --- .../AadSigningKeyIssuerValidatorTests.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/Microsoft.IdentityModel.Validators.Tests/AadSigningKeyIssuerValidatorTests.cs b/test/Microsoft.IdentityModel.Validators.Tests/AadSigningKeyIssuerValidatorTests.cs index b979f7c49e..950d830a25 100644 --- a/test/Microsoft.IdentityModel.Validators.Tests/AadSigningKeyIssuerValidatorTests.cs +++ b/test/Microsoft.IdentityModel.Validators.Tests/AadSigningKeyIssuerValidatorTests.cs @@ -289,6 +289,19 @@ public static TheoryData ValidateIssuerSigningKey OpenIdConnectConfiguration = mockConfiguration }); + jwk = KeyingMaterial.JsonWebKeyP256; + jwk.AdditionalData.Add(OpenIdProviderMetadataNames.Issuer, ValidatorConstants.AadIssuerV2CommonAuthority); + mockConfiguration.JsonWebKeySet.Keys.Add(jwk); + mockConfiguration.Issuer = ValidatorConstants.AadIssuerV2CommonAuthority; + var jwtSecurityTokenV1Issuer = new JwtSecurityToken(issuer: ValidatorConstants.V1Issuer, claims: new[] { issClaim, tidClaim }); + theoryData.Add(new AadSigningKeyIssuerTheoryData + { + TestId = "HappyPath_V2AuthorityV1TokenIssuer_Matches_SigningKeyIssuer", + SecurityKey = KeyingMaterial.JsonWebKeyP256, + SecurityToken = jwtSecurityTokenV1Issuer, + OpenIdConnectConfiguration = mockConfiguration + }); + theoryData.Add(new AadSigningKeyIssuerTheoryData { TestId = "MissingTenantIdClaimInToken",