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

Commit

Permalink
Add User-Interactive Auth to /account/3pid/add (#6119)
Browse files Browse the repository at this point in the history
  • Loading branch information
anoadragon453 authored Nov 29, 2019
1 parent 1c3a615 commit 23ea572
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
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

0 comments on commit 23ea572

Please sign in to comment.