From c0b7c5acbd6b68680ebdeec9b8e98c9de0e89d81 Mon Sep 17 00:00:00 2001 From: Westin Musser Date: Wed, 17 Jul 2024 17:13:34 -0700 Subject: [PATCH 01/14] store original string, edit tests --- .../JsonWebKeySet.cs | 17 +++++++++++++++++ .../Json/DataSets.cs | 4 ++++ .../Json/JsonUtilities.cs | 3 +++ .../JsonWebKeySetTests.cs | 7 +++++++ 4 files changed, 31 insertions(+) diff --git a/src/Microsoft.IdentityModel.Tokens/JsonWebKeySet.cs b/src/Microsoft.IdentityModel.Tokens/JsonWebKeySet.cs index 10b3bb3679..ddfa8c0803 100644 --- a/src/Microsoft.IdentityModel.Tokens/JsonWebKeySet.cs +++ b/src/Microsoft.IdentityModel.Tokens/JsonWebKeySet.cs @@ -20,6 +20,7 @@ public class JsonWebKeySet { internal const string ClassName = "Microsoft.IdentityModel.Tokens.JsonWebKeySet"; private Dictionary _additionalData; + private string _jsonWebKeySetString = string.Empty; /// /// Returns a new instance of . @@ -53,6 +54,7 @@ public JsonWebKeySet(string json) { if (string.IsNullOrEmpty(json)) throw LogHelper.LogArgumentNullException(nameof(json)); + _jsonWebKeySetString = json; try { @@ -97,6 +99,21 @@ public JsonWebKeySet(string json) [JsonIgnore] public bool SkipUnresolvedJsonWebKeys { get; set; } = DefaultSkipUnresolvedJsonWebKeys; + /// + /// The original used to create this instance. + /// + public string JsonWebKeySetString + { + get + { + return _jsonWebKeySetString; + } + internal set + { + _jsonWebKeySetString = value; + } + } + /// /// Returns the JsonWebKeys as a . /// diff --git a/test/Microsoft.IdentityModel.Tokens.Tests/Json/DataSets.cs b/test/Microsoft.IdentityModel.Tokens.Tests/Json/DataSets.cs index 54a3ad905c..b5bd16e0d1 100644 --- a/test/Microsoft.IdentityModel.Tokens.Tests/Json/DataSets.cs +++ b/test/Microsoft.IdentityModel.Tokens.Tests/Json/DataSets.cs @@ -732,6 +732,7 @@ public static JsonWebKeySet JsonWebKeySet1 JsonWebKeySet jsonWebKeySet = new JsonWebKeySet(); jsonWebKeySet.Keys.Add(JsonWebKey1); jsonWebKeySet.Keys.Add(JsonWebKey2); + jsonWebKeySet.JsonWebKeySetString = JsonWebKeySetString1; return jsonWebKeySet; } @@ -753,6 +754,7 @@ public static JsonWebKeySet JsonWebKeySetX509Data JsonWebKeySet jsonWebKeySet = new JsonWebKeySet(); jsonWebKeySet.Keys.Add(jsonWebKey); + jsonWebKeySet.JsonWebKeySetString = JsonWebKeySetX509DataString; return jsonWebKeySet; } @@ -766,6 +768,7 @@ public static JsonWebKeySet JsonWebKeySetEC jsonWebKeySet.Keys.Add(JsonWebKeyES256); jsonWebKeySet.Keys.Add(JsonWebKeyES384); jsonWebKeySet.Keys.Add(JsonWebKeyES512); + jsonWebKeySet.JsonWebKeySetString = JsonWebKeySetECCString; return jsonWebKeySet; } @@ -785,6 +788,7 @@ public static JsonWebKeySet JsonWebKeySetOnlyX5t JsonWebKeySet jsonWebKeySet = new JsonWebKeySet(); jsonWebKeySet.Keys.Add(jsonWebKey); + jsonWebKeySet.JsonWebKeySetString = JsonWebKeySetOnlyX5tString; return jsonWebKeySet; } diff --git a/test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonUtilities.cs b/test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonUtilities.cs index 8dd4f023f1..e3ae3a119a 100644 --- a/test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonUtilities.cs +++ b/test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonUtilities.cs @@ -119,10 +119,13 @@ public static JsonWebKey6x FullyPopulatedJsonWebKey6x() return jsonWebKey; } + public static string FullyPopulatedJsonWebKeyString = @"{ ""keys"":[" + FullyPopulatedJsonWebKey() + "]}"; + public static JsonWebKeySet FullyPopulatedJsonWebKeySet() { JsonWebKeySet jsonWebKeySet = new JsonWebKeySet(); jsonWebKeySet.Keys.Add(FullyPopulatedJsonWebKey()); + jsonWebKeySet.JsonWebKeySetString = FullyPopulatedJsonWebKeyString; SetAdditionalData(jsonWebKeySet.AdditionalData); return jsonWebKeySet; diff --git a/test/Microsoft.IdentityModel.Tokens.Tests/JsonWebKeySetTests.cs b/test/Microsoft.IdentityModel.Tokens.Tests/JsonWebKeySetTests.cs index 76f0267b1d..221058f9ef 100644 --- a/test/Microsoft.IdentityModel.Tokens.Tests/JsonWebKeySetTests.cs +++ b/test/Microsoft.IdentityModel.Tokens.Tests/JsonWebKeySetTests.cs @@ -23,7 +23,14 @@ public void Constructors(JsonWebKeySetTheoryData theoryData) { var jsonWebKeys = new JsonWebKeySet(theoryData.Json); var keys = jsonWebKeys.GetSigningKeys(); + var originalString = jsonWebKeys.JsonWebKeySetString; theoryData.ExpectedException.ProcessNoException(context); + + if (theoryData.Json != null) + IdentityComparer.AreStringsEqual(originalString, theoryData.Json, context); + else + IdentityComparer.AreStringsEqual(originalString, string.Empty, context); + if (theoryData.JsonWebKeySet != null) IdentityComparer.AreEqual(jsonWebKeys, theoryData.JsonWebKeySet, context); From 5a5295204e3a42779c9db087bcb99ac23d635b52 Mon Sep 17 00:00:00 2001 From: Westin Musser Date: Wed, 24 Jul 2024 10:24:23 -0700 Subject: [PATCH 02/14] create string for test --- .../Json/JsonUtilities.cs | 47 ++++++++++++++++++- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonUtilities.cs b/test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonUtilities.cs index e3ae3a119a..185eaa93c9 100644 --- a/test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonUtilities.cs +++ b/test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonUtilities.cs @@ -119,13 +119,56 @@ public static JsonWebKey6x FullyPopulatedJsonWebKey6x() return jsonWebKey; } - public static string FullyPopulatedJsonWebKeyString = @"{ ""keys"":[" + FullyPopulatedJsonWebKey() + "]}"; + public static string FullyPopulatedJsonWebKeyString => + @"{ ""alg"":""SHA256"", + ""crv"":""CRV"", + ""d"":""OOX7PnYlSTE41BSclDj5Gi_sx_SPgEqStjY3doku4TQ"", + ""dp"":""ErP3OpudePAY3uGFSoF16Sde69PnOra62jDEZGnPx_v3nPNpA5sr-tNc8bQP074yQl5kzSFRjRlstyW0TpBVMP0ocbD8RsN4EKsgJ1jvaSIEoP87OxduGkim49wFA0Qxf_NyrcYUnz6XSidY3lC_pF4JDJXg5bP_x0MUkQCTtQE"", + ""dq"":""YbBsthPt15Pshb8rN8omyfy9D7-m4AGcKzqPERWuX8bORNyhQ5M8JtdXcu8UmTez0j188cNMJgkiN07nYLIzNT3Wg822nhtJaoKVwZWnS2ipoFlgrBgmQiKcGU43lfB5e3qVVYUebYY0zRGBM1Fzetd6Yertl5Ae2g2CakQAcPs"", + ""e"":""AQAB"", + ""k"":""K"", + ""key_ops"":[""keyOps""], + ""kid"":""NGTFvdK-fythEuLwjpwAJOM9n-A"", + ""kty"":""RSA"", + ""n"":""6-FrFkt_TByQ_L5d7or-9PVAowpswxUe3dJeYFTY0Lgq7zKI5OQ5RnSrI0T9yrfnRzE9oOdd4zmVj9txVLI-yySvinAu3yQDQou2Ga42ML_-K4Jrd5clMUPRGMbXdV5Rl9zzB0s2JoZJedua5dwoQw0GkS5Z8YAXBEzULrup06fnB5n6x5r2y1C_8Ebp5cyE4Bjs7W68rUlyIlx1lzYvakxSnhUxSsjx7u_mIdywyGfgiT3tw0FsWvki_KYurAPR1BSMXhCzzZTkMWKE8IaLkhauw5MdxojxyBVuNY-J_elq-HgJ_dZK6g7vMNvXz2_vT-SykIkzwiD9eSI9UWfsjw"", + ""oth"":[""oth1"",""oth2""], + ""p"":""_avCCyuo7hHlqu9Ec6R47ub_Ul_zNiS-xvkkuYwW-4lNnI66A5zMm_BOQVMnaCkBua1OmOgx7e63-jHFvG5lyrhyYEmkA2CS3kMCrI-dx0fvNMLEXInPxd4np_7GUd1_XzPZEkPxBhqf09kqryHMj_uf7UtPcrJNvFY-GNrzlJk"", + ""q"":""7gvYRkpqM-SC883KImmy66eLiUrGE6G6_7Y8BS9oD4HhXcZ4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NzY29udHJvbC53aW5kb3dzLm5ldIIQsRiM0jheFZhKk49YD0SK1TAJBgUrDgMCHQUAA4IBAQCJ4JApryF77EKC4zF5bUaBLQHQ1PNtA1uMDbdNVGKCmSf8M65b8h0NwlIjGGGy/unK8P6jWFdm5IlZ0YPTOgzcRZguXDPj7ajyvlVEQ2K2ICvTYiRQqrOhEhZMSSZsTKXFVwNfW6ADDkN3bvVOVbtpty+nBY5UqnI7xbcoHLZ4wYD251uj5+lo13YLnsVrmQ16NCBYq2nQFNPuNJw6t3XUbwBHXpF46aLT1/eGf/7Xx6iy8yPJX4DyrpFTutDz882RWofGEO5t4Cw+zZg70dJ/hH/ODYRMorfXEW+8uKmXMKmX2wyxMKvfiPbTy5LmAU8Jvjs2tLg4rOBcXWLAIarZ""], + ""x5t"":""NGTFvdK-fythEuLwjpwAJOM9n-A"", + ""x5t#S256"":""x5t256"", + ""x5u"":""https://jsonkeyurl"", + ""y"":""tUqUwtaVHwc7_CXnuBrCpMQTF5BJKdFnw9_JkSIXWpQ"", + ""int"":1, + ""long"":1234567890123456, + ""string"":""string"", + ""false"":false, + ""true"":true, + ""Object"":{""Object"":""string""}, + ""Array"":[""value1"",""value2""] + }"; + + public static string FullyPopulatedJsonWebKeySetString = + @"{ ""keys"":[" + FullyPopulatedJsonWebKeyString + @"], + ""int"":1, + ""long"":1234567890123456, + ""string"":""string"", + ""?"":false, + ""true"":false, + ""Object"":{""Object"":""string""}, + ""Array"":[ + ""value1"", ""value2"" + ] + ]}"; public static JsonWebKeySet FullyPopulatedJsonWebKeySet() { JsonWebKeySet jsonWebKeySet = new JsonWebKeySet(); jsonWebKeySet.Keys.Add(FullyPopulatedJsonWebKey()); - jsonWebKeySet.JsonWebKeySetString = FullyPopulatedJsonWebKeyString; + jsonWebKeySet.JsonWebKeySetString = FullyPopulatedJsonWebKeySetString; SetAdditionalData(jsonWebKeySet.AdditionalData); return jsonWebKeySet; From 2c214d626588d79d4999ac5a8f62be27e1c3ac89 Mon Sep 17 00:00:00 2001 From: Westin Musser Date: Tue, 30 Jul 2024 15:43:31 -0700 Subject: [PATCH 03/14] ignore creation string in serialization tests --- .../Json/JsonUtilities.cs | 46 ------------------- .../Json/JsonWebKeySetSerializationTests.cs | 9 ++++ 2 files changed, 9 insertions(+), 46 deletions(-) diff --git a/test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonUtilities.cs b/test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonUtilities.cs index d25e55c326..ecba2a32ce 100644 --- a/test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonUtilities.cs +++ b/test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonUtilities.cs @@ -80,56 +80,10 @@ public static JsonWebKey FullyPopulatedJsonWebKey() return jsonWebKey; } - public static string FullyPopulatedJsonWebKeyString => - @"{ ""alg"":""SHA256"", - ""crv"":""CRV"", - ""d"":""OOX7PnYlSTE41BSclDj5Gi_sx_SPgEqStjY3doku4TQ"", - ""dp"":""ErP3OpudePAY3uGFSoF16Sde69PnOra62jDEZGnPx_v3nPNpA5sr-tNc8bQP074yQl5kzSFRjRlstyW0TpBVMP0ocbD8RsN4EKsgJ1jvaSIEoP87OxduGkim49wFA0Qxf_NyrcYUnz6XSidY3lC_pF4JDJXg5bP_x0MUkQCTtQE"", - ""dq"":""YbBsthPt15Pshb8rN8omyfy9D7-m4AGcKzqPERWuX8bORNyhQ5M8JtdXcu8UmTez0j188cNMJgkiN07nYLIzNT3Wg822nhtJaoKVwZWnS2ipoFlgrBgmQiKcGU43lfB5e3qVVYUebYY0zRGBM1Fzetd6Yertl5Ae2g2CakQAcPs"", - ""e"":""AQAB"", - ""k"":""K"", - ""key_ops"":[""keyOps""], - ""kid"":""NGTFvdK-fythEuLwjpwAJOM9n-A"", - ""kty"":""RSA"", - ""n"":""6-FrFkt_TByQ_L5d7or-9PVAowpswxUe3dJeYFTY0Lgq7zKI5OQ5RnSrI0T9yrfnRzE9oOdd4zmVj9txVLI-yySvinAu3yQDQou2Ga42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890123456, - ""string"":""string"", - ""false"":false, - ""true"":true, - ""Object"":{""Object"":""string""}, - ""Array"":[""value1"",""value2""] - }"; - - public static string FullyPopulatedJsonWebKeySetString = - @"{ ""keys"":[" + FullyPopulatedJsonWebKeyString + @"], - ""int"":1, - ""long"":1234567890123456, - ""string"":""string"", - ""false"":false, - ""true"":true, - ""Object"":{""Object"":""string""}, - ""Array"":[ - ""value1"", ""value2"" - ] - }"; - public static JsonWebKeySet FullyPopulatedJsonWebKeySet() { JsonWebKeySet jsonWebKeySet = new JsonWebKeySet(); jsonWebKeySet.Keys.Add(FullyPopulatedJsonWebKey()); - jsonWebKeySet.JsonWebKeySetString = FullyPopulatedJsonWebKeySetString; SetAdditionalData(jsonWebKeySet.AdditionalData); return jsonWebKeySet; diff --git a/test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonWebKeySetSerializationTests.cs b/test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonWebKeySetSerializationTests.cs index 5ba224aa2f..313667207e 100644 --- a/test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonWebKeySetSerializationTests.cs +++ b/test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonWebKeySetSerializationTests.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using System; +using System.Collections.Generic; using Microsoft.IdentityModel.TestUtils; using Xunit; @@ -17,6 +18,10 @@ public class JsonWebKeySetSerializationTests public void Serialize(JsonWebKeySetTheoryData theoryData) { var context = TestUtilities.WriteHeader($"{this}.Serialize", theoryData); + context.PropertiesToIgnoreWhenComparing = new Dictionary> + { + { typeof(JsonWebKeySet), new List { "JsonWebKeySetString" } }, + }; try { @@ -60,6 +65,10 @@ public static TheoryData SerializeDataSet public void Deserialize(JsonWebKeySetTheoryData theoryData) { var context = TestUtilities.WriteHeader($"{this}.Deserialize", theoryData); + context.PropertiesToIgnoreWhenComparing = new Dictionary> + { + { typeof(JsonWebKeySet), new List { "JsonWebKeySetString" } }, + }; try { From 4858547415987020f8b5e4fb10cb75c0de02d944 Mon Sep 17 00:00:00 2001 From: Westin Musser Date: Tue, 30 Jul 2024 16:42:13 -0700 Subject: [PATCH 04/14] fix tests using jwks --- ...OpenIdConnectConfigurationRetrieverTests.cs | 18 ++++++++++++++++-- .../Json/JsonWebKeySetSerializationTests.cs | 4 ++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/test/Microsoft.IdentityModel.Protocols.OpenIdConnect.Tests/OpenIdConnectConfigurationRetrieverTests.cs b/test/Microsoft.IdentityModel.Protocols.OpenIdConnect.Tests/OpenIdConnectConfigurationRetrieverTests.cs index a64391ed85..6a55af8ebd 100644 --- a/test/Microsoft.IdentityModel.Protocols.OpenIdConnect.Tests/OpenIdConnectConfigurationRetrieverTests.cs +++ b/test/Microsoft.IdentityModel.Protocols.OpenIdConnect.Tests/OpenIdConnectConfigurationRetrieverTests.cs @@ -2,12 +2,14 @@ // Licensed under the MIT License. using System; +using System.Collections.Generic; using System.IO; using System.Net.Http; using System.Security.Cryptography; using System.Threading; using System.Threading.Tasks; using Microsoft.IdentityModel.TestUtils; +using Microsoft.IdentityModel.Tokens; using Xunit; namespace Microsoft.IdentityModel.Protocols.OpenIdConnect.Tests @@ -28,7 +30,13 @@ public async Task FromNetwork() [Fact] public async Task FromFile() { - var context = new CompareContext(); + var context = new CompareContext + { + PropertiesToIgnoreWhenComparing = new Dictionary> + { + { typeof(JsonWebKeySet), [ "JsonWebKeySetString" ] }, + } + }; var configuration = await GetConfigurationAsync( OpenIdConfigData.JsonFile, ExpectedException.NoExceptionExpected, @@ -52,7 +60,13 @@ public async Task FromFile() [Fact] public async Task FromJson() { - var context = new CompareContext(); + var context = new CompareContext + { + PropertiesToIgnoreWhenComparing = new Dictionary> + { + { typeof(JsonWebKeySet), [ "JsonWebKeySetString" ] }, + } + }; var configuration = await GetConfigurationFromMixedAsync( OpenIdConfigData.OpenIdConnectMetadataPingString, expectedException: ExpectedException.NoExceptionExpected); diff --git a/test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonWebKeySetSerializationTests.cs b/test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonWebKeySetSerializationTests.cs index 313667207e..9127ddbcf9 100644 --- a/test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonWebKeySetSerializationTests.cs +++ b/test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonWebKeySetSerializationTests.cs @@ -20,7 +20,7 @@ public void Serialize(JsonWebKeySetTheoryData theoryData) var context = TestUtilities.WriteHeader($"{this}.Serialize", theoryData); context.PropertiesToIgnoreWhenComparing = new Dictionary> { - { typeof(JsonWebKeySet), new List { "JsonWebKeySetString" } }, + { typeof(JsonWebKeySet), [ "JsonWebKeySetString" ] }, }; try @@ -67,7 +67,7 @@ public void Deserialize(JsonWebKeySetTheoryData theoryData) var context = TestUtilities.WriteHeader($"{this}.Deserialize", theoryData); context.PropertiesToIgnoreWhenComparing = new Dictionary> { - { typeof(JsonWebKeySet), new List { "JsonWebKeySetString" } }, + { typeof(JsonWebKeySet), [ "JsonWebKeySetString" ] }, }; try From 2ee338f851474e0e96a297e06cad7b00486881ef Mon Sep 17 00:00:00 2001 From: Westin Musser Date: Wed, 31 Jul 2024 08:07:18 -0700 Subject: [PATCH 05/14] add justifying comments for compare ignores --- .../OpenIdConnectConfigurationRetrieverTests.cs | 4 ++++ .../Json/JsonWebKeySetSerializationTests.cs | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/test/Microsoft.IdentityModel.Protocols.OpenIdConnect.Tests/OpenIdConnectConfigurationRetrieverTests.cs b/test/Microsoft.IdentityModel.Protocols.OpenIdConnect.Tests/OpenIdConnectConfigurationRetrieverTests.cs index 6a55af8ebd..50472ccb2d 100644 --- a/test/Microsoft.IdentityModel.Protocols.OpenIdConnect.Tests/OpenIdConnectConfigurationRetrieverTests.cs +++ b/test/Microsoft.IdentityModel.Protocols.OpenIdConnect.Tests/OpenIdConnectConfigurationRetrieverTests.cs @@ -34,6 +34,8 @@ public async Task FromFile() { PropertiesToIgnoreWhenComparing = new Dictionary> { + // If the objects being compared are created from the same string and they are equal, the string itself can be ignored. + // The strings may not be equal because of whitespace, but the json they represent is semantically identical. { typeof(JsonWebKeySet), [ "JsonWebKeySetString" ] }, } }; @@ -64,6 +66,8 @@ public async Task FromJson() { PropertiesToIgnoreWhenComparing = new Dictionary> { + // If the objects being compared are created from the same string and they are equal, the string itself can be ignored. + // The strings may not be equal because of whitespace, but the json they represent is semantically identical. { typeof(JsonWebKeySet), [ "JsonWebKeySetString" ] }, } }; diff --git a/test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonWebKeySetSerializationTests.cs b/test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonWebKeySetSerializationTests.cs index 9127ddbcf9..a17100dfb1 100644 --- a/test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonWebKeySetSerializationTests.cs +++ b/test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonWebKeySetSerializationTests.cs @@ -20,6 +20,8 @@ public void Serialize(JsonWebKeySetTheoryData theoryData) var context = TestUtilities.WriteHeader($"{this}.Serialize", theoryData); context.PropertiesToIgnoreWhenComparing = new Dictionary> { + // If the objects being compared are created from the same string and they are equal, the string itself can be ignored. + // The strings may not be equal because of whitespace, but the json they represent is semantically identical. { typeof(JsonWebKeySet), [ "JsonWebKeySetString" ] }, }; @@ -67,6 +69,8 @@ public void Deserialize(JsonWebKeySetTheoryData theoryData) var context = TestUtilities.WriteHeader($"{this}.Deserialize", theoryData); context.PropertiesToIgnoreWhenComparing = new Dictionary> { + // If the objects being compared are created from the same string and they are equal, the string itself can be ignored. + // The strings may not be equal because of whitespace, but the json they represent is semantically identical. { typeof(JsonWebKeySet), [ "JsonWebKeySetString" ] }, }; From b5fb4f00919ae744a397f04ec459714f864f0f71 Mon Sep 17 00:00:00 2001 From: Westin Musser Date: Wed, 31 Jul 2024 14:13:38 -0700 Subject: [PATCH 06/14] add jsonignore to new property --- src/Microsoft.IdentityModel.Tokens/JsonWebKeySet.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Microsoft.IdentityModel.Tokens/JsonWebKeySet.cs b/src/Microsoft.IdentityModel.Tokens/JsonWebKeySet.cs index ddfa8c0803..cea68ba7a3 100644 --- a/src/Microsoft.IdentityModel.Tokens/JsonWebKeySet.cs +++ b/src/Microsoft.IdentityModel.Tokens/JsonWebKeySet.cs @@ -102,6 +102,7 @@ public JsonWebKeySet(string json) /// /// The original used to create this instance. /// + [JsonIgnore] public string JsonWebKeySetString { get From 8c65471ecbf6616ccb73407022205f677930e943 Mon Sep 17 00:00:00 2001 From: Westin Musser Date: Wed, 31 Jul 2024 15:03:47 -0700 Subject: [PATCH 07/14] rename --- src/Microsoft.IdentityModel.Tokens/JsonWebKeySet.cs | 10 +++++----- .../Json/DataSets.cs | 8 ++++---- .../JsonWebKeySetTests.cs | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Microsoft.IdentityModel.Tokens/JsonWebKeySet.cs b/src/Microsoft.IdentityModel.Tokens/JsonWebKeySet.cs index cea68ba7a3..dc4811296a 100644 --- a/src/Microsoft.IdentityModel.Tokens/JsonWebKeySet.cs +++ b/src/Microsoft.IdentityModel.Tokens/JsonWebKeySet.cs @@ -20,7 +20,7 @@ public class JsonWebKeySet { internal const string ClassName = "Microsoft.IdentityModel.Tokens.JsonWebKeySet"; private Dictionary _additionalData; - private string _jsonWebKeySetString = string.Empty; + private string _jsonData = string.Empty; /// /// Returns a new instance of . @@ -54,7 +54,7 @@ public JsonWebKeySet(string json) { if (string.IsNullOrEmpty(json)) throw LogHelper.LogArgumentNullException(nameof(json)); - _jsonWebKeySetString = json; + _jsonData = json; try { @@ -103,15 +103,15 @@ public JsonWebKeySet(string json) /// The original used to create this instance. /// [JsonIgnore] - public string JsonWebKeySetString + public string JsonData { get { - return _jsonWebKeySetString; + return _jsonData; } internal set { - _jsonWebKeySetString = value; + _jsonData = value; } } diff --git a/test/Microsoft.IdentityModel.Tokens.Tests/Json/DataSets.cs b/test/Microsoft.IdentityModel.Tokens.Tests/Json/DataSets.cs index b5bd16e0d1..fc2e257128 100644 --- a/test/Microsoft.IdentityModel.Tokens.Tests/Json/DataSets.cs +++ b/test/Microsoft.IdentityModel.Tokens.Tests/Json/DataSets.cs @@ -732,7 +732,7 @@ public static JsonWebKeySet JsonWebKeySet1 JsonWebKeySet jsonWebKeySet = new JsonWebKeySet(); jsonWebKeySet.Keys.Add(JsonWebKey1); jsonWebKeySet.Keys.Add(JsonWebKey2); - jsonWebKeySet.JsonWebKeySetString = JsonWebKeySetString1; + jsonWebKeySet.JsonData = JsonWebKeySetString1; return jsonWebKeySet; } @@ -754,7 +754,7 @@ public static JsonWebKeySet JsonWebKeySetX509Data JsonWebKeySet jsonWebKeySet = new JsonWebKeySet(); jsonWebKeySet.Keys.Add(jsonWebKey); - jsonWebKeySet.JsonWebKeySetString = JsonWebKeySetX509DataString; + jsonWebKeySet.JsonData = JsonWebKeySetX509DataString; return jsonWebKeySet; } @@ -768,7 +768,7 @@ public static JsonWebKeySet JsonWebKeySetEC jsonWebKeySet.Keys.Add(JsonWebKeyES256); jsonWebKeySet.Keys.Add(JsonWebKeyES384); jsonWebKeySet.Keys.Add(JsonWebKeyES512); - jsonWebKeySet.JsonWebKeySetString = JsonWebKeySetECCString; + jsonWebKeySet.JsonData = JsonWebKeySetECCString; return jsonWebKeySet; } @@ -788,7 +788,7 @@ public static JsonWebKeySet JsonWebKeySetOnlyX5t JsonWebKeySet jsonWebKeySet = new JsonWebKeySet(); jsonWebKeySet.Keys.Add(jsonWebKey); - jsonWebKeySet.JsonWebKeySetString = JsonWebKeySetOnlyX5tString; + jsonWebKeySet.JsonData = JsonWebKeySetOnlyX5tString; return jsonWebKeySet; } diff --git a/test/Microsoft.IdentityModel.Tokens.Tests/JsonWebKeySetTests.cs b/test/Microsoft.IdentityModel.Tokens.Tests/JsonWebKeySetTests.cs index 221058f9ef..bfd39152aa 100644 --- a/test/Microsoft.IdentityModel.Tokens.Tests/JsonWebKeySetTests.cs +++ b/test/Microsoft.IdentityModel.Tokens.Tests/JsonWebKeySetTests.cs @@ -23,7 +23,7 @@ public void Constructors(JsonWebKeySetTheoryData theoryData) { var jsonWebKeys = new JsonWebKeySet(theoryData.Json); var keys = jsonWebKeys.GetSigningKeys(); - var originalString = jsonWebKeys.JsonWebKeySetString; + var originalString = jsonWebKeys.JsonData; theoryData.ExpectedException.ProcessNoException(context); if (theoryData.Json != null) From ca0fd95514d2e5e10dee4e520bbd6085f810000e Mon Sep 17 00:00:00 2001 From: Westin Musser Date: Wed, 31 Jul 2024 15:27:54 -0700 Subject: [PATCH 08/14] rename in ignores --- .../OpenIdConnectConfigurationRetrieverTests.cs | 4 ++-- .../Json/JsonWebKeySetSerializationTests.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/Microsoft.IdentityModel.Protocols.OpenIdConnect.Tests/OpenIdConnectConfigurationRetrieverTests.cs b/test/Microsoft.IdentityModel.Protocols.OpenIdConnect.Tests/OpenIdConnectConfigurationRetrieverTests.cs index 50472ccb2d..4c86a430ab 100644 --- a/test/Microsoft.IdentityModel.Protocols.OpenIdConnect.Tests/OpenIdConnectConfigurationRetrieverTests.cs +++ b/test/Microsoft.IdentityModel.Protocols.OpenIdConnect.Tests/OpenIdConnectConfigurationRetrieverTests.cs @@ -36,7 +36,7 @@ public async Task FromFile() { // If the objects being compared are created from the same string and they are equal, the string itself can be ignored. // The strings may not be equal because of whitespace, but the json they represent is semantically identical. - { typeof(JsonWebKeySet), [ "JsonWebKeySetString" ] }, + { typeof(JsonWebKeySet), [ "JsonData" ] }, } }; var configuration = await GetConfigurationAsync( @@ -68,7 +68,7 @@ public async Task FromJson() { // If the objects being compared are created from the same string and they are equal, the string itself can be ignored. // The strings may not be equal because of whitespace, but the json they represent is semantically identical. - { typeof(JsonWebKeySet), [ "JsonWebKeySetString" ] }, + { typeof(JsonWebKeySet), [ "JsonData" ] }, } }; var configuration = await GetConfigurationFromMixedAsync( diff --git a/test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonWebKeySetSerializationTests.cs b/test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonWebKeySetSerializationTests.cs index a17100dfb1..10dbb85f3e 100644 --- a/test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonWebKeySetSerializationTests.cs +++ b/test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonWebKeySetSerializationTests.cs @@ -22,7 +22,7 @@ public void Serialize(JsonWebKeySetTheoryData theoryData) { // If the objects being compared are created from the same string and they are equal, the string itself can be ignored. // The strings may not be equal because of whitespace, but the json they represent is semantically identical. - { typeof(JsonWebKeySet), [ "JsonWebKeySetString" ] }, + { typeof(JsonWebKeySet), [ "JsonData" ] }, }; try @@ -71,7 +71,7 @@ public void Deserialize(JsonWebKeySetTheoryData theoryData) { // If the objects being compared are created from the same string and they are equal, the string itself can be ignored. // The strings may not be equal because of whitespace, but the json they represent is semantically identical. - { typeof(JsonWebKeySet), [ "JsonWebKeySetString" ] }, + { typeof(JsonWebKeySet), [ "JsonData" ] }, }; try From 9ed4695e4072c17eabe51f77cc686673582d088f Mon Sep 17 00:00:00 2001 From: Westin Musser Date: Mon, 5 Aug 2024 14:15:48 -0700 Subject: [PATCH 09/14] test improvements --- src/Microsoft.IdentityModel.Tokens/JsonWebKeySet.cs | 4 ++-- test/Microsoft.IdentityModel.Tokens.Tests/Json/DataSets.cs | 5 +---- .../Json/JsonWebKeySetSerializationTests.cs | 2 +- .../Json/JsonWebKeySetTheoryData.cs | 2 +- .../JsonWebKeySetTests.cs | 5 +---- 5 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/Microsoft.IdentityModel.Tokens/JsonWebKeySet.cs b/src/Microsoft.IdentityModel.Tokens/JsonWebKeySet.cs index dc4811296a..6f39e45bc7 100644 --- a/src/Microsoft.IdentityModel.Tokens/JsonWebKeySet.cs +++ b/src/Microsoft.IdentityModel.Tokens/JsonWebKeySet.cs @@ -103,13 +103,13 @@ public JsonWebKeySet(string json) /// The original used to create this instance. /// [JsonIgnore] - public string JsonData + internal string JsonData { get { return _jsonData; } - internal set + set { _jsonData = value; } diff --git a/test/Microsoft.IdentityModel.Tokens.Tests/Json/DataSets.cs b/test/Microsoft.IdentityModel.Tokens.Tests/Json/DataSets.cs index fc2e257128..6d64a4b9b9 100644 --- a/test/Microsoft.IdentityModel.Tokens.Tests/Json/DataSets.cs +++ b/test/Microsoft.IdentityModel.Tokens.Tests/Json/DataSets.cs @@ -729,10 +729,7 @@ public static JsonWebKeySet JsonWebKeySet1 { get { - JsonWebKeySet jsonWebKeySet = new JsonWebKeySet(); - jsonWebKeySet.Keys.Add(JsonWebKey1); - jsonWebKeySet.Keys.Add(JsonWebKey2); - jsonWebKeySet.JsonData = JsonWebKeySetString1; + JsonWebKeySet jsonWebKeySet = new JsonWebKeySet(JsonWebKeySetString1); return jsonWebKeySet; } diff --git a/test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonWebKeySetSerializationTests.cs b/test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonWebKeySetSerializationTests.cs index 10dbb85f3e..19572dedfc 100644 --- a/test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonWebKeySetSerializationTests.cs +++ b/test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonWebKeySetSerializationTests.cs @@ -36,7 +36,7 @@ public void Serialize(JsonWebKeySetTheoryData theoryData) // compare our utf8Reader with expected value if (!IdentityComparer.AreEqual(jsonWebKeySetUtf8Reader, theoryData.JsonWebKeySet, context)) { - context.Diffs.Add("jsonWebKeySetUtf8Reader != theoryData.JsonWebKeySet1"); + context.Diffs.Add("jsonWebKeySetUtf8Reader != theoryData.JsonWebKeySet"); context.Diffs.Add("========================================="); } } diff --git a/test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonWebKeySetTheoryData.cs b/test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonWebKeySetTheoryData.cs index d860108fb2..245dd00eda 100644 --- a/test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonWebKeySetTheoryData.cs +++ b/test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonWebKeySetTheoryData.cs @@ -14,7 +14,7 @@ public JsonWebKeySetTheoryData(string testId) : base(testId) { } public IList ExpectedSigningKeys { get; set; } - public string Json { get; set; } + public string Json { get; set; } = string.Empty; public JsonWebKeySet JsonWebKeySet { get; set; } } diff --git a/test/Microsoft.IdentityModel.Tokens.Tests/JsonWebKeySetTests.cs b/test/Microsoft.IdentityModel.Tokens.Tests/JsonWebKeySetTests.cs index bfd39152aa..625e22f991 100644 --- a/test/Microsoft.IdentityModel.Tokens.Tests/JsonWebKeySetTests.cs +++ b/test/Microsoft.IdentityModel.Tokens.Tests/JsonWebKeySetTests.cs @@ -26,10 +26,7 @@ public void Constructors(JsonWebKeySetTheoryData theoryData) var originalString = jsonWebKeys.JsonData; theoryData.ExpectedException.ProcessNoException(context); - if (theoryData.Json != null) - IdentityComparer.AreStringsEqual(originalString, theoryData.Json, context); - else - IdentityComparer.AreStringsEqual(originalString, string.Empty, context); + IdentityComparer.AreStringsEqual(originalString, theoryData.Json, context); if (theoryData.JsonWebKeySet != null) IdentityComparer.AreEqual(jsonWebKeys, theoryData.JsonWebKeySet, context); From 667ad73436c4c0ba65bdcdba81aabf8496fe6777 Mon Sep 17 00:00:00 2001 From: Westin Musser <127992899+westin-m@users.noreply.github.com> Date: Mon, 5 Aug 2024 15:49:04 -0700 Subject: [PATCH 10/14] Update codeql-analysis.yml --- .github/workflows/codeql-analysis.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index a39ce0417a..fc23bf1f08 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -51,8 +51,8 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v3 + # - name: Autobuild + # uses: github/codeql-action/autobuild@v3 # ℹī¸ Command-line programs to run using the OS shell. # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun @@ -60,9 +60,9 @@ jobs: # If the Autobuild fails above, remove it and uncomment the following three lines. # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - # - run: | - # echo "Run, Build Application using script" - # ./location_of_script_within_repo/buildscript.sh + - run: | + echo "Run, Build Application using script" + ./build.sh - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v3 From 65fc364112a72bc56aacb3ce3d8c246479329f15 Mon Sep 17 00:00:00 2001 From: Westin Musser Date: Mon, 5 Aug 2024 15:51:35 -0700 Subject: [PATCH 11/14] Revert "Update codeql-analysis.yml" This reverts commit 667ad73436c4c0ba65bdcdba81aabf8496fe6777. --- .github/workflows/codeql-analysis.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index fc23bf1f08..a39ce0417a 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -51,8 +51,8 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). # If this step fails, then you should remove it and run the build manually (see below) - # - name: Autobuild - # uses: github/codeql-action/autobuild@v3 + - name: Autobuild + uses: github/codeql-action/autobuild@v3 # ℹī¸ Command-line programs to run using the OS shell. # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun @@ -60,9 +60,9 @@ jobs: # If the Autobuild fails above, remove it and uncomment the following three lines. # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - - run: | - echo "Run, Build Application using script" - ./build.sh + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v3 From a264501f0f884fbfd86b37960646f11f325752cb Mon Sep 17 00:00:00 2001 From: Westin Musser <127992899+westin-m@users.noreply.github.com> Date: Mon, 5 Aug 2024 16:18:55 -0700 Subject: [PATCH 12/14] Update src/Microsoft.IdentityModel.Tokens/JsonWebKeySet.cs Co-authored-by: Keegan Caruso --- src/Microsoft.IdentityModel.Tokens/JsonWebKeySet.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Microsoft.IdentityModel.Tokens/JsonWebKeySet.cs b/src/Microsoft.IdentityModel.Tokens/JsonWebKeySet.cs index 6f39e45bc7..e7dc6e056b 100644 --- a/src/Microsoft.IdentityModel.Tokens/JsonWebKeySet.cs +++ b/src/Microsoft.IdentityModel.Tokens/JsonWebKeySet.cs @@ -54,6 +54,7 @@ public JsonWebKeySet(string json) { if (string.IsNullOrEmpty(json)) throw LogHelper.LogArgumentNullException(nameof(json)); + _jsonData = json; try From 29018850719b0c61f74e7c85628176cfbebfb34a Mon Sep 17 00:00:00 2001 From: Westin Musser <127992899+westin-m@users.noreply.github.com> Date: Mon, 5 Aug 2024 16:19:04 -0700 Subject: [PATCH 13/14] Update test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonWebKeySetTheoryData.cs Co-authored-by: Keegan Caruso --- .../Json/JsonWebKeySetTheoryData.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonWebKeySetTheoryData.cs b/test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonWebKeySetTheoryData.cs index 245dd00eda..d860108fb2 100644 --- a/test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonWebKeySetTheoryData.cs +++ b/test/Microsoft.IdentityModel.Tokens.Tests/Json/JsonWebKeySetTheoryData.cs @@ -14,7 +14,7 @@ public JsonWebKeySetTheoryData(string testId) : base(testId) { } public IList ExpectedSigningKeys { get; set; } - public string Json { get; set; } = string.Empty; + public string Json { get; set; } public JsonWebKeySet JsonWebKeySet { get; set; } } From f7607a7615bfe92855356aab41b5fd44a2fdbb1e Mon Sep 17 00:00:00 2001 From: Westin Musser <127992899+westin-m@users.noreply.github.com> Date: Mon, 5 Aug 2024 16:19:24 -0700 Subject: [PATCH 14/14] Update src/Microsoft.IdentityModel.Tokens/JsonWebKeySet.cs Co-authored-by: Keegan Caruso --- src/Microsoft.IdentityModel.Tokens/JsonWebKeySet.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.IdentityModel.Tokens/JsonWebKeySet.cs b/src/Microsoft.IdentityModel.Tokens/JsonWebKeySet.cs index e7dc6e056b..3c533c6c5b 100644 --- a/src/Microsoft.IdentityModel.Tokens/JsonWebKeySet.cs +++ b/src/Microsoft.IdentityModel.Tokens/JsonWebKeySet.cs @@ -101,7 +101,7 @@ public JsonWebKeySet(string json) public bool SkipUnresolvedJsonWebKeys { get; set; } = DefaultSkipUnresolvedJsonWebKeys; /// - /// The original used to create this instance. + /// The original string used to create this instance if a string was provided. /// [JsonIgnore] internal string JsonData