Invalid validation of non-present expiration JWT claims
See original GitHub issueThe validators accepts nullable notBefore
and expires
DateTime
s but return values from JsonWebToken
ValidFrom
and ValidTo
properties return DateTime.MinValue
if the claim is not present. So in my opinion JsonWebTokenHandler
fails to properly convert it to nullable values.
As a result SecurityTokenNoExpirationException
with IDX10225
is never thrown.
The best way to handle this would be to change JsonWebToken
results to nullable, but I guess it would be a big breaking change.
Note: the above code snippets are from 6.8.0
branch but dev
is at the same state (as of authoring this issue).
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Solved: Facing issue with Verify JWT Policy
They want to validate that the signature is correct for the JWT, and that the JWT is not expired, and that some expected...
Read more >How To Validate a JWT Token
The "exp" (expiration time) claim identifies the expiration time on or after which the JWT MUST NOT be accepted for processing. The processing...
Read more >How to validate bearer JWT access tokens
JWT claims check -- The JWT claims set is validated, to ensure the token has not expired and has the expected issuer, audience...
Read more >Invalidating JSON Web Tokens
I'd implement by putting invalidated tokens in redis, memcached or another in-memory datastore that supports setting an expiration time on a key ...
Read more >Azure API Management policy reference - validate-jwt
Reference for the validate-jwt policy available for use in Azure API ... Specifies whether an expiration claim is required in the token.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@shadow-cs @GeoK i think consistency between the two handlers would be a good thing. As you suggest @GeoK a simple change to JsonWebTokenHandler should do the trick.
Any chance this will make it into a 6.8.x?
I’m currently working around with a custom
TokenValidationParameters.LifetimeValidator
of the formbut this feels awkward and brittle.
Also, I’m using
JsonWebTokenHandler
on 2 different projects and would rather not duplicate the above.