Earlier quoted context omitted.
Sure why not? Each user account has a counter or timestamp on it in the user registry. If the JWT token in the request passes crypto validation but it has an older counter/timestamp than held in the user registry then it is deemed invalid and the user must re-authenticate. This is still a horizontally scalable design.
This “user registry” of yours sounds an awful lot like a traditional session table in a central DB. Could you elaborate a bit on that in terms of horizontal scalability please?
Stop using JWT for sessions (2016)
251–255 of 255 posts
Re: Stop using JWT for sessions (2016)
#252Earlier quoted context omitted.
Sure why not? Each user account has a counter or timestamp on it in the user registry. If the JWT token in the request passes crypto validation but it has an older counter/timestamp than held in the user registry then it is deemed invalid and the user must re-authenticate. This is still a horizontally scalable design.
Then you are back to statefulness if you need to check this magic "count" every request.
Re: Stop using JWT for sessions (2016)
#253Earlier quoted context omitted.
Cookies are implementation dependent. It's quite possible that a user agent doesn't honour what you instructed it to do regarding the expiration of a cookie. JWT however... your server side can validate its own token in whatever ways it wants (including expiration). You can't get more secure than that.
If you checking the session on the server, you might as well just use a token in a cookie. The point of the JWT complexity is to avoid that.
Re: Stop using JWT for sessions (2016)
#254I use JWT for authentication on my current project. And I eventually ended up having to check the user's 'role' in the database for authorization before I let them do anything anyway (and consequently, revoking someone's user role or suspending their account has immediate effect). I saw many examples on the net of people putting role/authorization and various other types of session information within the JWT and it j…
> I saw many examples on the net of people putting role/authorization and various other types of session information within the JWT and it just looked insane to me. Why is this crazy? If you encrypt your JWT with a private key that is only known to the server, then any modification to the JWT will lead to an invalid token. The only thing here is that the list of roles granted is visible to the user if they were to de…
Re: Stop using JWT for sessions (2016)
#255Earlier quoted context omitted.
Traversing a list of 100,000 users/sessions in a db to pull up the session is a different beast compared to traversing an in memory list of 10-100 revoked JTIs in redis. It is a lot less data to store and optimize (the full session vs. a small list of revoked JTIs)
> Traversing a list of 100,000 users/sessions in a db to pull up the session is a different beast compared to traversing an in memory list of 10-100 revoked JTIs in redis. It is a lot less data to store and optimize (the full session vs. a small list of revoked JTIs) I don't see why one can't use redis to persist sessions at first place and why your list of revoked token would be limited to 100.