summary refs log tree commit diff
path: root/synapse/rest/client/v1/register.py
diff options
context:
space:
mode:
authorAmber Brown <hawkowl@atleastfornow.net>2018-07-14 07:34:49 +1000
committerGitHub <noreply@github.com>2018-07-14 07:34:49 +1000
commit33b60c01b5e60dc38b02b6f0fd018be2d2d07cf7 (patch)
tree5e6fed5d4599ecfb0490120bacf5cbee91448d27 /synapse/rest/client/v1/register.py
parentMerge pull request #3533 from matrix-org/rav/fix_federation_ratelimite_queue (diff)
downloadsynapse-33b60c01b5e60dc38b02b6f0fd018be2d2d07cf7.tar.xz
Make auth & transactions more testable (#3499)
Diffstat (limited to 'synapse/rest/client/v1/register.py')
-rw-r--r--synapse/rest/client/v1/register.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/synapse/rest/client/v1/register.py b/synapse/rest/client/v1/register.py
index 3ce5f8b726..9203e60615 100644
--- a/synapse/rest/client/v1/register.py
+++ b/synapse/rest/client/v1/register.py
@@ -23,7 +23,6 @@ from six import string_types
 from twisted.internet import defer
 
 import synapse.util.stringutils as stringutils
-from synapse.api.auth import get_access_token_from_request
 from synapse.api.constants import LoginType
 from synapse.api.errors import Codes, SynapseError
 from synapse.http.servlet import parse_json_object_from_request
@@ -67,6 +66,7 @@ class RegisterRestServlet(ClientV1RestServlet):
         # TODO: persistent storage
         self.sessions = {}
         self.enable_registration = hs.config.enable_registration
+        self.auth = hs.get_auth()
         self.auth_handler = hs.get_auth_handler()
         self.handlers = hs.get_handlers()
 
@@ -310,7 +310,7 @@ class RegisterRestServlet(ClientV1RestServlet):
 
     @defer.inlineCallbacks
     def _do_app_service(self, request, register_json, session):
-        as_token = get_access_token_from_request(request)
+        as_token = self.auth.get_access_token_from_request(request)
 
         if "user" not in register_json:
             raise SynapseError(400, "Expected 'user' key.")
@@ -400,7 +400,7 @@ class CreateUserRestServlet(ClientV1RestServlet):
     def on_POST(self, request):
         user_json = parse_json_object_from_request(request)
 
-        access_token = get_access_token_from_request(request)
+        access_token = self.auth.get_access_token_from_request(request)
         app_service = self.store.get_app_service_by_token(
             access_token
         )