Replies: 1 comment 1 reply
-
Hi @alexmdac ! I think your best option here (and I think it's a pretty good one IMO), is to use a custom Deserializer implementation that wraps/delegates to the real JSON processor One such way of doing that is described in this comment: Granted, that particular issue was about a non-String Then JJWT and your application will see a String as expected, and you can parse it back into an integer if necessary. It's a little bit of a pain, but it's pretty seamless. It also ensures via internal application code and/or documentation, why you have to do something unexpected due to non-compliant JWT issuers, which is a good thing IMO for future developers and/or code inspection. Plus it gives you a 'hook in' point to do further transformation if you ever receive other non-compliant values. I hope this helps! |
Beta Was this translation helpful? Give feedback.
-
My system needs to accept JWTs that have numeric values for "sub" (a numeric user ID). I cannot migrate the system from jjwt 0.11 to 0.12 because 0.12 rejects JWTs with "sub" claims that are not strings. I understand that numeric "sub" claims are invalid per RFC7519, but unfortunately the system needs to continue to accept old tokens for many more months. Is it somehow possible to configure 0.12 parsers not to check the type of "sub" claims? If not, would it be possible to add such an option?
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions