summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/bonafide/_protocol.py
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2016-09-06 19:27:31 +0200
committerKali Kaneko (leap communications) <kali@leap.se>2016-09-07 10:04:45 -0400
commit7a6e187e0a970ad6fb722fc9dfd3be784b254c06 (patch)
tree70092fe6f1635b7a22266c8e136510eb6934f162 /src/leap/bitmask/bonafide/_protocol.py
parent1d51bc24ec9afcbb30b05905217bc7aafedca5f1 (diff)
[feat] Add manual provider registration
- Resolves: #8400
Diffstat (limited to 'src/leap/bitmask/bonafide/_protocol.py')
-rw-r--r--src/leap/bitmask/bonafide/_protocol.py22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/leap/bitmask/bonafide/_protocol.py b/src/leap/bitmask/bonafide/_protocol.py
index 39865402..ff357a14 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):