-
Notifications
You must be signed in to change notification settings - Fork 38
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
LoginFlowManager and CommandLineLoginFlowManager #972
Conversation
src/globus_sdk/experimental/auth_requirements_error/_auth_requirements_error.py
Outdated
Show resolved
Hide resolved
# type is ignored here as AuthLoginClient does not provide a signature for | ||
# oauth2_start_flow since it has different positional arguments between | ||
# NativeAppAuthClient and ConfidentialAppAuthClient | ||
self.login_client.oauth2_start_flow( # type: ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks fine to me. It's wholly self-contained in this method and looks like it works just fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that this seems fine -- for this code, as a user of the client classes.
It strikes me as a "code/design smell in the clients themselves". I'd love to resolve it, but I think it's safely out of scope for this PR to even try to fix that issue. I'm not sure what the fix really is. (A new method on the base accepting *args
and raising notimplemented? 🤔 )
src/globus_sdk/experimental/login_flow_manager/login_flow_manager.py
Outdated
Show resolved
Hide resolved
Co-authored-by: Kurt McKee <[email protected]>
src/globus_sdk/experimental/login_flow_manager/command_line_login_flow_manager.py
Show resolved
Hide resolved
src/globus_sdk/experimental/auth_requirements_error/_auth_requirements_error.py
Outdated
Show resolved
Hide resolved
src/globus_sdk/experimental/login_flow_manager/command_line_login_flow_manager.py
Show resolved
Hide resolved
src/globus_sdk/experimental/login_flow_manager/command_line_login_flow_manager.py
Outdated
Show resolved
Hide resolved
Some high-level review comments:
This seems like a good "optimization" to me. Maintaining yet-another type which has borderline identical semantics is wasted effort if we can avoid it. And we have time before we promote this out of
👍 I would be against that, if avoidable. IMO those GARE-internal objects should be pretty close to the wire-format for the data after init. That keeps the mode of interaction consistent, in that you're expected to put JSON-serializable types in there. Allowing init to convert other types to JSON-serializable ones -- like
Let's consider this noted but non-blocking for now. I agree, some 🪄 magic ✨ can probably fix this, but let's treat it separately. I'm not sure what kind of fix might be best, and it will probably involve some level of gamesmanship around backwards compatibility, typing, and abstract classes. Probably we'll do something that falls into that classic category of "backwards incompatible, but only if you're really strict about it". |
Shortcut: https://app.shortcut.com/globus/story/30763/sdk-loginmanagers-authrequirements
Two places of potential issue/improvement:
I'm using
GlobusAuthorizationParameters
as the input torun_login_flow
instead of implementingAuthRequirements
as originally spec'd. This mostly makes sense because that object has all the parameters needed for an authorization flow. It might be a bit fishy with types though. Makingprompt
aLiteral["login]
everywhere wasn't too painful, but currently anyScope
objects will have to be serialized into strings despite that fact that they're just being passed through tooauth2_start_flow
which accepts anyScopeCollectionType
(which should haveScope
added to it at some point). MakingGlobusAuthorizationParameters
acceptScopeCollectionType
seemed to not line up well with the validation logic.I've added
type: ignore
to my call toself.login_client.oauth2_start_flow
asAuthLoginClient
doesn't have a signature foroauth2_start_flow
- presumably because it has different signatures acrossNativeAppAuthClient
andConfidentialAppAuthClient
? Not sure if there is some abstract method magic that could be done here? Or maybe I should just makelogin_client
's typeNativeAppAuthClient | ConfidentialAppAuthClient
, but that also feels wrong.