Skip to content

Conversation

@wseaton
Copy link
Contributor

@wseaton wseaton commented Jun 6, 2024

WIP for #36

Took the liberty of refactoring some of the internal session functions along the way, opening this to discuss how that is best done mostly. Current refactoring is going to potentially result in some API breakage.

External Oauth is tested to work on my account.

@sbose78
Copy link

sbose78 commented Jun 7, 2024

Hey, very cool, @wseaton !

schema: args.schema,
username: args.username,
role: args.role,
auth_type: snowflake_api::AuthType::Password(PasswordArgs {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Instead of having two different internal AuthType enums with slightly different purposes, what if SnowflakeApi was just generic over an AuthType trait, that implements functions for building the login flow? I think that would clean the code up a lot.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

SnowflakeApi<OAuth> where OAuth impl AuthType, etc.

}
AuthType::OAuth(token) => {
log::info!("Starting session with oauth authentication");
self.create(self.oauth_request_body(token)).await
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here's where we'd want to use generics on the AuthType trait and implement get_request_body for each auth type.

@colin99d
Copy link
Contributor

This is very cool! Something we were looking into ourselves.

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