Skip to content

Commit 8021499

Browse files
committed
Various clarifications to structure
1 parent df74c7d commit 8021499

File tree

1 file changed

+38
-14
lines changed

1 file changed

+38
-14
lines changed

proposals/1960-integrations-openid.md

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# MSC1960: OpenID information exchange for widgets
1+
# MSC1960: OpenID Connect information exchange for widgets
22

33
With the various integrations API proposals, widgets are left with no options to verify the
44
requesting user's ID if they need it. Widgets like the sticker picker must know who is making
@@ -10,26 +10,50 @@ API proposed by [MSC1236](https://github.com/matrix-org/matrix-doc/issues/1236).
1010

1111
## Proposal
1212

13-
Room and account widgets may request a new OpenID object from the user so they can log in/register with
13+
Room and account widgets may request new OpenID credentials from the user so they can log in/register with
1414
the backing integration manager or other application. This is largely based on the prior art available
15-
[here (riot-web#7153)](https://github.com/vector-im/riot-web/issues/7153). The rationale for such an
15+
[here (element-web#7153)](https://github.com/vector-im/element-web/issues/7153). The rationale for such an
1616
API is so that widgets can load things like a user's sticker packs or other information without having
1717
to rely on secret strings. For example, a room could be used to let a user create custom sticker packs
1818
via a common widget - it would be nice if that widget could auth the user without asking them to enter
1919
their username and password into an iframe.
2020

2121
Widgets can request OpenID credentials from the user by sending a `fromWidget` action of `get_openid`
22-
to initiate the token exchange process. The client should respond with an acknowledgement of
22+
to initiate the token exchange process. The client responds with an acknowledgement of
2323
`{"state":"request"}` (or `{"state":"blocked"}` if the client/user doesn't think the widget is safe).
24-
The client should then prompt the user if the widget should be allowed to get details about the user,
24+
The client then prompts the user if the widget should be allowed to get details about the user,
2525
optionally providing a way for the user to always accept/deny the widget. If the user agrees, the
2626
client sends a `toWidget` action of `openid_credentials` with `data` holding the raw OpenID credentials
27-
object returned from the homeserver, and a `success: true` parameter. If the user denies the widget,
28-
just `success: false` is returned in the `data` property. To lessen the number of requests, a client may
29-
also respond to the original `get_openid` request with a `state` of `"allowed"`, `success: true`, and
30-
the OpenID object (just like in the data for `openid_credentials`). The widget should not request OpenID
31-
credentials until after it has exchanged capabilities with the client, however this is not required. The
32-
widget should acknowledge the `openid_credentials` request with an empty response object.
27+
object returned from the homeserver, and a `success: true` parameter, similar to the following:
28+
```
29+
{
30+
"api": "fromWidget",
31+
"requestId": "AABBCC",
32+
"action": "openid_credentials",
33+
"widgetId": "DDEEFF",
34+
"data": {
35+
"success": true,
36+
"access_token": "SecretTokenHere",
37+
"token_type": "Bearer",
38+
"matrix_server_name": "example.com",
39+
"expires_in": 3600
40+
}
41+
}
42+
```
43+
44+
For clarity, the `data` consists of properties as returned by `/_matrix/client/r0/user/:userId/openid/request_token`
45+
plus the `success` parameter.
46+
47+
If the user denies the widget, just `success: false` is returned in the `data` property.
48+
49+
To lessen the number of requests, a client can also respond to the original `get_openid` request with a
50+
`state` of `"allowed"`, `success: true`, and the OpenID Connect credentials object (just like in the `data` for
51+
`openid_credentials`).
52+
53+
The widget should not request OpenID credentials until after it has exchanged capabilities with the client,
54+
however this is not required to wait for the capabiltiies exchange.
55+
56+
The widget acknowledges the `openid_credentials` request with an empty response object.
3357

3458
A successful sequence diagram for this flow is as follows:
3559

@@ -67,17 +91,17 @@ Prior to this proposal, widgets could use an undocumented `scalar_token` paramet
6791
send it to the widget. Clients typically chose to send it if the widget's URL matched a whitelist for URLs
6892
the client trusts. Widgets are now not able to rely on this behaviour with this proposal, although clients
6993
may wish to still support it until adoption is complete. Widgets may wish to look into cookies and other
70-
storage techniques to avoid continously requesting credentials.
94+
storage techniques to avoid continously requesting credentials, regardless of how they got those credentials.
7195

72-
A proof of concept for this system is demonstrated [here](https://github.com/matrix-org/matrix-react-sdk/pull/2781).
96+
An implementation of this proposal is [here](https://github.com/matrix-org/matrix-react-sdk/pull/2781).
7397

7498
The widget is left responsible for dealing with the OpenID object it receives, likely handing it off to
7599
the integration manager it is backed by to exchange it for a long-lived Bearer token.
76100

77101
## Security considerations
78102

79103
The user is explicitly kept in the loop to avoid automatic and silent harvesting of private information.
80-
Clients must ask the user for permission to send OpenID information to a widget, but may optionally allow
104+
Clients must ask the user for permission to send OpenID Connect information to a widget, but may optionally allow
81105
the user to always allow/deny the widget access. Clients are encouraged to notify the user when future
82106
requests are automatically handled due to the user's prior selection (eg: an unobtrusive popup saying
83107
"hey, your sticker picker asked for your information. [Block future requests]").

0 commit comments

Comments
 (0)