Commit 181dc51
committed
Report out-of-range NumericDate claims distinctly from non-numeric ones
exp, nbf and iat are NumericDate claims, which per RFC 7519 are JSON
numbers and may be written in scientific notation. getInstantFromSeconds
gated on canConvertToLong() and threw "contained a non-numeric date
value" when it was false. For a numeric value that overflows a long
(for example 1.733162101e+26 from issue #706) that message is wrong: the
value is numeric, just not representable as a NumericDate.
Split the two failure modes so a genuinely non-numeric value keeps the
existing message, while a numeric value that does not fit a long throws a
message naming the value and the real reason. In-range scientific values
such as 1.7e9 continue to decode to the correct instant.
Fixes #706
Signed-off-by: Arpit Jain <arpitjain099@gmail.com>1 parent 695fd2b commit 181dc51
2 files changed
Lines changed: 39 additions & 1 deletion
File tree
- lib/src
- main/java/com/auth0/jwt/impl
- test/java/com/auth0/jwt/impl
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
78 | 83 | | |
79 | 84 | | |
80 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
81 | 91 | | |
82 | 92 | | |
83 | 93 | | |
| |||
Lines changed: 28 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
244 | 272 | | |
245 | 273 | | |
246 | 274 | | |
| |||
0 commit comments