@@ -189,22 +189,22 @@ def __init__(
189189 """
190190
191191 self ._keys = []
192- self .remote = False
193- self .local = False
194192 self .cache_time = cache_time
195- self .ignore_errors_period = ignore_errors_period
196- self .ignore_errors_until = None # UNIX timestamp of last error
197- self .time_out = 0
198193 self .etag = ""
199- self .source = None
200194 self .fileformat = fileformat .lower ()
195+ self .ignore_errors_period = ignore_errors_period
196+ self .ignore_errors_until = None # UNIX timestamp of last error
197+ self .ignore_invalid_keys = ignore_invalid_keys
198+ self .imp_jwks = None
201199 self .keytype = keytype
202200 self .keyusage = keyusage
203- self .imp_jwks = None
204- self .last_updated = 0
205- self .last_remote = None # HTTP Date of last remote update
206201 self .last_local = None # UNIX timestamp of last local update
207- self .ignore_invalid_keys = ignore_invalid_keys
202+ self .last_remote = None # HTTP Date of last remote update
203+ self .last_updated = 0
204+ self .local = False
205+ self .remote = False
206+ self .source = None
207+ self .time_out = 0
208208
209209 if httpc :
210210 self .httpc = httpc
@@ -761,16 +761,22 @@ def dump(self, cutoff: Optional[list] = None):
761761
762762 res = {
763763 "keys" : _keys ,
764+ "cache_time" : self .cache_time ,
765+ "etag" : self .etag ,
764766 "fileformat" : self .fileformat ,
765- "last_updated" : self .last_updated ,
766- "last_remote" : self .last_remote ,
767- "last_local" : self .last_local ,
768767 "httpc_params" : self .httpc_params ,
769- "remote" : self .remote ,
770- "local" : self .local ,
768+ "ignore_errors_period" : self .ignore_errors_period ,
769+ "ignore_errors_until" : self .ignore_errors_until ,
770+ "ignore_invalid_keys" : self .ignore_invalid_keys ,
771771 "imp_jwks" : self .imp_jwks ,
772+ "keytype" : self .keytype ,
773+ "keyusage" : self .keyusage ,
774+ "last_local" : self .last_local ,
775+ "last_remote" : self .last_remote ,
776+ "last_updated" : self .last_updated ,
777+ "local" : self .local ,
778+ "remote" : self .remote ,
772779 "time_out" : self .time_out ,
773- "cache_time" : self .cache_time ,
774780 }
775781
776782 if self .source :
@@ -782,17 +788,45 @@ def load(self, spec):
782788 _keys = spec .get ("keys" , [])
783789 if _keys :
784790 self .do_keys (_keys )
785- self .source = spec .get ("source" , None )
791+ self .cache_time = spec .get ("cache_time" , 0 )
792+ self .etag = spec .get ("etag" , "" )
786793 self .fileformat = spec .get ("fileformat" , "jwks" )
787- self .last_updated = spec .get ("last_updated" , 0 )
788- self .last_remote = spec .get ("last_remote" , None )
794+ self .httpc_params = spec .get ("httpc_params" , {})
795+ self .ignore_errors_period = spec .get ("ignore_errors_period" , 0 )
796+ self .ignore_errors_until = spec .get ("ignore_errors_until" , None )
797+ self .ignore_invalid_keys = spec .get ("ignore_invalid_keys" , True )
798+ self .imp_jwks = spec .get ("imp_jwks" , None )
799+ self .keytype = (spec .get ("keytype" , "RSA" ),)
800+ self .keyusage = (spec .get ("keyusage" , None ),)
789801 self .last_local = spec .get ("last_local" , None )
790- self .remote = spec .get ("remote" , False )
802+ self .last_remote = spec .get ("last_remote" , None )
803+ self .last_updated = spec .get ("last_updated" , 0 )
791804 self .local = spec .get ("local" , False )
792- self .imp_jwks = spec .get ("imp_jwks" , None )
805+ self .remote = spec .get ("remote" , False )
806+ self .source = spec .get ("source" , None )
793807 self .time_out = spec .get ("time_out" , 0 )
794- self .cache_time = spec .get ("cache_time" , 0 )
795- self .httpc_params = spec .get ("httpc_params" , {})
808+ return self
809+
810+ def flush (self ):
811+ self ._keys = []
812+ self .cache_time = (300 ,)
813+ self .etag = ""
814+ self .fileformat = "jwks"
815+ # self.httpc=None,
816+ self .httpc_params = (None ,)
817+ self .ignore_errors_period = 0
818+ self .ignore_errors_until = None
819+ self .ignore_invalid_keys = True
820+ self .imp_jwks = None
821+ self .keytype = ("RSA" ,)
822+ self .keyusage = (None ,)
823+ self .last_local = None # UNIX timestamp of last local update
824+ self .last_remote = None # HTTP Date of last remote update
825+ self .last_updated = 0
826+ self .local = False
827+ self .remote = False
828+ self .source = None
829+ self .time_out = 0
796830 return self
797831
798832
0 commit comments