uruk-project / Jwt

JSON Web Token implementation for .Net & .Net Core
MIT License
80 stars 13 forks source link

JWKS ToString broken on 1.9.1 #550

Closed watfordgnf closed 3 years ago

watfordgnf commented 3 years ago

We've begun serializing our JWKS to a well known location and found that under v1.9.1 it is broken. The fix was applied as part of a pre-release: https://github.com/uruk-project/Jwt/commit/79695d7c62691769198a6d1c53814b4bbf86a02d#diff-d3b4dcfad73c68c10c1bc32d6fe3679468c657c1f05200384b59204959c0fbea

Is there a possibility of getting a v1.9.2 with just that targeted fix for JWKS? I'm willing to put together the PR and tests if that's a barrier.

ycrumeyrolle commented 3 years ago

Fixed in 1.9.2. For your use case, I also change the visibility of the method void WriteTo(Utf8JsonWriter writer) to public.

  // this code is not tested...
  using (var writer = new Utf8JsonWriter(context.Response.Body))
  {
    jwks.WriteTo(writer);
    writer.Flush();
  }

By doing so, you will avoid to allocate an UTF-16 string before to write to the response body

watfordgnf commented 3 years ago

I very much appreciate the rapid turnaround!