summary refs log tree commit diff
path: root/synapse/federation
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-11-10 13:37:24 +0000
committerErik Johnston <erik@matrix.org>2014-11-10 13:37:24 +0000
commit003668cfaadc2e96fab0127d7c563eb4b17e0619 (patch)
treec7719ec91cda7b516f835ff96fad47199edd5055 /synapse/federation
parentFix backfill to work. Add auth to backfill request (diff)
downloadsynapse-003668cfaadc2e96fab0127d7c563eb4b17e0619.tar.xz
Add auth to the various server-server APIs
Diffstat (limited to '')
-rw-r--r--synapse/federation/replication.py14
-rw-r--r--synapse/federation/transport.py3
2 files changed, 10 insertions, 7 deletions
diff --git a/synapse/federation/replication.py b/synapse/federation/replication.py
index 7837f1c252..dd8124dbb9 100644
--- a/synapse/federation/replication.py
+++ b/synapse/federation/replication.py
@@ -347,10 +347,12 @@ class ReplicationLayer(object):
 
     @defer.inlineCallbacks
     @log_function
-    def on_context_state_request(self, context, event_id):
+    def on_context_state_request(self, origin, context, event_id):
         if event_id:
             pdus = yield self.handler.get_state_for_pdu(
-                event_id
+                origin,
+                context,
+                event_id,
             )
         else:
             raise NotImplementedError("Specify an event")
@@ -365,8 +367,8 @@ class ReplicationLayer(object):
 
     @defer.inlineCallbacks
     @log_function
-    def on_pdu_request(self, event_id):
-        pdu = yield self._get_persisted_pdu(event_id)
+    def on_pdu_request(self, origin, event_id):
+        pdu = yield self._get_persisted_pdu(origin, event_id)
 
         if pdu:
             defer.returnValue(
@@ -499,13 +501,13 @@ class ReplicationLayer(object):
         defer.returnValue(Pdu(**pdu_dict))
 
     @log_function
-    def _get_persisted_pdu(self, event_id):
+    def _get_persisted_pdu(self, origin, event_id):
         """ Get a PDU from the database with given origin and id.
 
         Returns:
             Deferred: Results in a `Pdu`.
         """
-        return self.handler.get_persisted_pdu(event_id)
+        return self.handler.get_persisted_pdu(origin, event_id)
 
     def _transaction_from_pdus(self, pdu_list):
         """Returns a new Transaction containing the given PDUs suitable for
diff --git a/synapse/federation/transport.py b/synapse/federation/transport.py
index 92a1f4ce17..d84a44c211 100644
--- a/synapse/federation/transport.py
+++ b/synapse/federation/transport.py
@@ -390,7 +390,7 @@ class TransportLayer(object):
             re.compile("^" + PREFIX + "/event/([^/]*)/$"),
             self._with_authentication(
                 lambda origin, content, query, event_id:
-                handler.on_pdu_request(event_id)
+                handler.on_pdu_request(origin, event_id)
             )
         )
 
@@ -401,6 +401,7 @@ class TransportLayer(object):
             self._with_authentication(
                 lambda origin, content, query, context:
                 handler.on_context_state_request(
+                    origin,
                     context,
                     query.get("event_id", [None])[0],
                 )