diff --git a/synapse/handlers/identity.py b/synapse/handlers/identity.py index ad8246b58c..a3025bc0db 100644 --- a/synapse/handlers/identity.py +++ b/synapse/handlers/identity.py @@ -44,19 +44,34 @@ class IdentityHandler(BaseHandler): # XXX: make this configurable! # trustedIdServers = ['matrix.org', 'localhost:8090'] trustedIdServers = ['matrix.org'] - if not creds['id_server'] in trustedIdServers: + + if 'id_server' in creds: + id_server = creds['id_server'] + elif 'idServer' in creds: + id_server = creds['idServer'] + else: + raise SynapseError(400, "No id_server in creds") + + if 'client_secret' in creds: + client_secret = creds['client_secret'] + elif 'clientSecret' in creds: + client_secret = creds['clientSecret'] + else: + raise SynapseError(400, "No client_secret in creds") + + if not id_server in trustedIdServers: logger.warn('%s is not a trusted ID server: rejecting 3pid ' + - 'credentials', creds['id_server']) + 'credentials', id_server) defer.returnValue(None) data = {} try: data = yield http_client.get_json( "https://%s%s" % ( - creds['id_server'], + id_server, "/_matrix/identity/api/v1/3pid/getValidated3pid" ), - {'sid': creds['sid'], 'client_secret': creds['client_secret']} + {'sid': creds['sid'], 'client_secret': client_secret} ) except CodeMessageException as e: data = json.loads(e.msg)