Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
<SignAssembly>true</SignAssembly>
<Nullable>enable</Nullable>
<EnablePackageValidation>false</EnablePackageValidation>
<!-- Suppress IL2026 (RequiresUnreferencedCode) and IL3050 (RequiresDynamicCode) warnings for System.Text.Json serialization.
TestExtensions is a test utility library that does not require AOT compatibility. -->
<NoWarn>$(NoWarn);IL2026;IL3050</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand All @@ -21,8 +24,8 @@
<ProjectReference Include="..\System.IdentityModel.Tokens.Jwt\System.IdentityModel.Tokens.Jwt.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftVersion)" />
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'">
<PackageReference Include="System.Text.Json" Version="$(SystemTextJson)" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
using System.Globalization;
using System.Security.Claims;
using System.Security.Cryptography;
using System.Text.Json;
using Microsoft.IdentityModel.JsonWebTokens;
using Microsoft.IdentityModel.Tokens;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace Microsoft.IdentityModel.TestExtensions
{
Expand Down Expand Up @@ -427,11 +426,7 @@ public static string CreateJsonPayload(IDictionary<string, object> claims)
if (claims == null)
throw new ArgumentNullException(nameof(claims));

var jobj = new JObject();
foreach (var claim in claims)
jobj.Add(claim.Key, JToken.FromObject(claim.Value));

return jobj.ToString(Formatting.None);
return JsonSerializer.Serialize(claims);
}
}
}
Loading