or run

npx @tessl/cli init
Log in

Version

Files

docs

chart-components.mdchart-plugins.mddata-transformation.mdform-data.mdindex.mdquery-building.md
tile.json

task.mdevals/scenario-4/

Database OAuth2 Authentication Configuration Tool

Build a command-line utility that configures database connections with OAuth2 authentication in Apache Superset. The tool should allow administrators to easily set up secure database connections that use OAuth2 tokens for authentication.

Requirements

Your tool should:

  1. Accept configuration parameters for a database connection including:

    • Database name and type (e.g., Snowflake, BigQuery)
    • OAuth2 provider details (token URL, client credentials)
    • Database connection URI
    • Additional OAuth2-specific parameters
  2. Create or update a database connection object with OAuth2 authentication enabled

  3. Validate that the OAuth2 configuration is properly structured before saving

  4. Support storing encrypted OAuth2 credentials securely

Implementation

@generates

Test Cases

  • Configuring a new database with OAuth2 authentication creates a database object with proper OAuth2 settings @test
  • The configuration validates required OAuth2 parameters (token URL, client ID) and raises an error if missing @test
  • OAuth2 credentials are stored in encrypted form in the database connection @test

API

def configure_oauth2_database(
    database_name: str,
    database_type: str,
    sqlalchemy_uri: str,
    oauth2_token_url: str,
    oauth2_client_id: str,
    oauth2_client_secret: str,
    **kwargs
) -> Database:
    """
    Configure a database connection with OAuth2 authentication.

    Args:
        database_name: Name for the database connection
        database_type: Type of database (e.g., 'snowflake', 'bigquery')
        sqlalchemy_uri: SQLAlchemy connection URI
        oauth2_token_url: OAuth2 token endpoint URL
        oauth2_client_id: OAuth2 client ID
        oauth2_client_secret: OAuth2 client secret
        **kwargs: Additional OAuth2 parameters

    Returns:
        Database object configured with OAuth2 authentication

    Raises:
        ValueError: If required OAuth2 parameters are missing
    """
    pass


def validate_oauth2_config(oauth2_config: dict) -> bool:
    """
    Validate OAuth2 configuration parameters.

    Args:
        oauth2_config: Dictionary containing OAuth2 configuration

    Returns:
        True if configuration is valid

    Raises:
        ValueError: If configuration is invalid or missing required fields
    """
    pass

Dependencies { .dependencies }

apache-superset { .dependency }

Provides database connection management and OAuth2 authentication support.