def _verify_time_range(payload_dict):
 now = int(time.time())
 issued_at = payload_dict.get('iat')
 if (issued_at is None):
  raise AppIdentityError('No iat field in token: {0}'.format(payload_dict))
 expiration = payload_dict.get('exp')
 if (expiration is None):
  raise AppIdentityError('No exp field in token: {0}'.format(payload_dict))
 if (expiration >= (now + MAX_TOKEN_LIFETIME_SECS)):
  raise AppIdentityError('exp field too far in future: {0}'.format(payload_dict))
 earliest = (issued_at - CLOCK_SKEW_SECS)
 if (now < earliest):
  raise AppIdentityError('Token used too early, {0} < {1}: {2}'.format(now, earliest, payload_dict))
 latest = (expiration + CLOCK_SKEW_SECS)
 if (now > latest):
  raise AppIdentityError('Token used too late, {0} > {1}: {2}'.format(now, latest, payload_dict))

def _verify_time_range ( payload_dict ) : now = int ( time . time ( ) ) issued_at = payload_dict . get ( 'iat' ) if ( issued_at is None ) : raise AppIdentityError ( 'No iat field in token: {0}' . format ( payload_dict ) ) expiration = payload_dict . get ( 'exp' ) if ( expiration is None ) : raise AppIdentityError ( 'No exp field in token: {0}' . format ( payload_dict ) ) if ( expiration >= ( now + MAX_TOKEN_LIFETIME_SECS ) ) : raise AppIdentityError ( 'exp field too far in future: {0}' . format ( payload_dict ) ) earliest = ( issued_at - CLOCK_SKEW_SECS ) if ( now < earliest ) : raise AppIdentityError ( 'Token used too early, {0} < {1}: {2}' . format ( now , earliest , payload_dict ) ) latest = ( expiration + CLOCK_SKEW_SECS ) if ( now > latest ) : raise AppIdentityError ( 'Token used too late, {0} > {1}: {2}' . format ( now , latest , payload_dict ) )
verifies the issued at and expiration from a jwt payload .