From 2712a9ef8f5222543614b590ef5a29a674c3c723 Mon Sep 17 00:00:00 2001 From: Michael Kaye <1917473+michaelkaye@users.noreply.github.com> Date: Mon, 28 Jan 2019 14:24:28 +0000 Subject: [PATCH] Fix to keep the signature valid for the request. (#4480) --- synapse/handlers/identity.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/synapse/handlers/identity.py b/synapse/handlers/identity.py index 3ffdb45bef..6255d3ffed 100644 --- a/synapse/handlers/identity.py +++ b/synapse/handlers/identity.py @@ -169,12 +169,6 @@ class IdentityHandler(BaseHandler): # deletion request to. id_server = next(iter(self.trusted_id_servers)) - # if we have a rewrite rule set for the identity server, - # apply it now. - if id_server in self.rewrite_identity_server_urls: - id_server = self.rewrite_identity_server_urls[id_server] - - url = "https://%s/_matrix/identity/api/v1/3pid/unbind" % (id_server,) content = { "mxid": mxid, "threepid": threepid, @@ -191,6 +185,15 @@ class IdentityHandler(BaseHandler): content=content, destination_is=id_server, ) + # if we have a rewrite rule set for the identity server, + # apply it now. + # + # Note that destination_is has to be the real id_server, not + # the server we connect to. + if id_server in self.rewrite_identity_server_urls: + id_server = self.rewrite_identity_server_urls[id_server] + + url = "https://%s/_matrix/identity/api/v1/3pid/unbind" % (id_server,) try: yield self.http_client.post_json_get_json( url,