-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Support 3PID login in password providers #4931
Conversation
Adds a new method, check_3pid_auth, which gives password providers the chance to allow authentication with third-party identifiers such as email or msisdn.
Codecov Report
@@ Coverage Diff @@
## develop #4931 +/- ##
===========================================
+ Coverage 78.03% 78.04% +<.01%
===========================================
Files 328 328
Lines 34072 34090 +18
Branches 5622 5627 +5
===========================================
+ Hits 26589 26604 +15
- Misses 5868 5870 +2
- Partials 1615 1616 +1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generally seems sane. a few nits
docs/password_auth_providers.rst
Outdated
@@ -97,3 +97,14 @@ Password auth provider classes may optionally provide the following methods. | |||
|
|||
It may return a Twisted ``Deferred`` object; the logout request will wait | |||
for the deferred to complete but the result is ignored. | |||
|
|||
``someprovider.check_3pid_auth``\(*medium*, *address*, *password*) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggest putting this up with check_auth
synapse/module_api/__init__.py
Outdated
) | ||
|
||
# Bind email address with the registered identity service | ||
unix_secs = int(time.time()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you want to use hs.get_clock()
, mostly because it makes testing easier if anyone ever comes to unit test this
* develop: (141 commits) Make federation endpoints more tolerant of trailing slashes v2 (#4935) Fix ClientReplicationStreamProtocol.__str__ (#4929) Fix bug where read-receipts lost their timestamps (#4927) Use an explicit dbname for postgres connections in the tests. (#4928) Fix nginx example in ACME doc. (#4923) Refactor out state delta handling into its own class (#4917) Newsfile Use yaml safe_load Allow newsfragments to end with exclamation marks! (#4912) Some more porting to HomeserverTestCase and remove old RESTHelper (#4913) Clean up backoff_on_404 and metehod calls Update changelog.d/4908.bugfix Update Apache Setup To Remove Location Syntax (#4870) isort Newsfile Fix typo and add description Deny peeking into rooms that have been blocked Rejig testcase to make it more extensible Remove debug Add tests ...
Addressed changes and moved email out-of-scope
docs/password_auth_providers.rst
Outdated
|
||
The method should return a Twisted ``Deferred`` object, which resolves to | ||
a ``str`` containing the user's (canonical) User ID if authentication was | ||
successful, and ``None`` if not. The ``Deferred`` can also instead |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"also instead"
How about:
As with
check_auth
, theDeferred
may alternatively resolve to a(user_id, callback)
tuple.
... rather than duplicating the whole thing. Suggest a separate paragraph for clarity too.
synapse/handlers/auth.py
Outdated
password (str): The password of the user. | ||
|
||
Returns: | ||
Deferred[(str|None, None)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does the result mean?
synapse/module_api/__init__.py
Outdated
|
||
Args: | ||
localpart (str): The localpart of the new user. | ||
displayname (str|None): The displayname of the new user. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what happens if it is set to None?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
This change allows for 3PID login via password provider modules and is motivated by matrix-org/matrix-synapse-ldap3#58
Additionally adds the ability for password provider modules to set the default displayname and any number of email addresses for a user.
There are also some little fixes littered about that I found about the codebase locations I touched, and hope they aren't too annoying look through.