diff options
author | Kali Kaneko <kali@leap.se> | 2015-12-08 21:04:11 -0400 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2015-12-15 12:31:04 -0400 |
commit | 98384361a7c49ad4e0ff0127fd923a8b72cc910a (patch) | |
tree | c315b65397ac97210d6f1a3ee5e521b4d8917678 /src/leap/bitmask/backend/components.py | |
parent | 6c0299e7e2df65651ff8738fa18acbc08af18c32 (diff) |
[feat] adapt to use cred-based authentication for imap
This includes getting the token for the imap authentication, and
displaying it on the help window.
- Resolves: #4469
- Releases: 0.10.0
Diffstat (limited to 'src/leap/bitmask/backend/components.py')
-rw-r--r-- | src/leap/bitmask/backend/components.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/leap/bitmask/backend/components.py b/src/leap/bitmask/backend/components.py index 5f34d290..a07d3bad 100644 --- a/src/leap/bitmask/backend/components.py +++ b/src/leap/bitmask/backend/components.py @@ -763,6 +763,7 @@ class Soledad(object): self._signaler = signaler self._soledad_bootstrapper = SoledadBootstrapper(signaler) self._soledad_defer = None + self._service_tokens = {} def bootstrap(self, username, domain, password): """ @@ -786,6 +787,7 @@ class Soledad(object): provider_config, username, password, download_if_needed=True) self._soledad_defer.addCallback(self._set_proxies_cb) + self._soledad_defer.addCallback(self._set_service_tokens_cb) else: if self._signaler is not None: self._signaler.signal(self._signaler.soledad_bootstrap_failed) @@ -793,6 +795,21 @@ class Soledad(object): return self._soledad_defer + def _set_service_tokens_cb(self, result): + + def register_imap_token(imap_token): + self._service_tokens['imap'] = imap_token + if self._signaler is not None: + self._signaler.signal( + self._signaler.soledad_got_service_token, + ('imap', imap_token)) + + sol = self._soledad_bootstrapper.soledad + d = sol.get_or_create_service_token('imap') + d.addCallback(register_imap_token) + d.addCallback(lambda _: result) + return d + def _set_proxies_cb(self, _): """ Update the soledad and keymanager proxies to reference the ones created @@ -803,6 +820,12 @@ class Soledad(object): zope.proxy.setProxiedObject(self._keymanager_proxy, self._soledad_bootstrapper.keymanager) + def get_service_token(self, service): + """ + Get an authentication token for a given service. + """ + return self._service_tokens.get(service, '') + def load_offline(self, username, password, uuid): """ Load the soledad database in offline mode. |