-
Notifications
You must be signed in to change notification settings - Fork 414
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
[Feature Request] Use System.Text.Json instead of Microsoft.IdentityModel.Json #2032
Comments
Related? #1580 |
@brockallen long time no see We would like to remove our internal Newtonsoft clone and move to System.Text.Json. Thoughts? |
👋🏻
A common option used by many libraries is to make the serializer configurable, so one can decide to use JSON.NET or
What would that imply for Katana? Will it stay on 6.x or will it move to a newer .NET Framework TFM? |
@kevinchalet I spoke with the asp.net team and believe Katana users will be able to use 7.x. That is a good idea to have a model that allows users to plug in the serializer. Keeping the .net45 target is larger than just JSON.NET vs. System.Text.Json. I don't see Katana updating their TFM. |
@brentschmaltz thanks for your clear and detailed reply! 😃 Do you envision important API changes between 6.x and 7.x? I'm asking that because given what you said, it's likely OpenIddict will keep referencing Wilson 6.x for its .NET Standard 2.0 and .NET Framework 4.6.1 TFMs and will use Wilson 7.x only for the more recent targets. It the API changes were limited, that would be awesome 😃
Makes sense. To make conditional code easier to write, read and maintain, OpenIddict defines feature constants in <PropertyGroup
Condition=" ('$(TargetFrameworkIdentifier)' == '.NETCoreApp' And $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), '2.0'))) Or
('$(TargetFrameworkIdentifier)' == '.NETFramework' And $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), '4.7.2'))) Or
('$(TargetFrameworkIdentifier)' == '.NETStandard' And $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), '2.1'))) ">
<DefineConstants>$(DefineConstants);SUPPORTS_CERTIFICATE_GENERATION</DefineConstants>
</PropertyGroup> #if SUPPORTS_CERTIFICATE_GENERATION
...
#endif |
@kevinchalet we plan on keeping our .NET Standard 2.0 TFM, we were going to drop 461 (as it is not supported) and some promises in the crypto libraries were not true. 462, solved some of the issues. It is mainly 45 where the #ifdefs are really messy. Since System.Text.Json is supported on 461, it may be possible to convince the team to continue with the 461 TFM along with 462. I don't think that anyone is really running 461, but just targeting the api set. I will let you know what the team thinks. |
@kevinchalet would you be OK if we dropped 461? |
If you get rid of the explicit
Have you considered using |
@kevinchalet spoke with the team and they seem open to keeping 461 around for another year and give users a heads up so there is time to migrate. Would this work for you? |
Sounds reasonable 😃 |
@kevinchalet i'll work to get a commitment from the team. |
@kevinchalet i negotiated with the team and we are willing to keep 461 target for at least 6 months after we drop 45. |
Great, thanks for the information, @brentschmaltz! 😃 |
We shipped 7.x without our internal newtonsoft. |
Is your feature request related to a problem? Please describe.
When creating token:
there is used TokenUtilities.GetClaimValueUsingValueType() method which uses internal types (JArray, JObject from Microsoft.IdentityModel.Json.Linq). Then the System.IdentityModel.Tokens.Jwt.JsonExtensions.Serializer is called where JwtPayload is serialized. But JwtPayload contains objects with internal types (JArray, JObject) and when using custom serializer there is problem to detect how to serialize this object.
So the internal serializer is not quite internal, because its types are required to be public to properly handle library.
Describe the solution you'd like
Remove internal Microsoft.IdentityModel.Json serializer and use System.Text.Json.
Describe alternatives you've considered
Make internal serializer public - accessible from outside of assembly.
The text was updated successfully, but these errors were encountered: