Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit e01026d

Browse files
committed
Revert "Fix existing v2 identity server calls (MSC2140) (#6013)"
This has now been merged into develop (3505ffc) so we don't need this cherry-picked commit. This reverts commit e0eef47.
1 parent ee91c69 commit e01026d

File tree

2 files changed

+2
-27
lines changed

2 files changed

+2
-27
lines changed

changelog.d/6013.misc

Lines changed: 0 additions & 1 deletion
This file was deleted.

synapse/handlers/identity.py

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -74,25 +74,6 @@ def _extract_items_from_creds_dict(self, creds):
7474
id_access_token = creds.get("id_access_token")
7575
return client_secret, id_server, id_access_token
7676

77-
def create_id_access_token_header(self, id_access_token):
78-
"""Create an Authorization header for passing to SimpleHttpClient as the header value
79-
of an HTTP request.
80-
81-
Args:
82-
id_access_token (str): An identity server access token.
83-
84-
Returns:
85-
list[str]: The ascii-encoded bearer token encased in a list.
86-
"""
87-
# Prefix with Bearer
88-
bearer_token = "Bearer %s" % id_access_token
89-
90-
# Encode headers to standard ascii
91-
bearer_token.encode("ascii")
92-
93-
# Return as a list as that's how SimpleHttpClient takes header values
94-
return [bearer_token]
95-
9677
@defer.inlineCallbacks
9778
def threepid_from_creds(self, id_server, creds):
9879
"""
@@ -168,20 +149,15 @@ def bind_threepid(self, creds, mxid, use_v2=True):
168149
use_v2 = False
169150

170151
# Decide which API endpoint URLs to use
171-
headers = {}
172152
bind_data = {"sid": creds["sid"], "client_secret": client_secret, "mxid": mxid}
173153
if use_v2:
174154
bind_url = "https://%s/_matrix/identity/v2/3pid/bind" % (id_server,)
175-
headers["Authorization"] = self.create_id_access_token_header(
176-
id_access_token
177-
)
155+
bind_data["id_access_token"] = id_access_token
178156
else:
179157
bind_url = "https://%s/_matrix/identity/api/v1/3pid/bind" % (id_server,)
180158

181159
try:
182-
data = yield self.http_client.post_json_get_json(
183-
bind_url, bind_data, headers=headers
184-
)
160+
data = yield self.http_client.post_json_get_json(bind_url, bind_data)
185161
logger.debug("bound threepid %r to %s", creds, mxid)
186162

187163
# Remember where we bound the threepid

0 commit comments

Comments
 (0)