diff options
Diffstat (limited to 'service/pixelated/bitmask_libraries/provider.py')
-rw-r--r-- | service/pixelated/bitmask_libraries/provider.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/service/pixelated/bitmask_libraries/provider.py b/service/pixelated/bitmask_libraries/provider.py index 1564c974..315ea7f1 100644 --- a/service/pixelated/bitmask_libraries/provider.py +++ b/service/pixelated/bitmask_libraries/provider.py @@ -17,7 +17,7 @@ import json from leap.common.certs import get_digest import requests -from .certs import which_bootstrap_CA_bundle, which_api_CA_bundle, which_bootstrap_cert_fingerprint +from .certs import LeapCertificate from pixelated.support.tls_adapter import EnforceTLSv1Adapter @@ -26,7 +26,6 @@ class LeapProvider(object): self.server_name = server_name self.config = config self.local_ca_crt = '%s/ca.crt' % self.config.leap_home - self.provider_json = self.fetch_provider_json() @property @@ -99,8 +98,8 @@ class LeapProvider(object): def _validated_get(self, url): session = requests.session() try: - session.mount('https://', EnforceTLSv1Adapter(assert_fingerprint=which_bootstrap_cert_fingerprint())) - response = session.get(url, verify=which_bootstrap_CA_bundle(self), timeout=self.config.timeout_in_s) + session.mount('https://', EnforceTLSv1Adapter(assert_fingerprint=LeapCertificate.LEAP_FINGERPRINT)) + response = session.get(url, verify=LeapCertificate(self).provider_web_cert, timeout=self.config.timeout_in_s) response.raise_for_status() return response finally: @@ -115,16 +114,19 @@ class LeapProvider(object): def fetch_soledad_json(self): service_url = "%s/%s/config/soledad-service.json" % ( self.api_uri, self.api_version) - response = requests.get(service_url, verify=which_api_CA_bundle(self), timeout=self.config.timeout_in_s) + response = requests.get(service_url, verify=LeapCertificate(self).provider_api_cert, timeout=self.config.timeout_in_s) response.raise_for_status() return json.loads(response.content) def fetch_smtp_json(self): service_url = '%s/%s/config/smtp-service.json' % ( self.api_uri, self.api_version) - response = requests.get(service_url, verify=which_api_CA_bundle(self), timeout=self.config.timeout_in_s) + response = requests.get(service_url, verify=LeapCertificate(self).provider_api_cert, timeout=self.config.timeout_in_s) response.raise_for_status() return json.loads(response.content) def _provider_base_url(self): return 'https://%s' % self.server_name + + def address_for(self, username): + return '%s@%s' % (username, self.domain) |