File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -196,16 +196,23 @@ def _extract_expiry(self, jwt):
196196 except Exception as original_exception :
197197 raise Exception ('%s: "%s"' % (error_message , original_exception ))
198198
199- if not type (jwt_data_parsed ) is dict and not 'exp' in jwt_data_parsed . keys () :
199+ if not type (jwt_data_parsed ) is dict :
200200 raise Exception (error_message )
201201
202- try :
203- expiry = int (jwt_data_parsed ['exp' ])
202+ if 'exp' in jwt_data_parsed .keys ():
203+ try :
204+ expiry = int (jwt_data_parsed ['exp' ])
204205
205- except Exception as original_exception :
206- raise Exception ('%s: "%s"' % (error_message , original_exception ))
206+ except Exception as original_exception :
207+ raise Exception ('%s: "%s"' % (error_message , original_exception ))
208+
209+ _log .debug ('Extracted expiry time: %i' % expiry )
210+
211+ # Seems that expiry isn't always passed on, set token to expire in 1 hour in those cases
212+ else :
213+ expiry = int (time .time () + 3600 )
207214
208- _log .debug ('Extracted expiry time: %i' % expiry )
215+ _log .debug ('Expiry not found in JWT, expiry time set to : %i' % expiry )
209216
210217 return expiry
211218
You can’t perform that action at this time.
0 commit comments