aboutsummaryrefslogtreecommitdiff
path: root/clientapi/routing/routing.go
diff options
context:
space:
mode:
authorKegsay <kegan@matrix.org>2020-07-10 00:39:44 +0100
committerGitHub <noreply@github.com>2020-07-10 00:39:44 +0100
commitabf26c12f1a97fd2894a0509de9cf4a91c79d3ab (patch)
tree13b693141a36bfc4ae2ef2759e67dca92b2fc857 /clientapi/routing/routing.go
parent9cc52f47f3ea2e8a009731cc46117cb996aed722 (diff)
Add User-Interactive Authentication (#1193)
* Add User-Interactive Authentication And use it when deleting a device. With tests. * Make remaining sytest pass * Linting * 403 not 401 on wrong user/pass
Diffstat (limited to 'clientapi/routing/routing.go')
-rw-r--r--clientapi/routing/routing.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/clientapi/routing/routing.go b/clientapi/routing/routing.go
index fe4f1efa..f764bd4d 100644
--- a/clientapi/routing/routing.go
+++ b/clientapi/routing/routing.go
@@ -22,6 +22,7 @@ import (
"github.com/gorilla/mux"
appserviceAPI "github.com/matrix-org/dendrite/appservice/api"
"github.com/matrix-org/dendrite/clientapi/api"
+ "github.com/matrix-org/dendrite/clientapi/auth"
"github.com/matrix-org/dendrite/clientapi/jsonerror"
"github.com/matrix-org/dendrite/clientapi/producers"
currentstateAPI "github.com/matrix-org/dendrite/currentstateserver/api"
@@ -63,6 +64,7 @@ func Setup(
stateAPI currentstateAPI.CurrentStateInternalAPI,
extRoomsProvider api.ExtraPublicRoomsProvider,
) {
+ userInteractiveAuth := auth.NewUserInteractive(accountDB.GetAccountByPassword, cfg)
publicAPIMux.Handle("/client/versions",
httputil.MakeExternalAPI("versions", func(req *http.Request) util.JSONResponse {
@@ -629,7 +631,7 @@ func Setup(
if err != nil {
return util.ErrorResponse(err)
}
- return DeleteDeviceById(req, deviceDB, device, vars["deviceID"])
+ return DeleteDeviceById(req, userInteractiveAuth, deviceDB, device, vars["deviceID"])
}),
).Methods(http.MethodDelete, http.MethodOptions)