diff options
author | Mark Haines <mark.haines@matrix.org> | 2014-10-13 15:41:20 +0100 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2014-10-13 15:41:20 +0100 |
commit | 75e517a2da4890b55f492897599185c91ed0826c (patch) | |
tree | 402c32f360dc5813bcc886f4a7a0e323c67728cc | |
parent | Verify signatures for server2server requests (diff) | |
download | synapse-75e517a2da4890b55f492897599185c91ed0826c.tar.xz |
Remove debug logging, raise a proper SynapseError if the auth header is missing
-rw-r--r-- | synapse/federation/transport.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/synapse/federation/transport.py b/synapse/federation/transport.py index 7b2631fbc8..93134ee274 100644 --- a/synapse/federation/transport.py +++ b/synapse/federation/transport.py @@ -24,6 +24,7 @@ over a different (albeit still reliable) protocol. from twisted.internet import defer from synapse.api.urls import FEDERATION_PREFIX as PREFIX +from synapse.api.errors import Codes, SynapseError from synapse.util.logutils import log_function import logging @@ -230,8 +231,9 @@ class TransportLayer(object): auth_headers = request.requestHeaders.getRawHeaders(b"Authorization") if not auth_headers: - #TODO(markjh): Send a 401 response? - raise Exception("Missing auth headers") + raise SynapseError( + 401, "Missing Authorization headers", Codes.FORBIDDEN, + ) for auth in auth_headers: if auth.startswith("X-Matrix"): @@ -239,9 +241,6 @@ class TransportLayer(object): json_request["origin"] = origin json_request["signatures"].setdefault(origin,{})[key] = sig - from syutil.jsonutil import encode_canonical_json - logger.debug("Checking %s %s", - origin, encode_canonical_json(json_request)) yield self.keyring.verify_json_for_server(origin, json_request) defer.returnValue((origin, content)) |