summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/bonafide
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2017-02-09 17:24:25 +0100
committerRuben Pollan <meskio@sindominio.net>2017-02-23 00:26:46 +0100
commit59cd23bd3e23bf2b439ad26271733a1b5c8edf68 (patch)
treef8c82c7cc5e0e2fbda93e6fc92a08852a60d1961 /src/leap/bitmask/bonafide
parent9f2b3b55ef08d908220f0b401aeec375d1c5ea07 (diff)
[feat] eliminate the active user from bonafide
Active user is now only a concept of the cli. For it we add a ~/.config/leap/bitmaskctl.cfg file. - Resolves: #8769
Diffstat (limited to 'src/leap/bitmask/bonafide')
-rw-r--r--src/leap/bitmask/bonafide/service.py25
1 files changed, 2 insertions, 23 deletions
diff --git a/src/leap/bitmask/bonafide/service.py b/src/leap/bitmask/bonafide/service.py
index d48a54a..37d1e21 100644
--- a/src/leap/bitmask/bonafide/service.py
+++ b/src/leap/bitmask/bonafide/service.py
@@ -42,10 +42,6 @@ class BonafideService(HookableService):
self._bonafide = BonafideProtocol()
self.service_hooks = defaultdict(list)
- # XXX this is a quick hack to get a ref
- # to the latest authenticated user.
- self._active_user = None
-
def startService(self):
logger.debug('starting Bonafide Service')
super(BonafideService, self).startService()
@@ -68,8 +64,6 @@ class BonafideService(HookableService):
data = dict(username=username, token=token, uuid=uuid,
password=password)
self.trigger_hook('on_bonafide_auth', **data)
-
- self._active_user = username
return result
# XXX I still have doubts from where it's best to trigger this.
@@ -93,18 +87,10 @@ class BonafideService(HookableService):
return d
def do_logout(self, username):
- if not username:
- username = self._active_user
-
- def reset_active(passthrough):
- self._active_user = None
- return passthrough
-
data = dict(username=username)
self.trigger_hook('on_bonafide_logout', **data)
d = self._bonafide.do_logout(username)
- d.addCallback(reset_active)
d.addCallback(lambda response: {'logout': 'ok'})
return d
@@ -134,18 +120,11 @@ class BonafideService(HookableService):
def do_provider_list(self, seeded=False):
return self._bonafide.do_provider_list(seeded)
- def do_get_smtp_cert(self, username=None):
- if not username:
- username = self._active_user
+ def do_get_smtp_cert(self, username):
if not username:
return defer.fail(
- RuntimeError('No active user, cannot get SMTP cert.'))
+ RuntimeError('No username, cannot get SMTP cert.'))
d = self._bonafide.do_get_smtp_cert(username)
d.addCallback(lambda response: (username, response))
return d
-
- def do_get_active_user(self):
- user = self._active_user or '<none>'
- info = {'user': user}
- return defer.succeed(info)