Skip to content

Commit 47cce0c

Browse files
committed
Spec for MSC4312: Resetting cross-signing keys in the OAuth world
Signed-off-by: Johannes Marbach <[email protected]>
1 parent 9d063c8 commit 47cce0c

File tree

4 files changed

+75
-3
lines changed

4 files changed

+75
-3
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add the `m.oauth` authentication type for User-Interactive Authentication as per [MSC4312](https://github.com/matrix-org/matrix-spec-proposals/pull/4312).

content/client-server-api/_index.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,7 @@ This specification defines the following auth types:
907907
- `m.login.dummy`
908908
- `m.login.registration_token`
909909
- {{% added-in v="1.11" %}} `m.login.terms`
910+
- {{% added-in v="1.17" %}} `m.oauth`
910911

911912
###### Password-based
912913

@@ -1245,6 +1246,40 @@ user during registration, if applicable.
12451246

12461247
{{% definition path="api/client-server/definitions/m.login.terms_params" %}}
12471248

1249+
###### OAuth authentication
1250+
1251+
{{% added-in v="1.17" %}}
1252+
1253+
| Type | Description |
1254+
|-------------------------------|-------------------------------------------------------------------|
1255+
| `m.oauth` | Authentication is supported by authorising via the homeserver's OAuth account management web UI. |
1256+
1257+
{{% boxes/note %}}
1258+
The `m.oauth` authentication type is currently only valid on the
1259+
[`/keys/device_signing/upload`](/client-server-api/#post_matrixclientv3keysdevice_signingupload) endpoint.
1260+
{{% /boxes/note %}}
1261+
1262+
This authentication type provides homeservers the ability to guard access to
1263+
sensitive actions when the client has authenticated via the
1264+
[OAuth 2.0 API](/client-server-api/#oauth-20-api), which is otherwise not
1265+
compatible with User-Interactive Authentication (UIA). To do so, the server
1266+
returns a 401 response on the respective request, where the response body
1267+
includes `m.oauth` in the `flows` list, and the `m.oauth` property in the
1268+
`params` object has the structure [shown below](#definition-moauth-params).
1269+
1270+
The client is expected to open the contained URL to let the user confirm the
1271+
action in the homeserver's account management web UI. Once the user has done
1272+
so, the client submits an `auth` dict with just the `session`, as follows,
1273+
to complete the stage:
1274+
1275+
```json
1276+
{
1277+
"session": "<session ID>"
1278+
}
1279+
```
1280+
1281+
{{% definition path="api/client-server/definitions/m.oauth_params" %}}
1282+
12481283
##### Fallback
12491284

12501285
Clients cannot be expected to be able to know how to process every
@@ -1591,6 +1626,11 @@ because they don't have access to the user's credentials anymore.
15911626
The [User-Interactive Authentication API](#user-interactive-authentication-api)
15921627
is not compatible with the OAuth 2.0 API, so the endpoints that depend on it for
15931628
authentication can't be used when an access token is obtained with this API.
1629+
1630+
The only exception to this is the
1631+
[`/keys/device_signing/upload`](/client-server-api/#post_matrixclientv3keysdevice_signingupload)
1632+
endpoint which uses the [`m.oauth`](/client-server-api/#oauth-authentication)
1633+
authentication type.
15941634
{{% /boxes/warning %}}
15951635

15961636
**Sample flow**

data/api/client-server/cross_signing.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,12 @@ paths:
4040
makes this endpoint idempotent in the case where the response is lost over the network,
4141
which would otherwise cause a UIA challenge upon retry.
4242
43-
{{% boxes/warning %}}
44-
When this endpoint requires User-Interactive Authentication, it cannot be used when the access token was obtained
43+
{{% boxes/note %}}
44+
When this endpoint requires User-Interactive Authentication,
45+
it uses the [`m.oauth`](/client-server-api/#oauth-authentication)
46+
authentication type if the access token was obtained
4547
via the [OAuth 2.0 API](/client-server-api/#oauth-20-api).
46-
{{% /boxes/warning %}}
48+
{{% /boxes/note %}}
4749
operationId: uploadCrossSigningKeys
4850
security:
4951
- accessTokenQuery: []
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright 2025 The Matrix.org Foundation C.I.C.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
type: object
16+
title: m.oauth params
17+
description: Schema for `m.oauth` entry in the `params` object in a User-Interactive Authentication response.
18+
required: ['url']
19+
properties:
20+
url:
21+
type: string
22+
format: uri
23+
description: |
24+
A URL pointing to the homeserver's OAuth account management web UI
25+
where the user can approve the action. MUST be a valid URI with scheme
26+
`http://` or `https://`, the latter being RECOMMENDED.
27+
example: {
28+
"url": "https://example.org/account/reset-cross-signing"
29+
}

0 commit comments

Comments
 (0)