From c533900a43f5006e6b4cb9d070b4bd30fb67f0b5 Mon Sep 17 00:00:00 2001 From: Tomas Touceda Date: Fri, 10 May 2013 16:41:42 -0300 Subject: Save auth token --- src/leap/crypto/srpauth.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') diff --git a/src/leap/crypto/srpauth.py b/src/leap/crypto/srpauth.py index 9446cee8..26bd0295 100644 --- a/src/leap/crypto/srpauth.py +++ b/src/leap/crypto/srpauth.py @@ -82,6 +82,8 @@ class SRPAuth(QtCore.QObject): self._session_id_lock = QtCore.QMutex() self._uid = None self._uid_lock = QtCore.QMutex() + self._token = None + self._token_lock = QtCore.QMutex() self._srp_user = None self._srp_a = None @@ -240,10 +242,12 @@ class SRPAuth(QtCore.QObject): M2 = auth_result.json().get("M2", None) uid = auth_result.json().get("id", None) + token = auth_result.json().get("token", None) events_signal(proto.CLIENT_UID, content=uid) self.set_uid(uid) + self.set_token(token) if M2 is None or self.get_uid() is None: logger.error("Something went wrong. Content = %r" % @@ -356,6 +360,14 @@ class SRPAuth(QtCore.QObject): QtCore.QMutexLocker(self._uid_lock) return self._uid + def set_token(self, token): + QtCore.QMutexLocker(self._token_lock) + self._token = token + + def get_token(self, token): + QtCore.QMutexLocker(self._token_lock) + return self._token + __instance = None authentication_finished = QtCore.Signal(bool, str) -- cgit v1.2.3