Skip to content
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

refactor(auth-qrcode): Use oauth2 crate instead of openidconnect #4604

Merged
merged 7 commits into from
Feb 13, 2025

Conversation

zecakeh
Copy link
Collaborator

@zecakeh zecakeh commented Feb 2, 2025

The "next-gen auth" MSCs are now only based on OAuth 2.0, which is simpler than OpenID Connect.

This sholdn't break anything but I haven't tested it in production.

The MSCs are now only based on OAuth 2.0, which is simpler than OpenID Connect.

Signed-off-by: Kévin Commaille <[email protected]>
@zecakeh zecakeh requested a review from a team as a code owner February 2, 2025 18:45
@zecakeh zecakeh requested review from bnjbvr and removed request for a team February 2, 2025 18:45
Copy link

codecov bot commented Feb 2, 2025

Codecov Report

Attention: Patch coverage is 95.34884% with 2 lines in your changes missing coverage. Please review.

Project coverage is 85.79%. Comparing base (9c9944a) to head (c6d2ab4).
Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
...ates/matrix-sdk/src/authentication/qrcode/login.rs 83.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4604      +/-   ##
==========================================
- Coverage   85.79%   85.79%   -0.01%     
==========================================
  Files         293      293              
  Lines       33774    33768       -6     
==========================================
- Hits        28976    28970       -6     
  Misses       4798     4798              

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

@bnjbvr
Copy link
Member

bnjbvr commented Feb 3, 2025

Is there some context to this change, some Github issue with a rationale maybe?

@zecakeh
Copy link
Collaborator Author

zecakeh commented Feb 3, 2025

There is a bit of rationale in #4593 and #4550.

One of the main differences between OAuth 2.0 and OIDC is that the latter requires the use of an id_token, which is something that is NOT in OAuth 2.0. So the openidconnect crate will require fields related to it in responses from the server, but it is not something that is mandated anymore by the MSCs.

Copy link
Member

@bnjbvr bnjbvr left a comment

Choose a reason for hiding this comment

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

I skimmed the changes and they seem pretty simple, thanks a bunch. In terms of requirements before landing, I'd like to make sure this is tested in some of the EX apps before we merge this.

@@ -0,0 +1,133 @@
// Copyright 2024 The Matrix.org Foundation C.I.C.
Copy link
Member

Choose a reason for hiding this comment

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

2025

Comment on lines 33 to 39
type OauthClientInner<
HasAuthUrl = EndpointNotSet,
HasDeviceAuthUrl = EndpointSet,
HasIntrospectionUrl = EndpointNotSet,
HasRevocationUrl = EndpointNotSet,
HasTokenUrl = EndpointSet,
> = BasicClient<HasAuthUrl, HasDeviceAuthUrl, HasIntrospectionUrl, HasRevocationUrl, HasTokenUrl>;
Copy link
Member

Choose a reason for hiding this comment

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

can this be type OauthClientInner = BasicClient<EndpointNotSet, ...> to avoid the generics? And if OauthClientInner is used only a single time, we can even inline the type declaration into its one use, likely?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Indeed, let's inline this, I was hesitating whether to do it or not.

@zecakeh
Copy link
Collaborator Author

zecakeh commented Feb 3, 2025

FWIW, I tested this via the qr-login example with beta.matrix.org and it works.

@poljar
Copy link
Contributor

poljar commented Feb 13, 2025

I tested this with the qr-login example as well. Can confirm that it works.

Copy link
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.

Could you please resolve the merge conflict, then we can go ahead and merge.

@zecakeh
Copy link
Collaborator Author

zecakeh commented Feb 13, 2025

Done

@zecakeh
Copy link
Collaborator Author

zecakeh commented Feb 13, 2025

Actually the changelog is in the wrong place, let me fix that

Signed-off-by: Kévin Commaille <[email protected]>
@zecakeh
Copy link
Collaborator Author

zecakeh commented Feb 13, 2025

And done.

@poljar poljar enabled auto-merge (rebase) February 13, 2025 14:37
auto-merge was automatically disabled February 13, 2025 14:41

Rebase failed

@poljar poljar merged commit 51a1cd3 into matrix-org:main Feb 13, 2025
42 checks passed
@zecakeh zecakeh deleted the qr-login-oauth2 branch February 13, 2025 21:13
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.

3 participants