Support "identifier" dicts in UIA (#8848)

The spec requires synapse to support `identifier` dicts for `m.login.password`
user-interactive auth, which it did not (instead, it required an undocumented
`user` parameter.)

To fix this properly, we need to pull the code that interprets `identifier`
into `AuthHandler.validate_login` so that it can be called from the UIA code.

Fixes #5665.
This commit is contained in:
Richard van der Hoff 2020-12-01 17:42:26 +00:00 committed by GitHub
parent 9edff901d1
commit 4d9496559d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 191 additions and 148 deletions

View file

@ -358,9 +358,6 @@ class PasswordAuthProviderTests(unittest.HomeserverTestCase):
"auth": {
"type": "test.login_type",
"identifier": {"type": "m.id.user", "user": "localuser"},
# FIXME "identifier" is ignored
# https://github.com/matrix-org/synapse/issues/5665
"user": "localuser",
"session": session,
},
}
@ -489,9 +486,6 @@ class PasswordAuthProviderTests(unittest.HomeserverTestCase):
"auth": {
"type": "m.login.password",
"identifier": {"type": "m.id.user", "user": "localuser"},
# FIXME "identifier" is ignored
# https://github.com/matrix-org/synapse/issues/5665
"user": "localuser",
"password": "localpass",
"session": session,
},
@ -541,7 +535,7 @@ class PasswordAuthProviderTests(unittest.HomeserverTestCase):
return self._send_login(type="m.login.password", user=user, password=password)
def _send_login(self, type, user, **params) -> FakeChannel:
params.update({"user": user, "type": type})
params.update({"identifier": {"type": "m.id.user", "user": user}, "type": type})
_, channel = self.make_request("POST", "/_matrix/client/r0/login", params)
return channel
@ -569,9 +563,6 @@ class PasswordAuthProviderTests(unittest.HomeserverTestCase):
"auth": {
"type": "m.login.password",
"identifier": {"type": "m.id.user", "user": user_id},
# FIXME "identifier" is ignored
# https://github.com/matrix-org/synapse/issues/5665
"user": user_id,
"password": password,
"session": session,
},