mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-26 00:03:09 -06:00
Also allow appservice itself to auth with user_id
Appservice user_id + access token check needs to work both when user_id is the appservice and when appservice has the user in their user namespace. Signed-off-by: Jason Robinson <mail@jasonrobinson.me>
This commit is contained in:
parent
bca2790c67
commit
34d0a50271
|
|
@ -389,9 +389,10 @@ func (a *UserInternalAPI) queryAppServiceToken(ctx context.Context, token, appSe
|
||||||
|
|
||||||
if localpart != "" { // AS is masquerading as another user
|
if localpart != "" { // AS is masquerading as another user
|
||||||
// Verify that the user is registered
|
// Verify that the user is registered
|
||||||
_, err := a.AccountDB.GetAccountByLocalpart(ctx, localpart)
|
account, err := a.AccountDB.GetAccountByLocalpart(ctx, localpart)
|
||||||
// Verify that the account belongs to the appservice user namespaces
|
// Verify that the account exists and either appServiceID matches or
|
||||||
if err == nil && appService.IsInterestedInUserID(appServiceUserID) {
|
// it belongs to the appservice user namespaces
|
||||||
|
if err == nil && (account.AppServiceID == appService.ID || appService.IsInterestedInUserID(appServiceUserID)) {
|
||||||
// Set the userID of dummy device
|
// Set the userID of dummy device
|
||||||
dev.UserID = appServiceUserID
|
dev.UserID = appServiceUserID
|
||||||
return &dev, nil
|
return &dev, nil
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue