Merge pull request #190 from coreos-inc/timezone

Fromtimestamp needs to be in UTC for JWT auth
This commit is contained in:
Jake Moshenko 2015-06-30 12:05:00 -04:00
commit 38a5963afe

View file

@ -100,7 +100,8 @@ class JWTAuthUsers(object):
raise Exception('Missing exp field in JWT')
# Verify that the expiration is no more than 300 seconds in the future.
if datetime.fromtimestamp(payload['exp']) > datetime.utcnow() + timedelta(seconds=300):
expiration = datetime.utcfromtimestamp(payload['exp'])
if expiration > datetime.utcnow() + timedelta(seconds=300):
logger.debug('Payload expiration is outside of the 300 second window: %s', payload['exp'])
return (None, 'Invalid username or password')