auth0 / java-jwt

Java implementation of JSON Web Token (JWT)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow using custom ObjectMapper for JWTParser

michael4screen opened this issue · comments

Checklist

  • I have looked into the Readme and Examples, and have not found a suitable solution or answer.
  • I have looked into the API documentation and have not found a suitable solution or answer.
  • I have searched the issues and have not found a suitable solution or answer.
  • I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • I agree to the terms within the Auth0 Code of Conduct.

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

👋 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.

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.