Invocation of separate threa in get_idp_data() problem resolved

This commit is contained in:
Neven1986 2019-12-14 21:45:51 +01:00
parent cd3535dcd2
commit 894756ad96

View File

@ -34,20 +34,18 @@ class SAML(object):
'SAML: IDP Metadata initial load failed')
exit(-1)
def get_idp_data(self):
### Currently commented out while throwing exception,
### will take a look soon
# lifetime = timedelta(
# minutes=current_app.config['SAML_METADATA_CACHE_LIFETIME'])
# if self.idp_timestamp + lifetime < datetime.now():
# background_thread = Thread(target=self.retrieve_idp_data)
# background_thread.start()
lifetime = timedelta(minutes=current_app.config['SAML_METADATA_CACHE_LIFETIME'])
if self.idp_timestamp + lifetime < datetime.now():
background_thread = Thread(target=self.retrieve_idp_data())
background_thread.start()
self.retrieve_idp_data()
return self.idp_data
def retrieve_idp_data(self):
if 'SAML_IDP_SSO_BINDING' in current_app.config:
@ -162,4 +160,4 @@ class SAML(object):
settings['organization']['en-US']['name'] = 'PowerDNS-Admin'
settings['organization']['en-US']['url'] = own_url
auth = self.OneLogin_Saml2_Auth(req, settings)
return auth
return auth