diff options
author | Kali Kaneko (leap communications) <kali@leap.se> | 2016-12-12 02:41:02 +0100 |
---|---|---|
committer | Kali Kaneko (leap communications) <kali@leap.se> | 2016-12-29 03:09:56 +0100 |
commit | 4378cf0b0c454dd5de6d40a9bb59eef653a25a41 (patch) | |
tree | 6be67727f2c053039fce5e2815c072e5470cf902 /src/leap | |
parent | 0812b5a563d4cf754595c905183618bbebe2cf55 (diff) |
[feature] pass local auth token after authentication succeeds
Diffstat (limited to 'src/leap')
-rw-r--r-- | src/leap/bitmask/core/dispatcher.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/leap/bitmask/core/dispatcher.py b/src/leap/bitmask/core/dispatcher.py index b068683..3a5b5f1 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 |