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

Add User-Interactive Auth to /account/3pid/add #6119

Merged
merged 2 commits into from
Nov 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/6119.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Require User-Interactive Authentication for `/account/3pid/add`, meaning the user's password will be required to add a third-party ID to their account.
5 changes: 5 additions & 0 deletions synapse/rest/client/v2_alpha/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,7 @@ def __init__(self, hs):
self.auth = hs.get_auth()
self.auth_handler = hs.get_auth_handler()

@interactive_auth_handler
@defer.inlineCallbacks
def on_POST(self, request):
requester = yield self.auth.get_user_by_req(request)
Expand All @@ -652,6 +653,10 @@ def on_POST(self, request):
client_secret = body["client_secret"]
sid = body["sid"]

yield self.auth_handler.validate_user_via_ui_auth(
requester, body, self.hs.get_ip_from_request(request)
)

validation_session = yield self.identity_handler.validate_threepid_session(
client_secret, sid
)
Expand Down