From 4378cf0b0c454dd5de6d40a9bb59eef653a25a41 Mon Sep 17 00:00:00 2001 From: "Kali Kaneko (leap communications)" Date: Mon, 12 Dec 2016 02:41:02 +0100 Subject: [feature] pass local auth token after authentication succeeds --- src/leap/bitmask/core/dispatcher.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/leap/bitmask/core/dispatcher.py b/src/leap/bitmask/core/dispatcher.py index b068683d..3a5b5f1f 100644 --- a/src/leap/bitmask/core/dispatcher.py +++ b/src/leap/bitmask/core/dispatcher.py @@ -105,14 +105,24 @@ class UserCmd(SubCommand): label = 'bonafide.user' - @register_method("{'srp_token': unicode, 'uuid': unicode}") + @register_method("{'srp_token': unicode, 'uuid': unicode " + "'lcl_token': unicode}") def do_AUTHENTICATE(self, bonafide, *parts): user, password = parts[2], parts[3] autoconf = False if len(parts) > 4: if parts[4] == 'true': autoconf = True - return bonafide.do_authenticate(user, password, autoconf) + + # FIXME We still SHOULD pass a local token + # even if the SRP authentication times out!!! + def add_local_token(result): + result['lcl_token'] = bonafide.local_tokens[user] + return result + + d = bonafide.do_authenticate(user, password, autoconf) + d.addCallback(add_local_token) + return d @register_method("{'signup': 'ok', 'user': str}") def do_CREATE(self, bonafide, *parts): @@ -369,6 +379,8 @@ class CommandDispatcher(object): def do_BONAFIDE(self, *parts): bonafide = self._get_service('bonafide') + bonafide.local_tokens = self.core.tokens + d = self.subcommand_bonafide.dispatch(bonafide, *parts) d.addCallbacks(_format_result, _format_error) return d -- cgit v1.2.3