mirror of
https://github.com/matrix-org/matrix-spec
synced 2025-12-20 16:38:37 +01:00
Spec device management for application services (#2267)
Some checks failed
Spec / 🔎 Validate OpenAPI specifications (push) Has been cancelled
Spec / 🔎 Check Event schema examples (push) Has been cancelled
Spec / 🔎 Check OpenAPI definitions examples (push) Has been cancelled
Spec / 🔎 Check JSON Schemas inline examples (push) Has been cancelled
Spec / ⚙️ Calculate baseURL for later jobs (push) Has been cancelled
Spec / 📢 Run towncrier for changelog (push) Has been cancelled
Spell Check / Spell Check with Typos (push) Has been cancelled
Spec / 🐍 Build OpenAPI definitions (push) Has been cancelled
Spec / 📖 Build the spec (push) Has been cancelled
Spec / 🔎 Validate generated HTML (push) Has been cancelled
Spec / 📖 Build the historical backup spec (push) Has been cancelled
Some checks failed
Spec / 🔎 Validate OpenAPI specifications (push) Has been cancelled
Spec / 🔎 Check Event schema examples (push) Has been cancelled
Spec / 🔎 Check OpenAPI definitions examples (push) Has been cancelled
Spec / 🔎 Check JSON Schemas inline examples (push) Has been cancelled
Spec / ⚙️ Calculate baseURL for later jobs (push) Has been cancelled
Spec / 📢 Run towncrier for changelog (push) Has been cancelled
Spell Check / Spell Check with Typos (push) Has been cancelled
Spec / 🐍 Build OpenAPI definitions (push) Has been cancelled
Spec / 📖 Build the spec (push) Has been cancelled
Spec / 🔎 Validate generated HTML (push) Has been cancelled
Spec / 📖 Build the historical backup spec (push) Has been cancelled
As per MSC4190. Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
This commit is contained in:
parent
54944e2866
commit
7c39427d8b
|
|
@ -0,0 +1 @@
|
||||||
|
Allow application services to manage devices and register users without the legacy authentication API, as per [MSC4190](https://github.com/matrix-org/matrix-spec-proposals/pull/4190).
|
||||||
1
changelogs/client_server/newsfragments/2267.feature
Normal file
1
changelogs/client_server/newsfragments/2267.feature
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
Allow application services to manage devices and register users without the legacy authentication API, as per [MSC4190](https://github.com/matrix-org/matrix-spec-proposals/pull/4190).
|
||||||
|
|
@ -428,6 +428,8 @@ imports and similar behaviour).
|
||||||
|
|
||||||
#### Server admin style permissions
|
#### Server admin style permissions
|
||||||
|
|
||||||
|
{{% changed-in v="1.17" %}}
|
||||||
|
|
||||||
The homeserver needs to give the application service *full control* over
|
The homeserver needs to give the application service *full control* over
|
||||||
its namespace, both for users and for room aliases. This means that the
|
its namespace, both for users and for room aliases. This means that the
|
||||||
AS should be able to manage any users and room alias in its namespace. No additional API
|
AS should be able to manage any users and room alias in its namespace. No additional API
|
||||||
|
|
@ -444,33 +446,59 @@ achieved by including the `as_token` on a `/register` request, along
|
||||||
with a login type of `m.login.application_service` to set the desired
|
with a login type of `m.login.application_service` to set the desired
|
||||||
user ID without a password.
|
user ID without a password.
|
||||||
|
|
||||||
POST /_matrix/client/v3/register
|
```http
|
||||||
Authorization: Bearer YourApplicationServiceTokenHere
|
POST /_matrix/client/v3/register
|
||||||
|
Authorization: Bearer YourApplicationServiceTokenHere
|
||||||
|
```
|
||||||
|
|
||||||
Content:
|
```json
|
||||||
{
|
{
|
||||||
"type": "m.login.application_service",
|
"type": "m.login.application_service",
|
||||||
"username": "_irc_example"
|
"username": "_irc_example"
|
||||||
}
|
}
|
||||||
|
```
|
||||||
|
|
||||||
Similarly, logging in as users needs API changes in order to allow the AS to
|
{{% boxes/note %}}
|
||||||
log in without needing the user's password. This is achieved by including the
|
{{% added-in v="1.17" %}}
|
||||||
`as_token` on a `/login` request, along with a login type of
|
Servers MUST still allow application services to use the `/register` endpoint
|
||||||
`m.login.application_service`:
|
with a login type of `m.login.application_service` even if they don't support
|
||||||
|
the [Legacy Authentication API](/client-server-api/#legacy-api).
|
||||||
|
|
||||||
|
In that case application services MUST set the `"inhibit_login": true` parameter
|
||||||
|
as they cannot use it to log in as users. If the `inhibit_login` parameter is
|
||||||
|
not set to `true`, the server MUST return a 400 HTTP status code with an
|
||||||
|
`M_APPSERVICE_LOGIN_UNSUPPORTED` error code.
|
||||||
|
{{% /boxes/note %}}
|
||||||
|
|
||||||
|
Similarly, logging in as users using the [Legacy authentication API](/client-server-api/#legacy-api)
|
||||||
|
needs API changes in order to allow the AS to log in without needing the user's
|
||||||
|
password. This is achieved by including the `as_token` on a `/login` request,
|
||||||
|
along with a login type of `m.login.application_service`:
|
||||||
|
|
||||||
{{% added-in v="1.2" %}}
|
{{% added-in v="1.2" %}}
|
||||||
|
|
||||||
POST /_matrix/client/v3/login
|
```http
|
||||||
Authorization: Bearer YourApplicationServiceTokenHere
|
POST /_matrix/client/v3/login
|
||||||
|
Authorization: Bearer YourApplicationServiceTokenHere
|
||||||
|
```
|
||||||
|
|
||||||
Content:
|
```json
|
||||||
{
|
{
|
||||||
"type": "m.login.application_service",
|
"type": "m.login.application_service",
|
||||||
"identifier": {
|
"identifier": {
|
||||||
"type": "m.id.user",
|
"type": "m.id.user",
|
||||||
"user": "_irc_example"
|
"user": "_irc_example"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
{{% boxes/note %}}
|
||||||
|
{{% added-in v="1.17" %}}
|
||||||
|
Application services MUST NOT use the `/login` endpoint if the server doesn't
|
||||||
|
support the Legacy authentication API. If `/login` is called with the
|
||||||
|
`m.login.application_service` login type the server MUST return a 400 HTTP
|
||||||
|
status code with an `M_APPSERVICE_LOGIN_UNSUPPORTED` error code.
|
||||||
|
{{% /boxes/note %}}
|
||||||
|
|
||||||
Application services which attempt to create users or aliases *outside*
|
Application services which attempt to create users or aliases *outside*
|
||||||
of their defined namespaces, or log in as users outside of their defined
|
of their defined namespaces, or log in as users outside of their defined
|
||||||
|
|
@ -512,6 +540,38 @@ client-server endpoint.
|
||||||
|
|
||||||
{{% http-api spec="client-server" api="appservice_room_directory" %}}
|
{{% http-api spec="client-server" api="appservice_room_directory" %}}
|
||||||
|
|
||||||
|
#### Device management
|
||||||
|
|
||||||
|
{{% added-in v="1.17" %}}
|
||||||
|
|
||||||
|
Application services need to be able to create and delete devices to manage the
|
||||||
|
encryption for their users without having to rely on `/login`, which also
|
||||||
|
generates an access token for the user, and which might not be available for
|
||||||
|
homeservers that only support the [OAuth 2.0 API](/client-server-api/#oauth-20-api).
|
||||||
|
|
||||||
|
##### Creating devices
|
||||||
|
|
||||||
|
Application services can use the [`PUT /_matrix/client/v3/devices/{deviceId}`](/client-server-api/#put_matrixclientv3devicesdeviceid)
|
||||||
|
endpoint to create new devices.
|
||||||
|
|
||||||
|
##### Deleting devices
|
||||||
|
|
||||||
|
The following endpoints used to delete devices MUST NOT require [User-Interactive
|
||||||
|
Authentication](/client-server-api/#user-interactive-authentication-api) when
|
||||||
|
used by an application service:
|
||||||
|
|
||||||
|
* [`DELETE /_matrix/client/v3/devices/{deviceId}`](/client-server-api/#delete_matrixclientv3devicesdeviceid)
|
||||||
|
* [`POST /_matrix/client/v3/delete_devices`](/client-server-api/#post_matrixclientv3delete_devices)
|
||||||
|
|
||||||
|
#### Cross-signing
|
||||||
|
|
||||||
|
{{% added-in v="1.17" %}}
|
||||||
|
|
||||||
|
Appservices need to be able to verify themselves and replace their cross-signing
|
||||||
|
keys, so the [`POST /_matrix/client/v3/keys/device_signing/upload`](/client-server-api/#post_matrixclientv3keysdevice_signingupload)
|
||||||
|
endpoint MUST NOT require [User-Interactive Authentication](/client-server-api/#user-interactive-authentication-api)
|
||||||
|
when used by an application service, even if cross-signing keys already exist.
|
||||||
|
|
||||||
### Referencing messages from a third-party network
|
### Referencing messages from a third-party network
|
||||||
|
|
||||||
Application services should include an `external_url` in the `content`
|
Application services should include an `external_url` in the `content`
|
||||||
|
|
|
||||||
|
|
@ -477,8 +477,7 @@ the API that was used to obtain their current access token.
|
||||||
|
|
||||||
{{% boxes/note %}}
|
{{% boxes/note %}}
|
||||||
Currently the OAuth 2.0 API doesn't cover all the use cases of the legacy API,
|
Currently the OAuth 2.0 API doesn't cover all the use cases of the legacy API,
|
||||||
such as automated applications that cannot use a web browser, or
|
such as automated applications that cannot use a web browser.
|
||||||
user management by [application services](application-service-api/#server-admin-style-permissions).
|
|
||||||
{{% /boxes/note %}}
|
{{% /boxes/note %}}
|
||||||
|
|
||||||
### Authentication API discovery
|
### Authentication API discovery
|
||||||
|
|
@ -502,6 +501,12 @@ user must do that directly in the homeserver's web UI. However, the client can
|
||||||
signal to the homeserver that the user wishes to create a new account with the
|
signal to the homeserver that the user wishes to create a new account with the
|
||||||
[`prompt=create`](#user-registration) parameter during authorization.
|
[`prompt=create`](#user-registration) parameter during authorization.
|
||||||
|
|
||||||
|
{{% boxes/note %}}
|
||||||
|
{{% added-in v="1.17" %}}
|
||||||
|
Application services can use the `/register` endpoint to create users regardless
|
||||||
|
of the authentication API supported by the homeserver.
|
||||||
|
{{% /boxes/note %}}
|
||||||
|
|
||||||
### Login
|
### Login
|
||||||
|
|
||||||
With the legacy API, a client can obtain an access token by using one of the
|
With the legacy API, a client can obtain an access token by using one of the
|
||||||
|
|
@ -1562,6 +1567,10 @@ If the access token does correspond to an appservice, but the user id does
|
||||||
not lie within its namespace then the homeserver will respond with an
|
not lie within its namespace then the homeserver will respond with an
|
||||||
errcode of `M_EXCLUSIVE`.
|
errcode of `M_EXCLUSIVE`.
|
||||||
|
|
||||||
|
{{% added-in v="1.17" %}} If this login type is used and the server doesn't
|
||||||
|
support logging in via the Legacy authentication API, it MUST return a 400 HTTP
|
||||||
|
status code with an `M_APPSERVICE_LOGIN_UNSUPPORTED` error code.
|
||||||
|
|
||||||
##### Login Fallback
|
##### Login Fallback
|
||||||
|
|
||||||
If a client does not recognize any or all login flows it can use the
|
If a client does not recognize any or all login flows it can use the
|
||||||
|
|
|
||||||
|
|
@ -21,13 +21,17 @@ paths:
|
||||||
x-addedInMatrixVersion: "1.1"
|
x-addedInMatrixVersion: "1.1"
|
||||||
x-changedInMatrixVersion:
|
x-changedInMatrixVersion:
|
||||||
"1.11": UIA is not always required for this endpoint.
|
"1.11": UIA is not always required for this endpoint.
|
||||||
|
"1.17": |-
|
||||||
|
This endpoint no longer requires User-Interactive Authentication when used by an
|
||||||
|
application service.
|
||||||
summary: Upload cross-signing keys.
|
summary: Upload cross-signing keys.
|
||||||
description: |-
|
description: |-
|
||||||
Publishes cross-signing keys for the user.
|
Publishes cross-signing keys for the user.
|
||||||
|
|
||||||
This API endpoint uses the [User-Interactive Authentication API](/client-server-api/#user-interactive-authentication-api).
|
This API endpoint uses the [User-Interactive Authentication API](/client-server-api/#user-interactive-authentication-api),
|
||||||
|
except when used by an application service.
|
||||||
|
|
||||||
User-Interactive Authentication MUST be performed, except in these cases:
|
User-Interactive Authentication MUST be performed for regular clients, except in these cases:
|
||||||
- there is no existing cross-signing master key uploaded to the homeserver, OR
|
- there is no existing cross-signing master key uploaded to the homeserver, OR
|
||||||
- there is an existing cross-signing master key and it exactly matches the
|
- there is an existing cross-signing master key and it exactly matches the
|
||||||
cross-signing master key provided in the request body. If there are any additional
|
cross-signing master key provided in the request body. If there are any additional
|
||||||
|
|
|
||||||
|
|
@ -87,8 +87,21 @@ paths:
|
||||||
tags:
|
tags:
|
||||||
- Device management
|
- Device management
|
||||||
put:
|
put:
|
||||||
summary: Update a device
|
summary: Create or update a device
|
||||||
description: Updates the metadata on the given device.
|
x-changedInMatrixVersion:
|
||||||
|
"1.17": The ability to create new devices was added.
|
||||||
|
description: |-
|
||||||
|
Updates the metadata on the given device, or creates a new device.
|
||||||
|
|
||||||
|
The ability to create new devices is only available to application
|
||||||
|
services: regular clients may only update existing devices.
|
||||||
|
|
||||||
|
When a new device was created, the homeserver MUST return a 201 HTTP
|
||||||
|
status code. It MUST return a 200 HTTP status code if a device was
|
||||||
|
updated.
|
||||||
|
|
||||||
|
This endpoint is rate-limited for device creation. Servers MAY use login
|
||||||
|
rate limits.
|
||||||
operationId: updateDevice
|
operationId: updateDevice
|
||||||
security:
|
security:
|
||||||
- accessTokenQuery: []
|
- accessTokenQuery: []
|
||||||
|
|
@ -127,19 +140,34 @@ paths:
|
||||||
examples:
|
examples:
|
||||||
response:
|
response:
|
||||||
value: {}
|
value: {}
|
||||||
|
"201":
|
||||||
|
description: |-
|
||||||
|
The device was successfully created by the application service.
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
examples:
|
||||||
|
response:
|
||||||
|
value: {}
|
||||||
"404":
|
"404":
|
||||||
description: The current user has no device with the given ID.
|
description: The current user has no device with the given ID.
|
||||||
tags:
|
tags:
|
||||||
- Device management
|
- Device management
|
||||||
delete:
|
delete:
|
||||||
summary: Delete a device
|
summary: Delete a device
|
||||||
|
x-changedInMatrixVersion:
|
||||||
|
"1.17": |-
|
||||||
|
This endpoint no longer requires User-Interactive Authentication when used by an
|
||||||
|
application service.
|
||||||
description: |-
|
description: |-
|
||||||
This API endpoint uses the [User-Interactive Authentication API](/client-server-api/#user-interactive-authentication-api).
|
This API endpoint uses the [User-Interactive Authentication API](/client-server-api/#user-interactive-authentication-api),
|
||||||
|
except when used by an application service.
|
||||||
|
|
||||||
Deletes the given device, and invalidates any access token associated with it.
|
Deletes the given device, and invalidates any access token associated with it.
|
||||||
|
|
||||||
{{% boxes/warning %}}
|
{{% boxes/warning %}}
|
||||||
Since this endpoint uses User-Interactive Authentication, it cannot be used when the access token was obtained
|
When this endpoint requires User-Interactive Authentication, it cannot be used when the access token was obtained
|
||||||
via the [OAuth 2.0 API](/client-server-api/#oauth-20-api).
|
via the [OAuth 2.0 API](/client-server-api/#oauth-20-api).
|
||||||
{{% /boxes/warning %}}
|
{{% /boxes/warning %}}
|
||||||
operationId: deleteDevice
|
operationId: deleteDevice
|
||||||
|
|
@ -190,13 +218,18 @@ paths:
|
||||||
/delete_devices:
|
/delete_devices:
|
||||||
post:
|
post:
|
||||||
summary: Bulk deletion of devices
|
summary: Bulk deletion of devices
|
||||||
|
x-changedInMatrixVersion:
|
||||||
|
"1.17": |-
|
||||||
|
This endpoint no longer requires User-Interactive Authentication when used by an
|
||||||
|
application service.
|
||||||
description: |-
|
description: |-
|
||||||
This API endpoint uses the [User-Interactive Authentication API](/client-server-api/#user-interactive-authentication-api).
|
This API endpoint uses the [User-Interactive Authentication API](/client-server-api/#user-interactive-authentication-api),
|
||||||
|
except when used by an application service.
|
||||||
|
|
||||||
Deletes the given devices, and invalidates any access token associated with them.
|
Deletes the given devices, and invalidates any access token associated with them.
|
||||||
|
|
||||||
{{% boxes/warning %}}
|
{{% boxes/warning %}}
|
||||||
Since this endpoint uses User-Interactive Authentication, it cannot be used when the access token was obtained
|
When this endpoint requires User-Interactive Authentication, it cannot be used when the access token was obtained
|
||||||
via the [OAuth 2.0 API](/client-server-api/#oauth-20-api).
|
via the [OAuth 2.0 API](/client-server-api/#oauth-20-api).
|
||||||
{{% /boxes/warning %}}
|
{{% /boxes/warning %}}
|
||||||
operationId: deleteDevices
|
operationId: deleteDevices
|
||||||
|
|
|
||||||
|
|
@ -243,8 +243,13 @@ paths:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"400":
|
"400":
|
||||||
description: Part of the request was invalid. For example, the login type may
|
description: |-
|
||||||
not be recognised.
|
Part of the request was invalid. For example, the login type may not be recognised.
|
||||||
|
|
||||||
|
Specific error codes used with this status code include:
|
||||||
|
* {{% added-in v="1.17" %}} `M_APPSERVICE_LOGIN_UNSUPPORTED`: an application service
|
||||||
|
used the `m.login.application_service` type, but the server doesn't support logging
|
||||||
|
in via the Legacy authentication API.
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,18 @@ paths:
|
||||||
|
|
||||||
Any user ID returned by this API must conform to the grammar given in the
|
Any user ID returned by this API must conform to the grammar given in the
|
||||||
[Matrix specification](/appendices/#user-identifiers).
|
[Matrix specification](/appendices/#user-identifiers).
|
||||||
|
|
||||||
|
{{% boxes/note %}}
|
||||||
|
{{% added-in v="1.17" %}}
|
||||||
|
Even if the server doesn't support the Legacy authentication API, it
|
||||||
|
MUST support this endpoint for application services to be able to
|
||||||
|
[create users](/application-service-api/#server-admin-style-permissions).
|
||||||
|
|
||||||
|
In that case application services MUST set the `"inhibit_login": true`
|
||||||
|
parameter as they cannot use it to log in as users. If the
|
||||||
|
`inhibit_login` parameter is not set to `true`, the server MUST return a
|
||||||
|
400 HTTP status code with an `M_APPSERVICE_LOGIN_UNSUPPORTED` error code.
|
||||||
|
{{% /boxes/note %}}
|
||||||
operationId: register
|
operationId: register
|
||||||
parameters:
|
parameters:
|
||||||
- in: query
|
- in: query
|
||||||
|
|
@ -203,6 +215,9 @@ paths:
|
||||||
* `M_INVALID_USERNAME` : The desired user ID is not a valid user name.
|
* `M_INVALID_USERNAME` : The desired user ID is not a valid user name.
|
||||||
* `M_EXCLUSIVE` : The desired user ID is in the exclusive namespace
|
* `M_EXCLUSIVE` : The desired user ID is in the exclusive namespace
|
||||||
claimed by an application service.
|
claimed by an application service.
|
||||||
|
* {{% added-in v="1.17" %}} `M_APPSERVICE_LOGIN_UNSUPPORTED`: an application service
|
||||||
|
used the `m.login.application_service` type without setting `inhibit_login` to `true`,
|
||||||
|
but the server doesn't support logging in via the Legacy authentication API.
|
||||||
|
|
||||||
These errors may be returned at any stage of the registration process,
|
These errors may be returned at any stage of the registration process,
|
||||||
including after authentication if the requested user ID was registered
|
including after authentication if the requested user ID was registered
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue