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: OAuth2 database field #30126

Merged
merged 1 commit into from
Sep 4, 2024
Merged

feat: OAuth2 database field #30126

merged 1 commit into from
Sep 4, 2024

Conversation

betodealmeida
Copy link
Member

SUMMARY

More work on Snowflake OAuth2 (this PR depends on #30082). This PR introduces a new field for the database configuration modal, allowing OAuth2 client information to be provided by the user:

Screenshot 2024-09-02 at 8 57 34 AM

The component combines the 5 different input fields, and then passes them inside the masked_encrypted_extra attribute on database CRUD:

{
  "oauth2_client_info": {
    "id": "123456",
    "secret": "XXXXXXXXXXXX",
    "authorization_request_uri": "https://account.snowflakecomputing.com/oauth/authorize",
    "token_request_uri": "https://account.snowflakecomputing.com/oauth/token-request",
    "scope": "refresh_token session:role:USERADMIN"
  }
}

(Note that ideally we would pass these in the parameters field, and let the DB engine spec build the object in encrypted_extra. But the build_sqlalchemy_uri method — as the name suggests — only builds an URI, so we would have to modify it to return a tuple with (uri, connect_args) if we passed them client information inside parameters, and also figure out a way to inform that these fields should be stored in encrypted_extra, not extra, so for now the frontend does the work. I left a small TODO for me to fix this in the future.)

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

See above.

TESTING INSTRUCTIONS

Adding tests.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@github-actions github-actions bot added the api Related to the REST API label Sep 2, 2024
@@ -161,23 +161,20 @@ export const httpPathField = ({
getValidation,
validationErrors,
db,
}: FieldPropTypes) => {
console.error(db);
Copy link
Member Author

Choose a reason for hiding this comment

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

Removed this.

@betodealmeida betodealmeida force-pushed the oauth2-client-field branch 2 times, most recently from 345d079 to fbeeb5a Compare September 3, 2024 13:56
@betodealmeida betodealmeida marked this pull request as ready for review September 3, 2024 13:56
@dosubot dosubot bot added authentication Related to authentication change:frontend Requires changing the frontend data:connect:snowflake Related to Snowflake labels Sep 3, 2024
@betodealmeida betodealmeida force-pushed the oauth2-client-field branch 2 times, most recently from 1cff541 to cea5d85 Compare September 3, 2024 14:50
@sadpandajoe
Copy link
Member

/testenv up

@sadpandajoe sadpandajoe requested a review from rtexelm September 3, 2024 18:52
Copy link
Contributor

github-actions bot commented Sep 3, 2024

@sadpandajoe Ephemeral environment spinning up at http://34.222.11.9:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

}: {
target: HTMLInputElement;
}) =>
onChange(ActionType.EncryptedExtraInputChange, {
Copy link
Member

Choose a reason for hiding this comment

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

This is super helpful!

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I was surprised it didn't exist yet!

@betodealmeida betodealmeida changed the base branch from show-oauth2-errors to master September 4, 2024 00:12
@github-actions github-actions bot removed the api Related to the REST API label Sep 4, 2024
@betodealmeida betodealmeida merged commit ff449ad into master Sep 4, 2024
34 checks passed
Copy link
Contributor

github-actions bot commented Sep 4, 2024

Ephemeral environment shutdown and build artifacts deleted.

@rusackas rusackas deleted the oauth2-client-field branch September 4, 2024 19:54
@sfirke sfirke mentioned this pull request Sep 5, 2024
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
authentication Related to authentication change:frontend Requires changing the frontend data:connect:snowflake Related to Snowflake size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants