Commit 1be703a
committed
Add SSO login support
Changes:
1. Updated Cargo.toml
Added "sso-login" feature to the matrix-sdk dependency
2. Updated connection.rs
Added a local HTTP server to automatically capture the SSO callback
Added SsoLoginUrl(String) variant to ClientMessage enum
Added LoginType import from ruma::api::client::session::get_login_types::v3
Updated response_receiver to handle SsoLoginUrl messages
Modified sync_loop to:
Query available login flows using get_login_types()
Check if SSO is available
Generate and display SSO URL when SSO is available and credentials are empty
Fall back to password login when credentials are provided
Added login_with_token() method to complete SSO login with a token
3. Updated server.rs
Added receive_sso_url() method to display SSO URL and optionally open browser
Added complete_sso_login() method to complete SSO login with a token
Added use_sso parameter (defaults to False)
4. Updated commands/matrix.rs
Added sso-complete command to the command structure
Added handler method sso_complete_command()
Added subcommand to argparse
How to use:
* Connect with empty username/password:
/matrix connect myserver
The plugin will:
Check if SSO is available on matrix.org
Display the SSO login URL
Optionally open it in your browser
* After completing SSO in the browser:
Copy the loginToken from the callback URL (the parameter after loginToken=)
* Run:
/matrix sso-complete m <login-token>
The plugin will complete the login and you'll be connected.
The implementation follows the same pattern as the matrix-rust-sdk
examples and should work with matrix.org and other homeservers that
support SSO.
Assisted-by: Cursor AI agent (Claude 4.5 Opus)
Signed-off-by: Bogdan Dobrelya <bogdando@yahoo.com>1 parent 4cc5777 commit 1be703a
5 files changed
Lines changed: 527 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| 46 | + | |
45 | 47 | | |
46 | 48 | | |
47 | 49 | | |
| |||
61 | 63 | | |
62 | 64 | | |
63 | 65 | | |
| 66 | + | |
64 | 67 | | |
65 | | - | |
| 68 | + | |
66 | 69 | | |
67 | 70 | | |
68 | 71 | | |
| |||
219 | 222 | | |
220 | 223 | | |
221 | 224 | | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
222 | 245 | | |
223 | 246 | | |
224 | 247 | | |
225 | 248 | | |
| 249 | + | |
226 | 250 | | |
227 | 251 | | |
228 | 252 | | |
| |||
323 | 347 | | |
324 | 348 | | |
325 | 349 | | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
326 | 366 | | |
327 | 367 | | |
328 | 368 | | |
| |||
0 commit comments