diff options
author | Kali Kaneko (leap communications) <kali@leap.se> | 2017-04-20 15:06:16 +0200 |
---|---|---|
committer | Kali Kaneko (leap communications) <kali@leap.se> | 2017-04-20 18:15:38 +0200 |
commit | 291a2a87a998938b8ab29e9e5562e6ac10e9672f (patch) | |
tree | e0afb8ae43f2cc7cf7c723397bead9c71545598e /src/leap/bitmask | |
parent | 3810cfb433308dd9ced9c2185ecbb5f206e07f4c (diff) |
[feat] add bonafide authentication event
- Resolves: #8844
Diffstat (limited to 'src/leap/bitmask')
-rw-r--r-- | src/leap/bitmask/bonafide/service.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/leap/bitmask/bonafide/service.py b/src/leap/bitmask/bonafide/service.py index 0a78813..0f9c628 100644 --- a/src/leap/bitmask/bonafide/service.py +++ b/src/leap/bitmask/bonafide/service.py @@ -21,9 +21,10 @@ Bonafide Service. import os from collections import defaultdict -from leap.common.config import get_path_prefix from leap.bitmask.bonafide._protocol import BonafideProtocol from leap.bitmask.hooks import HookableService +from leap.common.config import get_path_prefix +from leap.common.events import catalog, emit_async from twisted.internet import defer from twisted.logger import Logger @@ -66,6 +67,11 @@ class BonafideService(HookableService): self.trigger_hook('on_bonafide_auth', **data) return result + def trigger_event(result): + _, uuid = result + emit_async(catalog.BONAFIDE_AUTH_DONE, uuid, username) + return result + # XXX I still have doubts from where it's best to trigger this. # We probably should wait for BOTH deferreds and # handle local and remote authentication success together @@ -76,6 +82,7 @@ class BonafideService(HookableService): d = self._bonafide.do_authenticate(username, password, autoconf) d.addCallback(notify_bonafide_auth) + d.addCallback(trigger_event) d.addCallback(lambda response: { 'srp_token': response[0], 'uuid': response[1]}) return d |