bito-code-review[bot] commented on code in PR #41421:
URL: https://github.com/apache/superset/pull/41421#discussion_r3473324187
##########
docs/user_docs_versioned_docs/version-6.0.0/configuration/databases.mdx:
##########
@@ -519,6 +519,82 @@ For a connection to a SQL endpoint you need to use the
HTTP path from the endpoi
{"connect_args": {"http_path": "/sql/1.0/endpoints/****", "driver_path":
"/path/to/odbc/driver"}}
```
+##### OAuth2 Authentication
+
+Superset supports OAuth2 authentication for Databricks, allowing users to
authenticate with their personal Databricks accounts instead of using shared
access tokens. This provides better security and audit capabilities.
+
+###### Prerequisites
+
+1. Create an OAuth2 application in your Databricks account:
+ - Go to your Databricks account console
+ - Navigate to **Settings** → **Developer** → **OAuth apps**
+ - Create a new OAuth app with the redirect URI:
`http://your-superset-host:port/api/v1/database/oauth2/`
+
+2. Configure OAuth2 in your `superset_config.py`:
+
+```python
+from datetime import timedelta
+
+# OAuth2 configuration for Databricks
+# OAuth2 endpoints are automatically detected based on your Databricks cloud
provider
+DATABASE_OAUTH2_CLIENTS = {
+ "Databricks (legacy)": {
+ "id": "your-databricks-client-id",
+ "secret": "your-databricks-client-secret",
+ "scope": "sql",
+ # OAuth2 endpoints are auto-detected based on hostname, but can be
overridden:
+ # AWS: "authorization_request_uri":
"https://accounts.cloud.databricks.com/oidc/accounts/{account_id}/v1/authorize",
+ # Azure: "authorization_request_uri":
"https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/authorize",
+ # GCP: "authorization_request_uri":
"https://accounts.gcp.databricks.com/oidc/accounts/{account_id}/v1/authorize",
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Missing account_id placeholder substitution</b></div>
<div id="fix">
The `_oauth2_endpoints` in `databricks.py:289-298` uses URL templates with
`{account_id}` placeholders (e.g.,
`https://accounts.cloud.databricks.com/oidc/accounts/{}/v1/authorize`).
However, `get_oauth2_config` in `base.py:736-752` builds the config from
`DATABASE_OAUTH2_CLIENTS` entries without any `account_id` field — it only
passes `id`, `secret`, `scope`, `redirect_uri`, `authorization_request_uri`,
`token_request_uri`, `request_content_type`. No substitution occurs, so AWS/GCP
URLs will contain a literal `{}` and fail. The comment at line 547 (`# AWS:
"authorization_request_uri":
"https://accounts.cloud.databricks.com/oidc/accounts/{account_id}/v1/authorize"`)
implies `account_id` should be configured, but the key is never read in code.
</div>
</div>
<small><i>Code Review Run #0cb4e7</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]