From 04733b1360ef215a1217bd74130147ba6fbb7ce8 Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Thu, 26 Jul 2018 15:18:22 +0100 Subject: [PATCH] Differentiate between users and AS upon reg --- .../matrix-org/dendrite/clientapi/routing/register.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/github.com/matrix-org/dendrite/clientapi/routing/register.go b/src/github.com/matrix-org/dendrite/clientapi/routing/register.go index ef8577709..9a836e373 100644 --- a/src/github.com/matrix-org/dendrite/clientapi/routing/register.go +++ b/src/github.com/matrix-org/dendrite/clientapi/routing/register.go @@ -485,6 +485,17 @@ func Register( } } + // Application services can register users with no auth type, but require + // access token. Differentiate from users who are initially hitting register + // without an auth type + if r.Auth.Type == "" && req.URL.Query().Get("access_token") == "" { + return util.JSONResponse{ + Code: http.StatusUnauthorized, + JSON: newUserInteractiveResponse(sessionID, + cfg.Derived.Registration.Flows, cfg.Derived.Registration.Params), + } + } + logger := util.GetLogger(req.Context()) logger.WithFields(log.Fields{ "username": r.Username,