Modify auth.get_user_by_req for authing appservices directly.

Add logic to map the appservice token to the autogenned appservice user ID.
Add unit tests for all forms of get_user_by_req (user/appservice,
valid/bad/missing tokens)
This commit is contained in:
Kegan Dougal 2015-02-09 14:14:15 +00:00
parent ac3183caaa
commit 5a7dd05818
5 changed files with 164 additions and 20 deletions

View file

@ -215,6 +215,7 @@ class ApplicationServiceStore(SQLBaseStore):
"url": res["url"],
"token": as_token,
"hs_token": res["hs_token"],
"sender": res["sender"],
"namespaces": {
ApplicationService.NS_USERS: [],
ApplicationService.NS_ALIASES: [],
@ -240,6 +241,7 @@ class ApplicationServiceStore(SQLBaseStore):
token=service["token"],
url=service["url"],
namespaces=service["namespaces"],
hs_token=service["hs_token"]
hs_token=service["hs_token"],
sender=service["sender"]
))