rusackas commented on code in PR #36856:
URL: https://github.com/apache/superset/pull/36856#discussion_r3651456888


##########
superset/db_engine_specs/snowflake.py:
##########
@@ -192,6 +243,113 @@ class SnowflakeEngineSpec(PostgresBaseEngineSpec):
         ),
     }
 
+    # OAuth 2.0 support
+    supports_oauth2: bool = True
+    oauth2_exception: type[Exception] = CustomSnowflakeAuthError
+
+    @classmethod
+    def is_oauth2_enabled(cls) -> bool:
+        """
+        Return whether OAuth2 authentication is enabled.
+        """
+
+        # When alerts or reports connect to the database in the background,
+        # OAuth2 authentication fails; therefore, OAuth2 authentication is 
disabled
+        # for background execution.
+        if not has_request_context():
+            return False
+
+        return (
+            cls.supports_oauth2
+            and cls.engine_name in app.config["DATABASE_OAUTH2_CLIENTS"]
+        )

Review Comment:
   `DATABASE_OAUTH2_CLIENTS` has a `{}` default in `config.py`, and this 
mirrors the base-spec check verbatim, so the index can't `KeyError`.



##########
superset-frontend/src/features/databases/DatabaseModal/ExtraOptions.tsx:
##########
@@ -522,7 +522,7 @@ const ExtraOptions = ({
                     onChange={onInputChange}
                   >
                     {t(
-                      'Impersonate logged in user (Presto, Trino, Drill, Hive, 
and Google Sheets)',
+                      'Impersonate logged in user (Presto, Trino, Drill, Hive, 
Snowflake and Google Sheets)',

Review Comment:
   This diff is only the impersonation tooltip copy. Google Sheets already does 
OAuth impersonation the same way, so a caching concern here would predate this 
PR and lives in the cache-key layer, not this label.



-- 
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]

Reply via email to