mirror of
https://github.com/element-hq/synapse.git
synced 2024-12-15 17:51:10 +00:00
Add submit_url response parameter to msisdn /requestToken (#6079)
Second part of solving #6076 Fixes #6076 We return a submit_url parameter on calls to POST */msisdn/requestToken so that clients know where to submit token information to.
This commit is contained in:
parent
2b071a2ff1
commit
50776261e1
4 changed files with 16 additions and 1 deletions
1
changelog.d/6079.feature
Normal file
1
changelog.d/6079.feature
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Add `submit_url` response parameter to `*/msisdn/requestToken` endpoints.
|
|
@ -940,6 +940,8 @@ uploads_path: "DATADIR/uploads"
|
||||||
# by the Matrix Identity Service API specification:
|
# by the Matrix Identity Service API specification:
|
||||||
# https://matrix.org/docs/spec/identity_service/latest
|
# https://matrix.org/docs/spec/identity_service/latest
|
||||||
#
|
#
|
||||||
|
# If a delegate is specified, the config option public_baseurl must also be filled out.
|
||||||
|
#
|
||||||
account_threepid_delegates:
|
account_threepid_delegates:
|
||||||
#email: https://example.com # Delegate email sending to example.org
|
#email: https://example.com # Delegate email sending to example.org
|
||||||
#msisdn: http://localhost:8090 # Delegate SMS sending to this local process
|
#msisdn: http://localhost:8090 # Delegate SMS sending to this local process
|
||||||
|
|
|
@ -293,6 +293,8 @@ class RegistrationConfig(Config):
|
||||||
# by the Matrix Identity Service API specification:
|
# by the Matrix Identity Service API specification:
|
||||||
# https://matrix.org/docs/spec/identity_service/latest
|
# https://matrix.org/docs/spec/identity_service/latest
|
||||||
#
|
#
|
||||||
|
# If a delegate is specified, the config option public_baseurl must also be filled out.
|
||||||
|
#
|
||||||
account_threepid_delegates:
|
account_threepid_delegates:
|
||||||
#email: https://example.com # Delegate email sending to example.org
|
#email: https://example.com # Delegate email sending to example.org
|
||||||
#msisdn: http://localhost:8090 # Delegate SMS sending to this local process
|
#msisdn: http://localhost:8090 # Delegate SMS sending to this local process
|
||||||
|
|
|
@ -452,13 +452,23 @@ class IdentityHandler(BaseHandler):
|
||||||
id_server + "/_matrix/identity/api/v1/validate/msisdn/requestToken",
|
id_server + "/_matrix/identity/api/v1/validate/msisdn/requestToken",
|
||||||
params,
|
params,
|
||||||
)
|
)
|
||||||
return data
|
|
||||||
except HttpResponseException as e:
|
except HttpResponseException as e:
|
||||||
logger.info("Proxied requestToken failed: %r", e)
|
logger.info("Proxied requestToken failed: %r", e)
|
||||||
raise e.to_synapse_error()
|
raise e.to_synapse_error()
|
||||||
except TimeoutError:
|
except TimeoutError:
|
||||||
raise SynapseError(500, "Timed out contacting identity server")
|
raise SynapseError(500, "Timed out contacting identity server")
|
||||||
|
|
||||||
|
assert self.hs.config.public_baseurl
|
||||||
|
|
||||||
|
# we need to tell the client to send the token back to us, since it doesn't
|
||||||
|
# otherwise know where to send it, so add submit_url response parameter
|
||||||
|
# (see also MSC2078)
|
||||||
|
data["submit_url"] = (
|
||||||
|
self.hs.config.public_baseurl
|
||||||
|
+ "_matrix/client/unstable/add_threepid/msisdn/submit_token"
|
||||||
|
)
|
||||||
|
return data
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def validate_threepid_session(self, client_secret, sid):
|
def validate_threepid_session(self, client_secret, sid):
|
||||||
"""Validates a threepid session with only the client secret and session ID
|
"""Validates a threepid session with only the client secret and session ID
|
||||||
|
|
Loading…
Reference in a new issue