draft: Refactor OAuth Social Providers - #273
Conversation
771ec79 to
0c6e85b
Compare
4e647cb to
b5413f6
Compare
|
Had a first skim. Looks promising. Never loved the verbosity, so pulling in a second layer for providers that can remain mostly declarative makes a lot of sense 👍 My only concern with the OAuth code in general is that it's hard to impossible to test :/. Did you have the chance to test a one or more providers? 🙏 EDIT: Are you still iterating or is this good to go? |
|
Sorry, wound up caught up in some personal stuff. this is good to go as far as tests and all, but idk, i still feel like its not quite right. Maybe just perfectionism |
…re. This is in context for #273.
…providers to not return an email if the configured `UserIdentifier` policy allows it, and allow social OAuth providers to adjust their scope based on policy. This is based on #273, plus policy enforcement, plus dependent scoping. Thanks @UserNobody14 🙏
…ider. This is mostly a verbatim extraction from #273 authored by @UserNobody14. Only the UI description was updated. Thanks! Co-Authored-By: UserNobody14 <zqhlweic4ri8@opayq.com>
|
FTR: I started upstreaming the most critical changes proposed here. There's a lot going on and I have a hard time wrapping my head around all of them at once (me problem) while ensuring the behavior doesn't change :) What happened:
🙏 IUC, the only thing still missing (probably the lowest priority) is to make "simple" Social providers less verbose by having a shared parametrized implementation. I'll probably also look into this but in due time. |
|
Update: I simplified many of the providers very much inspired by your proposal incorporating all the other changes (conditional scopes, simplified base trait). It's not quite declarative and I'm sure lines could be saved but it's pretty thin on abstractions and w/ scopes being more conditional, this feels like a reasonable trade-off: https://github.com/trailbaseio/trailbase/blob/dev/crates/core/src/auth/oauth/providers/gitlab.rs This was some of the most finicky code, thanks for stepping on my toes and this awesome PR 🙏 |
3432fa3 to
2236834
Compare
8c38ebb to
6fcf273
Compare
Refactored the repetitive oauth provider code into a series of handy flexible traits, and added tests for the many different quirks of the providers.
I also believe this is a solution to #215, allowing more configurable scopes to be entered, and eliminating email requirements for providers that may not furnish them for one reason or another.
Looking at ways to reduce the line count on this one, i still feel its a bit repetitive.