mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-09 16:02:15 -04:00
Further registration refactoring
* `RegistrationHandler.appservice_register` no longer issues an access token: instead it is left for the caller to do it. (There are two of these, one in `synapse/rest/client/v1/register.py`, which now simply calls `AuthHandler.issue_access_token`, and the other in `synapse/rest/client/v2_alpha/register.py`, which is covered below). * In `synapse/rest/client/v2_alpha/register.py`, move the generation of access_tokens into `_create_registration_details`. This means that the normal flow no longer needs to call `AuthHandler.issue_access_token`; the shared-secret flow can tell `RegistrationHandler.register` not to generate a token; and the appservice flow continues to work despite the above change.
This commit is contained in:
parent
b9e997f561
commit
40cbffb2d2
5 changed files with 57 additions and 22 deletions
|
@ -61,8 +61,10 @@ class RegisterRestServletTestCase(unittest.TestCase):
|
|||
"id": "1234"
|
||||
}
|
||||
self.registration_handler.appservice_register = Mock(
|
||||
return_value=(user_id, token)
|
||||
return_value=user_id
|
||||
)
|
||||
self.auth_handler.issue_access_token = Mock(return_value=token)
|
||||
|
||||
(code, result) = yield self.servlet.on_POST(self.request)
|
||||
self.assertEquals(code, 200)
|
||||
det_data = {
|
||||
|
@ -126,6 +128,8 @@ class RegisterRestServletTestCase(unittest.TestCase):
|
|||
}
|
||||
self.assertDictContainsSubset(det_data, result)
|
||||
self.assertIn("refresh_token", result)
|
||||
self.auth_handler.issue_access_token.assert_called_once_with(
|
||||
user_id)
|
||||
|
||||
def test_POST_disabled_registration(self):
|
||||
self.hs.config.enable_registration = False
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue