summary refs log tree commit diff
path: root/tests/appservice
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2022-10-04 07:06:41 -0400
committerGitHub <noreply@github.com>2022-10-04 07:06:41 -0400
commit27fa0fa6987c691bf6a8528bb870503d2869a740 (patch)
tree5312c88a2f59b5ade01c993dd73d37b410454c21 /tests/appservice
parentLinkify config documentation. (#14003) (diff)
downloadsynapse-27fa0fa6987c691bf6a8528bb870503d2869a740.tar.xz
Send the appservice access token as a header. (#13996)
Implements MSC2832 by sending application service access
tokens in the Authorization header.

The access token is also still sent as a query parameter until
the application service ecosystem has fully migrated to using
headers. In the future this could be made opt-in, or removed
completely.
Diffstat (limited to 'tests/appservice')
-rw-r--r--tests/appservice/test_api.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/appservice/test_api.py b/tests/appservice/test_api.py
index 532b676365..11008ac1fb 100644
--- a/tests/appservice/test_api.py
+++ b/tests/appservice/test_api.py
@@ -69,10 +69,14 @@ class ApplicationServiceApiTestCase(unittest.HomeserverTestCase):
 
         self.request_url = None
 
-        async def get_json(url: str, args: Mapping[Any, Any]) -> List[JsonDict]:
-            if not args.get(b"access_token"):
+        async def get_json(
+            url: str, args: Mapping[Any, Any], headers: Mapping[Any, Any]
+        ) -> List[JsonDict]:
+            # Ensure the access token is passed as both a header and query arg.
+            if not headers.get("Authorization") or not args.get(b"access_token"):
                 raise RuntimeError("Access token not provided")
 
+            self.assertEqual(headers.get("Authorization"), f"Bearer {TOKEN}")
             self.assertEqual(args.get(b"access_token"), TOKEN)
             self.request_url = url
             if url == URL_USER: