-
-
Notifications
You must be signed in to change notification settings - Fork 135
Specify MSC3882: Using an existing session to log in another #1530
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c695328
Specify MSC3882: Using an existing session to log in another
turt2live ce721cd
Changelog entries
turt2live 53d0540
Update data/api/client-server/login.yaml
turt2live 8248da4
Link to endpoint
turt2live 224cd36
Copy/paste `auth` dict definition
turt2live d888880
Move get_token API to the correct version prefix (v1, not v3)
turt2live 90a9173
Apply suggestions from code review
turt2live File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Add an ability to use an existing session to log in another, as per [MSC3882](https://github.com/matrix-org/matrix-spec-proposals/pull/3882). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| [`POST /_matrix/client/v3/login/get_token`](/client-server-api/#post_matrixclientv1loginget_token). | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,118 @@ | ||
| # Copyright 2023 The Matrix.org Foundation C.I.C. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| swagger: '2.0' | ||
| info: | ||
| title: "Matrix Client-Server Registration and Login API" | ||
| version: "1.0.0" | ||
| host: localhost:8008 | ||
| schemes: | ||
| - https | ||
| - http | ||
| basePath: /_matrix/client/v1 | ||
| consumes: | ||
| - application/json | ||
| produces: | ||
| - application/json | ||
| securityDefinitions: | ||
| $ref: definitions/security.yaml | ||
| paths: | ||
| "/login/get_token": | ||
| post: | ||
| summary: Optional endpoint to generate a single-use, time-limited, `m.login.token` token. | ||
| description: |- | ||
| Optional endpoint - the server is not required to implement this endpoint if it does not | ||
| intend to use or support this functionality. | ||
|
|
||
| This API endpoint uses the [User-Interactive Authentication API](/client-server-api/#user-interactive-authentication-api). | ||
|
|
||
| An already-authenticated client can call this endpoint to generate a single-use, time-limited, | ||
| token for an unauthenticated client to log in with, becoming logged in as the same user which | ||
| called this endpoint. The unauthenticated client uses the generated token in a `m.login.token` | ||
| login flow with the homeserver. | ||
|
|
||
| Clients, both authenticated and unauthenticated, might wish to hide user interface which exposes | ||
| this feature if the server is not offering it. Authenticated clients can check for support on | ||
| a per-user basis with the `m.get_login_token` [capability](/client-server-api/#capabilities-negotiation), | ||
| while unauthenticated clients can detect server support by looking for an `m.login.token` login | ||
| flow with `get_login_token: true` on [`GET /login`](/client-server-api/#post_matrixclientv3login). | ||
|
|
||
| In v1.7 of the specification, transmission of the generated token to an unauthenticated client is | ||
| left as an implementation detail. Future MSCs such as [MSC3906](https://github.com/matrix-org/matrix-spec-proposals/pull/3906) | ||
| might standarise a way to transmit the token between clients. | ||
|
|
||
| The generated token MUST only be valid for a single login, enforced by the server. Clients which | ||
| intend to log in multiple devices must generate a token for each. | ||
|
|
||
| With other User-Interactive Authentication (UIA)-supporting endpoints, servers sometimes do not re-prompt | ||
| for verification if the session recently passed UIA. For this endpoint, servers should always re-prompt | ||
| the user for verification to ensure explicit consent is gained for each additional client. | ||
|
|
||
| Servers are encouraged to apply stricter than normal rate limiting to this endpoint, such as maximum | ||
| of 1 request per minute. | ||
| operationId: generateLoginToken | ||
| x-addedInMatrixVersion: "1.7" | ||
| security: | ||
| - accessToken: [] | ||
| parameters: | ||
| - in: body | ||
| name: body | ||
| required: true | ||
| schema: | ||
| type: object | ||
| properties: | ||
| auth: | ||
| description: |- | ||
| Additional authentication information for the user-interactive authentication API. | ||
| allOf: | ||
| - $ref: "definitions/auth_data.yaml" | ||
| responses: | ||
| 200: | ||
| description: The login token an unauthenticated client can use to log in as the requesting user. | ||
| examples: | ||
| application/json: { | ||
| "login_token": "<opaque string>", | ||
| "expires_in_ms": 120000 | ||
| } | ||
| schema: | ||
| type: object | ||
| required: ["login_token", "expires_in_ms"] | ||
| properties: | ||
| login_token: | ||
| type: string | ||
| description: The login token for the `m.login.token` login flow. | ||
| expires_in_ms: | ||
| type: integer | ||
| description: |- | ||
| The time remaining in milliseconds until the homeserver will no longer accept the token. `120000` | ||
| (2 minutes) is recommended as a default. | ||
| 400: | ||
| description: |- | ||
| The request was malformed, or the user does not have an ability to generate tokens for their devices, | ||
| as implied by the [User-Interactive Authentication API](/client-server-api/#user-interactive-authentication-api). | ||
|
|
||
| Clients should verify whether the user has an ability to call this endpoint with the `m.get_login_token` | ||
| [capability](/client-server-api/#capabilities-negotiation). | ||
| schema: | ||
| "$ref": "definitions/errors/error.yaml" | ||
| 401: | ||
| description: |- | ||
| The homeserver requires additional authentication information. | ||
| schema: | ||
| "$ref": "definitions/auth_response.yaml" | ||
| 429: | ||
| description: This request was rate-limited. | ||
| schema: | ||
| "$ref": "definitions/errors/rate_limited.yaml" | ||
| tags: | ||
| - Session management |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.