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

Commit cb063ad

Browse files
committed
Add submit_url response parameter to msisdn /requestToken (#6079)
2 parents 64c058b + 5077626 commit cb063ad

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

changelog.d/6079.feature

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add `submit_url` response parameter to `*/msisdn/requestToken` endpoints.

docs/sample_config.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -1097,6 +1097,8 @@ uploads_path: "DATADIR/uploads"
10971097
# by the Matrix Identity Service API specification:
10981098
# https://matrix.org/docs/spec/identity_service/latest
10991099
#
1100+
# If a delegate is specified, the config option public_baseurl must also be filled out.
1101+
#
11001102
account_threepid_delegates:
11011103
#email: https://example.com # Delegate email sending to example.org
11021104
#msisdn: http://localhost:8090 # Delegate SMS sending to this local process

synapse/config/registration.py

+2
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,8 @@ def generate_config_section(self, generate_secrets=False, **kwargs):
368368
# by the Matrix Identity Service API specification:
369369
# https://matrix.org/docs/spec/identity_service/latest
370370
#
371+
# If a delegate is specified, the config option public_baseurl must also be filled out.
372+
#
371373
account_threepid_delegates:
372374
#email: https://example.com # Delegate email sending to example.org
373375
#msisdn: http://localhost:8090 # Delegate SMS sending to this local process

synapse/handlers/identity.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -502,13 +502,23 @@ def requestMsisdnToken(
502502
id_server + "/_matrix/identity/api/v1/validate/msisdn/requestToken",
503503
params,
504504
)
505-
return data
506505
except HttpResponseException as e:
507506
logger.info("Proxied requestToken failed: %r", e)
508507
raise e.to_synapse_error()
509508
except TimeoutError:
510509
raise SynapseError(500, "Timed out contacting identity server")
511510

511+
assert self.hs.config.public_baseurl
512+
513+
# we need to tell the client to send the token back to us, since it doesn't
514+
# otherwise know where to send it, so add submit_url response parameter
515+
# (see also MSC2078)
516+
data["submit_url"] = (
517+
self.hs.config.public_baseurl
518+
+ "_matrix/client/unstable/add_threepid/msisdn/submit_token"
519+
)
520+
return data
521+
512522
@defer.inlineCallbacks
513523
def validate_threepid_session(self, client_secret, sid):
514524
"""Validates a threepid session with only the client secret and session ID

0 commit comments

Comments
 (0)