Keats / jsonwebtoken

JWT lib in rust
MIT License
1.69k stars 269 forks source link

JWT Parsing fails when exp is a float #212

Closed emeryc closed 3 years ago

emeryc commented 3 years ago

I was trying to figure out if people in my company were crazy, or if this was a part of the spec. Turns out that float times are part of the spec as mentioned in this bug report on somebody else's JWT library in a different language. https://github.com/open-policy-agent/opa/issues/1296#issue-426476169

This is causing me a bit of a problem because others in my company are using float JWTs because javascript libraries and java libraries think that this is a feature.

I'm happy to open a PR and just change the times from u64 to f64. Or any other answer that you think is better.

Keats commented 3 years ago

Well float timestamps makes no fucking sense :( I'll take a PR that adds a newtype NumericDate that has a custom serde impl that automatically rounds any float it gets, I think this should take care of it?

The PR should be done on the next branch

Keats commented 3 years ago

It's released in v8 beta 5