duosecurity / duo_api_csharp

Other
32 stars 31 forks source link

Library Refactor for DotNet 8 and Signature Version 5 #37

Open Bottswana opened 2 months ago

Bottswana commented 2 months ago

Description

This PR represents a significant rewrite of the library to bring it up to modern dotnet core standards. This includes:

Motivation and Context

Current library state is not usable in modern DotNet projects as it relies on 4.0 framework. This closes issues #30 and #33

How Has This Been Tested?

Test suite has been adapted to include test coverage of the library. Other tests concluded via Examples project. Additional testing will be required as more endpoints are added.

Types of Changes

This represents significant breaking changes.

Next Steps

Additional work will need to be completed. More tests are needed to ensure code coverage, and the remaining API endpoints need to be implemented.

I will continue to do so as time permits

Additionally, a maintainer should look into setting up a Actions pipeline to upload tagged releases to NuGet, as many developers will expect the package to be available in the dotnet ecosystem package library.

m33p commented 2 months ago

Hi @Bottswana I have a question. Why did you choose Newtonsoft over System.Text.Json. The duo_universal_csharp project currently uses System.Text.Json and does not use Newtonsoft. It there something in Newtonsoft that cannot be accomplished with System.Text.Json?

System.Text.Json Positives:

https://trevormccubbin.medium.com/net-performance-analysis-newtonsoft-json-vs-system-text-json-in-net-8-34520c21d054

Bottswana commented 2 months ago

Hi @Bottswana I have a question. Why did you choose Newtonsoft over System.Text.Json. The duo_universal_csharp project currently uses System.Text.Json and does not use Newtonsoft. It there something in Newtonsoft that cannot be accomplished with System.Text.Json?

System.Text.Json Positives:

  • Its included .NET
  • Less memory allocation then Newtonsoft.
  • Its faster than Newtonsoft.

https://trevormccubbin.medium.com/net-performance-analysis-newtonsoft-json-vs-system-text-json-in-net-8-34520c21d054

Hi,

I simply have far more experience across all my projects with the battle tested Newtonsoft over the .NET equivalent. It's also used in many projects and I have a lot more faith in it when writing custom serialisers, which in this case was needed to convert native types to string on the fly for the Duo API.

I would rather focus time on building additional endpoints than changing the JSON library, and while I do not mind if it was something different, I am unlikely to dedicate time to changing it as part of this PR unless someone else wanted to commit the time and test that it is working correctly.