summary refs log tree commit diff
path: root/synapse/rest
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2015-04-02 17:51:19 +0100
committerDavid Baker <dave@matrix.org>2015-04-02 17:51:19 +0100
commit4eb6d66b45356efcc87089cb52ca6f51c98cd798 (patch)
tree45028c69d9cf1dd183817f48f2790b2fc19946af /synapse/rest
parentThrow sensible errors on not-json when allowing empty body (diff)
downloadsynapse-4eb6d66b45356efcc87089cb52ca6f51c98cd798.tar.xz
Add app service auth back in to v2 register
Diffstat (limited to 'synapse/rest')
-rw-r--r--synapse/rest/client/v2_alpha/register.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/synapse/rest/client/v2_alpha/register.py b/synapse/rest/client/v2_alpha/register.py
index a69b45f362..72319a3bb2 100644
--- a/synapse/rest/client/v2_alpha/register.py
+++ b/synapse/rest/client/v2_alpha/register.py
@@ -59,7 +59,13 @@ class RegisterRestServlet(RestServlet):
         is_using_shared_secret = False
         is_application_server = False
 
-        if 'mac' in body:
+        service = None
+        if 'access_token' in request.args:
+            service = yield self.auth.get_appservice_by_req(request)
+
+        if service:
+            is_application_server = True
+        elif 'mac' in body:
             # Check registration-specific shared secret auth
             if 'username' not in body:
                 raise SynapseError(400, "", Codes.MISSING_PARAM)
@@ -71,7 +77,6 @@ class RegisterRestServlet(RestServlet):
             authed, result = yield self.auth_handler.check_auth([
                 [LoginType.RECAPTCHA],
                 [LoginType.EMAIL_IDENTITY, LoginType.RECAPTCHA],
-                [LoginType.APPLICATION_SERVICE]
             ], body, self.hs.get_ip_from_request(request))
 
             if not authed: