dvsekhvalnov / jose-jwt

Ultimate Javascript Object Signing and Encryption (JOSE), JSON Web Token (JWT) and Json Web Keys (JWK) Implementation for .NET and .NET Core
MIT License
921 stars 183 forks source link

nimbus-jose-jwt change from JSON Smart to GSon upgrade has breaking changes on serialization and desrialization for jsonObject #241

Closed far768 closed 4 months ago

far768 commented 4 months ago

Issue Description: When generating JWTtoken, Before upgrading to version 9.24+, serialization and de-serialization of a 'JSONObject' containing a class object with a field of type 'Map<String, List>' worked correctly. This was because the getter method was being called during serialization, ensuring proper handling of the data. However, after upgrading to version 9.24+, issues arose where serialization is performed directly on the field type, neglecting to use the getter method for serialization.

Steps to Reproduce:

  1. Define a class with a field of type Map<String, List<String>>.
  2. Ensure the class has appropriate getter and setter methods for the field (In my case it is manipulated to have List type for handling client side use case).
  3. Serialize an instance of this class using JSONObject.
  4. Deserialize the JSON object back into an instance of the class.

Expected Behavior:

Actual Behavior:

Additional Information:

Tech stack:

far768 commented 4 months ago

Additional Information:

for token encryption, using EncryptedJWT and in the encrypt there is process of getPayload().toByetes() in the Payload class where toString() is called and next it goes to the condition where JSONObjectUtils.toJsonString(jsonObject) is called. further the serialization taking place using GSON lib.

dvsekhvalnov commented 4 months ago

Hi @far768 , guess you've posted issue to wrong project?

I'm not a guy behind nimbus library (though do cross compatibility tests against it) and this is other library named jose-jwt :)

far768 commented 4 months ago

yup, realized later, thanks @dvsekhvalnov for correcting.

got the resolution here.

closing this.