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

Adding support for Private key file based authentication #149

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vyanamandra
Copy link

Please review my changes for adding private key file based authentication.

I have tested the changes locally.

Copy link
Collaborator

@sfc-gh-cnivera sfc-gh-cnivera left a comment

Choose a reason for hiding this comment

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

Looks great! Just left a few clarifying questions, perhaps due to my unfamiliarity with private key sign-in.

@@ -169,6 +169,28 @@ set SNOWFLAKE_AUTHENTICATOR=externalbrowser
os.environ['SNOWFLAKE_AUTHENTICATOR'] = 'externalbrowser'
```

4. Private Key based authentication
```bash
SNOWFLAKE_AUTHENTICATOR=
Copy link
Collaborator

Choose a reason for hiding this comment

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

It might be confusing to some folks about setting this to the empty string, I'd just leave a comment that this doesn't need to be set:

Suggested change
SNOWFLAKE_AUTHENTICATOR=
# no SNOWFLAKE_AUTHENTICATOR needed

if not SNOWFLAKE_PASSWORD and not SNOWFLAKE_AUTHENTICATOR:
missing_env_vars.append("SNOWFLAKE_PASSWORD/SNOWFLAKE_AUTHENTICATOR")
if not SNOWFLAKE_AUTHENTICATOR:
if not SNOWFLAKE_PASSWORD and not SNOWFLAKE_PRIVATE_KEY_FILE:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm assuming SNOWFLAKE_PASSWORD and SNOWFLAKE_PRIVATE_KEY_FILE are mutually exclusive (i.e. you can have one or the other but not both)? If that's the case, it might be nice to make the message a little clearer to the user:

Suggested change
if not SNOWFLAKE_PASSWORD and not SNOWFLAKE_PRIVATE_KEY_FILE:
if not SNOWFLAKE_PASSWORD:
missing_env_vars.append("SNOWFLAKE_PASSWORD/SNOWFLAKE_AUTHENTICATOR")
elif not SNOWFLAKE_PRIVATE_KEY_FILE:
missing_env_vars.append("SNOWFLAKE_PRIVATE_KEY_FILE")

@@ -417,9 +417,18 @@ def _get_user(self) -> str:
)
return user

def _is_authentication_setup(self) -> bool:
password = env_vars.SNOWFLAKE_PASSWORD
private_key_file = env_vars.SNOWFLAKE_PRIVATE_KEY_FILE
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need to be also verifying the presence of SNOWFLAKE_PRIVATE_KEY_FILE_PWD?

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