Closed
Description
Summary
Nimbus coerces JWT temporal fields, that is exp
, iat
, and nbf
, into java.util.Date
.
NimbusJwtDecoderJwkSupport
then takes the underlying Map<String, Object>
from Nimbus and copies it into a Jwt
.
Jwt
, inheriting from ClaimsAccessor
, anticipates this field to be a Long
:
default Instant getClaimAsInstant(String claim) {
if (!this.containsClaim(claim)) {
return null;
}
try {
return Instant.ofEpochMilli(Long.valueOf(this.getClaimAsString(claim)));
} catch (NumberFormatException ex) {
throw new IllegalArgumentException("Unable to convert claim '" + claim + "' to Instant: " + ex.getMessage(), ex);
}
}
Thus, when a Jwt
is created from a Nimbus-parsed JWT, calling this method results in an IllegalArgumentException
.
Actual Behavior
NimbusJwtDecoderJwkSupport decoder = // ... instance
Jwt jwt = decoder.decode(token);
jwt.getNotBefore() <== throws IllegalArgumentException
Expected Behavior
It would not throw said exception
Version
5.1.0.M1