You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When we validate the a token signature, we should also validate that our user's token has not been invalidated...
defis_jwt_blacklisted(decoded_JWT, reject):
# Is "badguy1231" in blacklist? ifdecoded_JWT["urs-user-id"] inreject["blacklist"]:
# Shortcutsurs_user_id=decoded_JWT["urs-user-id"]
jwt_mint_time=decoded_JWT["iat"]}
user_blackist_time=reject["blacklist"][urs_user_id]
log.debug(f"JWT was minted @ {jwt_mint_time}, Blacklist is for cookies BEFORE {user_blackist_time}")
# Is blackist date "1619104148" >= JWT mint date "1619103148"ifuser_blackist_time>=jwt_mint_time:
log.info(f"User {urs_user_id}'s JWT was minted before blacklist date and is INVALID")
returnTrueelse:
# User appears in the blacklist, but this token is newerlog.info(f"User {urs_user_id'sJWTwasmintedAFTERblacklistdateandisstillVALID")
# User is not in the blacklistlog.info((f"User {urs_user_id} is NOT in the blacklist")
returnFalse
Right now we can change the JWT secret, but that would invalidate ALL sessions.
It would be nice if we could kill ONE specific user session.
I'm not sure how we could pull it off, but it'd be a useful feature.
The text was updated successfully, but these errors were encountered: