summary refs log tree commit diff
path: root/synapse/http/site.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2020-10-21 14:07:59 +0100
committerErik Johnston <erik@matrix.org>2020-10-21 16:53:40 +0100
commit9edb5b369eaacc76c22c2de8f0ec4cc5f818e586 (patch)
tree12af023bfc3031d80ca232e8ff1bec4f5dbd0668 /synapse/http/site.py
parentMake get_user_by_access_token return a proper type (diff)
downloadsynapse-9edb5b369eaacc76c22c2de8f0ec4cc5f818e586.tar.xz
Add concept of authenticated_entity vs target_user
Diffstat (limited to 'synapse/http/site.py')
-rw-r--r--synapse/http/site.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/synapse/http/site.py b/synapse/http/site.py

index 6e79b47828..480c4d5e2f 100644 --- a/synapse/http/site.py +++ b/synapse/http/site.py
@@ -55,6 +55,7 @@ class SynapseRequest(Request): self.site = channel.site self._channel = channel # this is used by the tests self.authenticated_entity = None + self.target_user = None self.start_time = 0.0 # we can't yet create the logcontext, as we don't know the method. @@ -269,6 +270,11 @@ class SynapseRequest(Request): if authenticated_entity is not None and isinstance(authenticated_entity, bytes): authenticated_entity = authenticated_entity.decode("utf-8", "replace") + if self.target_user: + authenticated_entity = "{} as {}".format( + authenticated_entity, self.target_user, + ) + # ...or could be raw utf-8 bytes in the User-Agent header. # N.B. if you don't do this, the logger explodes cryptically # with maximum recursion trying to log errors about