

# Snowflake and Databricks: per-user enforcement at the source

Snowflake Horizon and Databricks Unity Catalog are `SNOWFLAKE` and `DATABRICKS` connections that AWS Context reaches through an AWS Glue Data Catalog connection. Their catalog metadata is ingested as public nodes, the same as AWS Glue Data Catalog metadata. The vendor enforces access to the data behind those nodes, on the identity AWS Context presents to it.

For these connections, AWS Context presents the end user’s own identity. You set `credentialBroker` in the connection’s `sourceConfig`, naming the Credential Broker provider that signs users in to the vendor and the OAuth scopes to request. An end user signs in to the vendor once, which grants AWS Context a token for that provider and those scopes. At query time, the vendor evaluates its own policies against the end user’s token, so an end user sees only the rows their Snowflake role or Unity Catalog grants allow. Changing the scopes makes every end user sign in again.

The `oauth2` client credentials in `sourceConfig` serve a different purpose. AWS Context uses them to synchronize catalog metadata, not to read data as a user. Without `credentialBroker`, metadata sync works but data cannot be queried as the calling user.

When a retrieval needs data from a vendor the end user has not signed in to, the response carries `authorizationRequired` with an `authorizationUrl`. Show the URL to the end user. The end user signs in at the vendor and consents, and is returned to AWS to complete the sign-in. Retry the request once they have. The URL is single-use and bound to that end user: someone who opens a URL issued for another end user cannot complete it. Until the end user has signed in, results from that vendor are left out, and results from the other sources in the Agent Context are still returned.

For how to create these connections, see [Databricks Unity Catalog](databricks-unity-catalog.md) and [Snowflake Horizon](snowflake-horizon.md). The Credential Broker provider is an IAM resource; for how to create one, see the AWS Identity and Access Management documentation.