auth0 / java-jwt

Java implementation of JSON Web Token (JWT)
MIT License
5.83k stars 921 forks source link

Allow using custom ObjectMapper for JWTParser #664

Open michael4screen opened 1 year ago

michael4screen commented 1 year ago

Checklist

Describe the problem you'd like to have solved

I would like to use my custom ObjectMapper with the JWTParser. I'm using kotlin and the default ObjectMapper is not equipped with the jackson kotlin module. I see there is a constructor JWTParser(ObjecMapper objectmapper) but unfortunately its package private, so I have no possibility to use it.

Describe the ideal solution

Make the JWTParser(ObjecMapper objectmapper) constructor protected/public

Alternatives and current workarounds

As a current workaround I'm working with @JsonProperty annotations on my POJOs to make it work with the default ObjectMapper.

Additional context

No response

jimmyjames commented 1 year ago

👋 hi @michael4screen, thanks for the issue and info. Any chance you could provide a little sample to demonstrate the issue? The constructor is not public because we don't want to expose internal dependencies as part of the public API. Perhaps there's a different way we can help get this working for you without exposing the Jackson dependency as part of the public API.

adam-gray commented 1 year ago

Hi @jimmyjames, I'd like to be able to configure the ObjectMapper used in JWTParser to be able to use the Afterburner module for performance testing. Registering the module is a trivial change.

If a configurable ObjectMapper isn't in the cards, it might be worth adding the Afterburner module regardless. Let me know if I should open a new issue for that, as I don't want to take away from @michael4screen's need to reconfigure ObjectMapper for reasons other than performance.