mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-07-26 14:55:15 -04:00
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.
This commit is contained in:
parent
1613857b90
commit
27fa0fa698
3 changed files with 26 additions and 6 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue