summary refs log tree commit diff
path: root/synapse/rest/client/v1/transactions.py
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2016-09-09 16:29:10 +0100
committerMark Haines <mark.haines@matrix.org>2016-09-09 16:33:15 +0100
commit8aee5aa06807210c17ad0e58e4f237fcf2d052f9 (patch)
tree2519b7e5fb3358cbd300a0d3dc73f305814fe967 /synapse/rest/client/v1/transactions.py
parentMerge pull request #1092 from matrix-org/erikj/transaction_queue_check (diff)
downloadsynapse-8aee5aa06807210c17ad0e58e4f237fcf2d052f9.tar.xz
Add helper function for getting access_tokens from requests
Rather than reimplementing the token parsing in the various places.
This will make it easier to change the token parsing to allow access_tokens
in HTTP headers.
Diffstat (limited to 'synapse/rest/client/v1/transactions.py')
-rw-r--r--synapse/rest/client/v1/transactions.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/synapse/rest/client/v1/transactions.py b/synapse/rest/client/v1/transactions.py
index bdccf464a5..2f2c9d0881 100644
--- a/synapse/rest/client/v1/transactions.py
+++ b/synapse/rest/client/v1/transactions.py
@@ -17,6 +17,8 @@
 to ensure idempotency when performing PUTs using the REST API."""
 import logging
 
+from synapse.api.auth import get_access_token_from_request
+
 logger = logging.getLogger(__name__)
 
 
@@ -90,6 +92,6 @@ class HttpTransactionStore(object):
         return response
 
     def _get_key(self, request):
-        token = request.args["access_token"][0]
+        token = get_access_token_from_request(request)
         path_without_txn_id = request.path.rsplit("/", 1)[0]
         return path_without_txn_id + "/" + token