diff options
Diffstat (limited to 'src/leap/bitmask/bonafide/_protocol.py')
-rw-r--r-- | src/leap/bitmask/bonafide/_protocol.py | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/leap/bitmask/bonafide/_protocol.py b/src/leap/bitmask/bonafide/_protocol.py index 3986540..ff357a1 100644 --- a/src/leap/bitmask/bonafide/_protocol.py +++ b/src/leap/bitmask/bonafide/_protocol.py @@ -21,10 +21,10 @@ import os import resource from collections import defaultdict -from leap.common.config import get_path_prefix from leap.bitmask.bonafide import config from leap.bitmask.bonafide.provider import Api from leap.bitmask.bonafide.session import Session, OK +from leap.common.config import get_path_prefix from twisted.cred.credentials import UsernamePassword from twisted.internet.defer import fail @@ -77,11 +77,11 @@ class BonafideProtocol(object): # Service public methods - def do_signup(self, full_id, password): + def do_signup(self, full_id, password, autoconf=False): log.msg('SIGNUP for %s' % full_id) _, provider_id = config.get_username_and_provider(full_id) - provider = config.Provider(provider_id) + provider = config.Provider(provider_id, autoconf=autoconf) d = provider.callWhenReady( self._do_signup, provider, full_id, password) return d @@ -102,10 +102,10 @@ class BonafideProtocol(object): d.addErrback(self._del_session_errback, full_id) return d - def do_authenticate(self, full_id, password): + def do_authenticate(self, full_id, password, autoconf=False): _, provider_id = config.get_username_and_provider(full_id) - provider = config.Provider(provider_id) + provider = config.Provider(provider_id, autoconf=autoconf) def maybe_finish_provider_bootstrap(result, provider): session = self._get_session(provider, full_id, password) @@ -147,6 +147,18 @@ class BonafideProtocol(object): d.addCallback(lambda _: '%s logged out' % full_id) return d + def do_get_provider(self, provider_id, autoconf=False): + provider = config.Provider(provider_id, autoconf=autoconf) + return provider.callWhenMainConfigReady(provider.config) + + def do_provider_delete(self, provider_id): + return config.delete_provider(provider_id) + + def do_provider_list(self, seeded=False): + # TODO: seeded, we don't have pinned providers yet + providers = config.list_providers() + return [{"domain": p} for p in providers] + def do_get_smtp_cert(self, full_id): if (full_id not in self._sessions or not self._sessions[full_id].is_authenticated): |