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

feat: Add support for browser authentication #204

Merged
merged 5 commits into from
Jul 3, 2024

Conversation

dlouseiro
Copy link
Contributor

@dlouseiro dlouseiro commented Jun 5, 2024

The purpose of this PR is to add support for SSO authentication via external browser (documented here).

As I detailed in this issue, while the most common authentication methods used for production users (Snowflake service account) are basic authentication (user/password) and RSA key-pair authentication, local executions can be done with personal users which, in some companies' Snowflake setup don't have a password, but can only authenticate via SSO (using an external browser).

Implementation details:

  • Add new configuration property use_browser_authentication, which defaults to false (added to README.md, meltano.yml and target_snowflake/target.py)
  • Added secure-local-storage extra to the snowflake-connector-python (needed for SSO tokens to be cacheable - documented here)
  • Update poetry.lock
  • Add settings_group_validation for the three possible flows: user/password, user/private_key_path and user/use_browser_authentication

Closes #203

@dlouseiro
Copy link
Contributor Author

FYI, this is my first PR in this repo (or in any other repo from MeltanoLabs so I may have something missing). Would of course appreciate some help from the reviewers to guide me in the right direction!

@edgarrmondragon
Copy link
Member

@dlouseiro thanks for contributing! Would you mind rebasing your branch to the latest main?

@edgarrmondragon edgarrmondragon added the enhancement New feature or request label Jun 17, 2024
@dlouseiro
Copy link
Contributor Author

@dlouseiro thanks for contributing! Would you mind rebasing your branch to the latest main?

Sure, will do!

The purpose of this PR is to add a new authentication method, using SSO authentication using an external browser (documented [here](https://docs.snowflake.com/en/developer-guide/node-js/nodejs-driver-authenticate#using-single-sign-on-sso-through-a-web-browser)).

While the most common setup for production-like executions on a remote machine is via user/password or RSA key-pair authentication, having browser based authentication is useful for local/dev executions using a Snowflake personal user (not a service account).

### Implementation:
- Add new parameter to `meltano.yml`
- Add new parameter to config dict in `target_snowflake/target.py`
- Add new parameter to `README.md`
- Add logic to handle browser based authentication in `target_snowflake/connector.py:get_sqlalchemy_url`
The purpose of this PR is to use the `secure-local-storage` extra in `snowflake-connector-python` for the SSO token caching to work.

### Implementation:
- Add `secure-local-storage` extra to `pyproject.toml`
- Update `poetry.lock`
@dlouseiro
Copy link
Contributor Author

@dlouseiro thanks for contributing! Would you mind rebasing your branch to the latest main?

Sure, will do!

DOne @edgarrmondragon

Copy link
Member

@edgarrmondragon edgarrmondragon left a comment

Choose a reason for hiding this comment

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

LGTM!

@edgarrmondragon edgarrmondragon merged commit 1ee1a46 into MeltanoLabs:main Jul 3, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for browser authentication
2 participants