summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Touceda <chiiph@leap.se>2013-04-10 09:56:36 -0300
committerTomas Touceda <chiiph@leap.se>2013-04-11 16:02:14 -0300
commitfd17db8aaeda0c5997a608fd2d2e0392eb0c68ae (patch)
treea96e6c675b08d583a50228dbe2946dbd338384a4
parente0032a6c97b3ed766698521c76bc37d0655f4277 (diff)
Emit session_id and uid through events
-rw-r--r--changes/feature_emit_events2
-rw-r--r--src/leap/crypto/srpauth.py11
2 files changed, 12 insertions, 1 deletions
diff --git a/changes/feature_emit_events b/changes/feature_emit_events
new file mode 100644
index 00000000..7abfc667
--- /dev/null
+++ b/changes/feature_emit_events
@@ -0,0 +1,2 @@
+ o Emit events notifying of the session_id and uid after
+ authentication so other services can make use of it. Closes #1957 \ No newline at end of file
diff --git a/src/leap/crypto/srpauth.py b/src/leap/crypto/srpauth.py
index 8028a6dc..ba8ac3f5 100644
--- a/src/leap/crypto/srpauth.py
+++ b/src/leap/crypto/srpauth.py
@@ -26,6 +26,8 @@ from PySide import QtCore, QtGui
from leap.common.check import leap_assert
from leap.config.providerconfig import ProviderConfig
from leap.util.checkerthread import CheckerThread
+from leap.common.events import signal as events_signal
+from leap.common.events import events_pb2 as proto
logger = logging.getLogger(__name__)
@@ -237,7 +239,11 @@ class SRPAuth(QtCore.QObject):
(auth_result.status_code,))
M2 = auth_result.json().get("M2", None)
- self.set_uid(auth_result.json().get("id", None))
+ uid = auth_result.json().get("id", None)
+
+ events_signal(proto.CLIENT_UID, content=uid)
+
+ self.set_uid(uid)
if M2 is None or self.get_uid() is None:
logger.error("Something went wrong. Content = %r" %
@@ -279,6 +285,9 @@ class SRPAuth(QtCore.QObject):
raise SRPAuthenticationError(self.tr("Session cookie "
"verification "
"failed"))
+
+ events_signal(proto.CLIENT_SESSION_ID, content=session_id)
+
self.set_session_id(session_id)
def authenticate(self, username, password):