-
Notifications
You must be signed in to change notification settings - Fork 408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removal of dependency on Newtonsoft #2233
Conversation
b941969
to
6d5cf6e
Compare
src/Microsoft.IdentityModel.Protocols.SignedHttpRequest/SignedHttpRequestHandler.cs
Show resolved
Hide resolved
Replaced JsonDocument.Parse with Utf8JsonReader Standardized roundtrip serialization
6d5cf6e
to
f5a7cb7
Compare
src/Microsoft.IdentityModel.TestExtensions/Microsoft.IdentityModel.TestExtensions.csproj
Show resolved
Hide resolved
Remove some debugging code.
test/Microsoft.IdentityModel.JsonWebTokens.Tests/JsonClaimSetTests.cs
Outdated
Show resolved
Hide resolved
getting this error locally: str1 != str2, StringComparison: 'Ordinal' Refers to: test/Microsoft.IdentityModel.JsonWebTokens.Tests/JsonWebTokenTests.cs:160 in 40be4d0. [](commit_id = 40be4d0, deletion_comment = False) |
str1 != str2, StringComparison: 'Ordinal' Refers to: test/Microsoft.IdentityModel.JsonWebTokens.Tests/JsonWebTokenTests.cs:134 in 40be4d0. [](commit_id = 40be4d0, deletion_comment = False) |
src/Microsoft.IdentityModel.Tokens/Json/JsonSerializerPrimitives.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.IdentityModel.Tokens/Json/JsonSerializerPrimitives.cs
Outdated
Show resolved
Hide resolved
One breaking change in Wilson7 that we might want to fix (but in preview4) is: jsonWebToken.TryGetPayload(JwtClaimsTypes.Roles, out roles) used to accept that roles is a
|
Thoughts @kevinchalet ? |
Thanks for tagging me, @jennyf19! I'm assuming Was this PR included in the preview that shipped yesterday? |
Yes, this is in preview3, which is out on NuGet as of Sunday (8/20) night. Would appreciate your feedback on this one. |
Sadly, I'm seeing important regressions when moving to preview3. I'll open dedicated tickets. |
Here's the first one: #2244 |
And the second one: #2245. |
And the third one: #2246. It seems the migration to |
We agree. Appreciate the bugs and all the thorough testing. We will improve our coverage as well. |
This PR removes the use of Newtonsoft from IdentityModel by using Utf8JsonReader/Writer
JsonWebTokens were previously populated with JsonDocument.Parse, which resulted Claims and Values being parsed from a JsonElement each time properties were accessed.
This PR introduces a new model of reading with a Utf8JsonReader and creating a collection of values that have been deserialized from Json. This will improve performance when accessing either a System.Claim or a C# property. There is more work to do as it will be helpful if the JsonElement is remembered when parsing as when creating a Claim, the serialized Json is needed in the claim.
A first cut at improving creation of JWT's when a reduced number of string -> Utf8bytes -> string + string -> Utf8bytes transformations were taking place. The goal is to use buffer pooling and write into the buffer (Span) once, perform all work (signature, compression, encryption) on the buffer.
Standardized roundtrip serialization was improved with the goal of providing a deterministic model for 'additional' data found on some objects.