Skip to content

refactor(oidc): Start replacing mas-oidc-client with oauth2#4761

Merged
poljar merged 7 commits intomatrix-org:mainfrom
zecakeh:oauth2
Mar 6, 2025
Merged

refactor(oidc): Start replacing mas-oidc-client with oauth2#4761
poljar merged 7 commits intomatrix-org:mainfrom
zecakeh:oauth2

Conversation

@zecakeh
Copy link
Copy Markdown
Collaborator

@zecakeh zecakeh commented Mar 5, 2025

This makes use of the oauth2 crate for the authorization code grant and the refresh token grant.

There is still the token revocation that can use oauth2, but it requires changes in the HTTP client so it will be done separately. And the remaining parts (account management URL, fallback discovery, registration) will need to be included in the SDK to get rid of mas-oidc-client.

@zecakeh zecakeh requested a review from a team as a code owner March 5, 2025 16:00
@zecakeh zecakeh requested review from poljar and stefanceriu and removed request for a team and stefanceriu March 5, 2025 16:00
zecakeh added 5 commits March 5, 2025 17:11
Avoids to use 2 similar types with the same name.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 5, 2025

Codecov Report

Attention: Patch coverage is 91.02564% with 7 lines in your changes missing coverage. Please review.

Project coverage is 86.27%. Comparing base (6c9b1ef) to head (32ffec3).
Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
crates/matrix-sdk/src/authentication/oidc/error.rs 62.50% 3 Missing ⚠️
crates/matrix-sdk/src/authentication/oidc/mod.rs 93.75% 3 Missing ⚠️
...matrix-sdk/src/authentication/oidc/qrcode/login.rs 50.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4761   +/-   ##
=======================================
  Coverage   86.26%   86.27%           
=======================================
  Files         290      291    +1     
  Lines       34286    34291    +5     
=======================================
+ Hits        29578    29585    +7     
+ Misses       4708     4706    -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
Copy link
Copy Markdown
Contributor

@poljar poljar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks mostly good, I left a small nit about the documentation.

Comment thread bindings/matrix-sdk-ffi/src/client.rs
Comment thread crates/matrix-sdk/src/authentication/oidc/mod.rs
Comment thread crates/matrix-sdk/src/authentication/oidc/mod.rs
Comment thread crates/matrix-sdk/src/authentication/oidc/mod.rs
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
@zecakeh zecakeh requested a review from poljar March 6, 2025 11:12
Copy link
Copy Markdown
Contributor

@poljar poljar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice. Thank you very much.

@poljar poljar enabled auto-merge (rebase) March 6, 2025 11:18
@poljar poljar merged commit 740e729 into matrix-org:main Mar 6, 2025
@zecakeh zecakeh deleted the oauth2 branch March 6, 2025 11:43
stefanceriu added a commit to element-hq/element-x-ios that referenced this pull request Mar 12, 2025
…org/matrix-rust-sdk#4761

```
/// * `prompt` - The desired user experience in the web UI. No value means
///   that the user wishes to login into an existing account, and a value of
///   `Create` means that the user wishes to register a new account.
```
stefanceriu added a commit to element-hq/element-x-ios that referenced this pull request Mar 13, 2025
* Bump the RustSDK to v25.03.11

* Replace oidc login prompt with nil following the changes from matrix-org/matrix-rust-sdk#4761

```
/// * `prompt` - The desired user experience in the web UI. No value means
///   that the user wishes to login into an existing account, and a value of
///   `Create` means that the user wishes to register a new account.
```

* Fix trailing closure warnings

* Update the client proxy after making `getNotificationSettings()` and  `cachedAvatarUrl()` async (they used to be blocking on the rust side).

* Move `Room.isEncrypted` to the info publisher and manually update the encryption state when creating the room.

* Bump the SDK again to v25.03.12 - This introduces a new way to configure the tokio runtime that we can use to have extensions use less memory
- introduce a new Target struct that takes care of setting up rust services (tracing and tokio) for our various targets
- cleanup MXLog and friends

* Address PR comments

* Bump the SDK again, switch back to using `.consent` as the OIDC login prompt (which was reintroduced in matrix-org/matrix-rust-sdk/pull/4791)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants