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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

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.45455% with 2 lines in your changes missing coverage. Please review.

Project coverage is 85.72%. Comparing base (57919f5) to head (049021f).
Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
...ates/matrix-sdk/src/authentication/qrcode/login.rs 84.61% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4604      +/-   ##
==========================================
- Coverage   85.73%   85.72%   -0.01%     
==========================================
  Files         291      291              
  Lines       33288    33282       -6     
==========================================
- Hits        28538    28531       -7     
- Misses       4750     4751       +1     

☔ 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.

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