mirror of
https://github.com/element-hq/dendrite.git
synced 2025-09-13 21:02:25 +03:00
Make userapi responsible for checking access tokens (#1133)
* Make userapi responsible for checking access tokens There's still plenty of dependencies on account/device DBs, but this is a start. This is a breaking change as it adds a required config value `listen.user_api`. * Cleanup * Review comments and test fix
This commit is contained in:
parent
57b7fa3db8
commit
9c77022513
66 changed files with 421 additions and 400 deletions
|
@ -30,6 +30,7 @@ import (
|
|||
"github.com/matrix-org/dendrite/internal/eventutil"
|
||||
"github.com/matrix-org/dendrite/roomserver/api"
|
||||
roomserverAPI "github.com/matrix-org/dendrite/roomserver/api"
|
||||
userapi "github.com/matrix-org/dendrite/userapi/api"
|
||||
"github.com/matrix-org/gomatrixserverlib"
|
||||
|
||||
"github.com/matrix-org/util"
|
||||
|
@ -42,7 +43,7 @@ var errMissingUserID = errors.New("'user_id' must be supplied")
|
|||
// TODO: Can we improve the cyclo count here? Separate code paths for invites?
|
||||
// nolint:gocyclo
|
||||
func SendMembership(
|
||||
req *http.Request, accountDB accounts.Database, device *authtypes.Device,
|
||||
req *http.Request, accountDB accounts.Database, device *userapi.Device,
|
||||
roomID string, membership string, cfg *config.Dendrite,
|
||||
rsAPI roomserverAPI.RoomserverInternalAPI, asAPI appserviceAPI.AppServiceQueryAPI,
|
||||
) util.JSONResponse {
|
||||
|
@ -149,7 +150,7 @@ func SendMembership(
|
|||
func buildMembershipEvent(
|
||||
ctx context.Context,
|
||||
body threepid.MembershipRequest, accountDB accounts.Database,
|
||||
device *authtypes.Device,
|
||||
device *userapi.Device,
|
||||
membership, roomID string, isDirect bool,
|
||||
cfg *config.Dendrite, evTime time.Time,
|
||||
rsAPI roomserverAPI.RoomserverInternalAPI, asAPI appserviceAPI.AppServiceQueryAPI,
|
||||
|
@ -223,7 +224,7 @@ func loadProfile(
|
|||
// In the latter case, if there was an issue retrieving the user ID from the request body,
|
||||
// returns a JSONResponse with a corresponding error code and message.
|
||||
func getMembershipStateKey(
|
||||
body threepid.MembershipRequest, device *authtypes.Device, membership string,
|
||||
body threepid.MembershipRequest, device *userapi.Device, membership string,
|
||||
) (stateKey string, reason string, err error) {
|
||||
if membership == gomatrixserverlib.Ban || membership == "unban" || membership == "kick" || membership == gomatrixserverlib.Invite {
|
||||
// If we're in this case, the state key is contained in the request body,
|
||||
|
@ -245,7 +246,7 @@ func getMembershipStateKey(
|
|||
|
||||
func checkAndProcessThreepid(
|
||||
req *http.Request,
|
||||
device *authtypes.Device,
|
||||
device *userapi.Device,
|
||||
body *threepid.MembershipRequest,
|
||||
cfg *config.Dendrite,
|
||||
rsAPI roomserverAPI.RoomserverInternalAPI,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue