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

Commit

Permalink
Merge pull request #2608 from matrix-org/rav/password_provider_doc
Browse files Browse the repository at this point in the history
Start some documentation on password providers
  • Loading branch information
dbkr authored Oct 31, 2017
2 parents e2f4190 + ebda45d commit a1f8b0f
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions docs/password_auth_providers.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Password auth provider modules
==============================

Password auth providers offer a way for server administrators to integrate
their Synapse installation with an existing authentication system.

A password auth provider is a Python class which is dynamically loaded into
Synapse, and provides a number of methods by which it can integrate with the
authentication system.

This document serves as a reference for those looking to implement their own
password auth providers.

Required methods
----------------

Password auth provider classes must provide the following methods:

*class* ``SomeProvider.parse_config``\(*config*)

This method is passed the ``config`` object for this module from the
homeserver configuration file.

It should perform any appropriate sanity checks on the provided
configuration, and return an object which is then passed into ``__init__``.

*class* ``SomeProvider``\(*config*, *account_handler*)

The constructor is passed the config object returned by ``parse_config``,
and a ``synapse.handlers.auth._AccountHandler`` object which allows the
password provider to check if accounts exist and/or create new ones.

``someprovider.check_password``\(*user_id*, *password*)

This is the method that actually does the work. It is passed a qualified
``@localpart:domain`` user id, and the password provided by the user.

The method should return a Twisted ``Deferred`` object, which resolves to
``True`` if authentication is successful, and ``False`` if not.

0 comments on commit a1f8b0f

Please sign in to comment.