summary refs log tree commit diff
path: root/synapse/handlers/auth.py
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2016-03-16 19:36:57 +0000
committerDavid Baker <dave@matrix.org>2016-03-16 19:36:57 +0000
commita7daa5ae131cc860769d859cf03b48cefdc0500a (patch)
tree6e07ec369ee1fe7e92bd1a1a8822dbee73958a0b /synapse/handlers/auth.py
parentMerge pull request #649 from matrix-org/dbkr/idempotent_registration (diff)
downloadsynapse-a7daa5ae131cc860769d859cf03b48cefdc0500a.tar.xz
Make registration idempotent, part 2: be idempotent if the client specifies a username.
Diffstat (limited to 'synapse/handlers/auth.py')
-rw-r--r--synapse/handlers/auth.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/synapse/handlers/auth.py b/synapse/handlers/auth.py
index d7233cd0d6..82d458b424 100644
--- a/synapse/handlers/auth.py
+++ b/synapse/handlers/auth.py
@@ -160,6 +160,20 @@ class AuthHandler(BaseHandler):
             defer.returnValue(True)
         defer.returnValue(False)
 
+    def get_session_id(self, clientdict):
+        """
+        Gets the session ID for a client given the client dictionary
+        :param clientdict: The dictionary sent by the client in the request
+        :return: The string session ID the client sent. If the client did not
+                 send a session ID, returns None.
+        """
+        sid = None
+        if clientdict and 'auth' in clientdict:
+            authdict = clientdict['auth']
+            if 'session' in authdict:
+                sid = authdict['session']
+        return sid
+
     def set_session_data(self, session_id, key, value):
         """
         Store a key-value pair into the sessions data associated with this