refactor(oauth): Allow to use any registration method with any login function#4827
Merged
Hywan merged 9 commits intomatrix-org:mainfrom Mar 21, 2025
Merged
Conversation
There is actually no way to get an error. Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
…istration They are one- or two-liners and are only used once. Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
The name is more explicit about what the function does. Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
…code Introduces the ClientRegistrationMethod type Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
Gets rid of OAuth::url_for_oidc since it can be replaced by a call to OAuth::login now. Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
…inish_login() Accept a URL or a query string for simplicity. That way we don't need to expose AuthorizationResponse. Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
Avoids repeated calls to the same endpoint in the same flow. 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>
1f63fd4 to
c6d0bae
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4827 +/- ##
==========================================
+ Coverage 86.47% 86.50% +0.02%
==========================================
Files 297 297
Lines 34584 34600 +16
==========================================
+ Hits 29907 29930 +23
+ Misses 4677 4670 -7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Hywan
approved these changes
Mar 21, 2025
Member
Hywan
left a comment
There was a problem hiding this comment.
More clean ups 👏! More clean ups 👏!
Thanks 🙇.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This creates a
ClientRegistrationMethodenum and use it forOAuth::loginandOAuth::login_with_qr_code, allowing notable to use theOAuthRegistrationStoreevery time.We can get rid of
url_for_oidcsince everything can be done withOAuth::loginnow, and we also mergeOAuth::finish_loginandOAuth::login_with_oidc_callback()to use the simplest API.Finally there are some optimizations to reduce the number of requests by reusing the
AuthorizationServerMetadata.This can be reviewed commit by commit.