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

Commit b198647

Browse files
AzrenbethAzrenbeth
authored andcommitted
Added porting instructions to the docs
1 parent d84e47c commit b198647

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

docs/modules.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ it should register the following dict:
304304
```python
305305
{
306306
"com.example.custom_login": ("secret1", "secret2"),
307-
"m.login.password": ("password",)
307+
"m.login.password": ("password",),
308308
}
309309
```
310310

@@ -396,6 +396,22 @@ The module's author should also update any example in the module's configuration
396396
use the new `modules` section in Synapse's configuration file (see [this section](#using-modules)
397397
for more info).
398398

399+
#### Porting password auth provider modules
400+
401+
There is no longer a `get_db_schema_files` callback provided, any changes to the database
402+
should now be made by the module using the module API class.
403+
404+
To port a module that has a `check_password` method:
405+
- Register `"m.login.password": ("password",)` as a supported login type
406+
- Register `"m.login.password": self.check_password` as an auth checker
407+
- Change the arguments of `check_password` to
408+
`(username: str, login_type: str, login_dict: JsonDict)`
409+
- Add the following lines to the top of the `check_password` method:
410+
- `user_id = self.module_api.get_qualified_user_id(username)`
411+
- `password = login_dict["password"]`
412+
- Alter `check_password` so that it returns `None` on an authentication failure, and `user_id`
413+
on a success
414+
399415
### Example
400416

401417
The example below is a module that implements the spam checker callback

0 commit comments

Comments
 (0)