Skip to content

Commit

Permalink
Add Append to JWK Serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyencuong2596 committed Jun 20, 2024
1 parent a783b21 commit 53d0d52
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ public static void Write(ref Utf8JsonWriter writer, OpenIdConnectConfiguration c
JsonPrimitives.WriteStrings(ref writer, Utf8Bytes.ResponseTypesSupported, config.ResponseTypesSupported);

if (config.ShouldSerializeJsonWebKeys && config.JsonWebKeySet != null && config.JsonWebKeySet.Keys.Count > 0)
JsonWebKeySetSerializer.Write(ref writer, config.JsonWebKeySet, shouldWriteObject: false);
JsonWebKeySetSerializer.Append(ref writer, config.JsonWebKeySet);

if (config.ScopesSupported.Count > 0)
JsonPrimitives.WriteStrings(ref writer, Utf8Bytes.ScopesSupported, config.ScopesSupported);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,15 @@ public static string Write(JsonWebKeySet jsonWebKeySet)
/// </summary>
/// <param name="writer"></param>
/// <param name="jsonWebKeySet"></param>
/// <param name="shouldWriteObject"></param>
public static void Write(ref Utf8JsonWriter writer, JsonWebKeySet jsonWebKeySet, bool shouldWriteObject = true)
public static void Write(ref Utf8JsonWriter writer, JsonWebKeySet jsonWebKeySet)
{
if (shouldWriteObject)
writer.WriteStartObject();
writer.WriteStartObject();
Append(ref writer, jsonWebKeySet);
writer.WriteEndObject();
}

internal static void Append(ref Utf8JsonWriter writer, JsonWebKeySet jsonWebKeySet)
{
writer.WritePropertyName(JsonWebKeyParameterUtf8Bytes.Keys);
writer.WriteStartArray();

Expand All @@ -152,9 +155,6 @@ public static void Write(ref Utf8JsonWriter writer, JsonWebKeySet jsonWebKeySet,

if (jsonWebKeySet.AdditionalData.Count > 0)
JsonSerializerPrimitives.WriteObjects(ref writer, jsonWebKeySet.AdditionalData);

if (shouldWriteObject)
writer.WriteEndObject();
}

#endregion
Expand Down

0 comments on commit 53d0d52

Please sign in to comment.