Skip to content

Commit 6867a11

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

File tree

3 files changed

+74
-3
lines changed

3 files changed

+74
-3
lines changed

content/client-server-api/_index.md

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

910911
###### Password-based
911912

@@ -1244,6 +1245,40 @@ user during registration, if applicable.
12441245

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

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

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

15951635
**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)