diff --git a/powerdnsadmin/services/saml.py b/powerdnsadmin/services/saml.py index 9825b21..ac5ad70 100644 --- a/powerdnsadmin/services/saml.py +++ b/powerdnsadmin/services/saml.py @@ -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 \ No newline at end of file + return auth