Filter data per end user using OAuth custom identity claims
External applications can now pass end-user identifiers in service principal OAuth tokens and filter rows through dynamic views or ABAC policies.
O que mudou
Databricks now supports adding custom identity claims to OAuth tokens issued for service principals. This enables row-level data isolation for end users in multi-tenant applications without provisioning individual Databricks user accounts for each client.
Use cases
Imagine you build a SaaS application or customer portal serving hundreds of clients, storing all customer records in shared lakehouse tables. Instead of creating a Databricks user per client or managing isolated tables, your backend queries Databricks using a single service principal.
With this capability, you can:
- Pass a customer identifier or end-user identity directly when generating the service principal's OAuth token.
- Restrict rows using dynamic views or ABAC policies evaluated by
current_oauth_custom_identity_claim(). - Join identity claims with mapping tables to resolve user-specific access rules.
How to use
The application requests a token and appends the custom_claim parameter using client credentials or token exchange:
curl --request POST \
--url https://<workspace-url>/oidc/v1/token \
--user '<client-id>:<client-secret>' \
--data 'grant_type=client_credentials' \
--data 'scope=all-apis' \
--data-urlencode 'custom_claim=acme'
What happens in this code:
- Calls the Databricks OAuth token endpoint using the service principal credentials.
- Supplies
custom_claim=acmeto bind the authenticated end-user identity into the token payload.
In Unity Catalog, create a dynamic view that checks the claim:
CREATE OR REPLACE VIEW meu_catalogo.meu_schema.minha_view_pedidos AS
SELECT order_id, customer_name, product, quantity, order_date
FROM meu_catalogo.meu_schema.pedidos
WHERE customer_name = current_oauth_custom_identity_claim();
What happens in this code:
- Declares a dynamic view over the underlying table.
- Evaluates
current_oauth_custom_identity_claim()at query time to extract the token claim. - If a token lacks a claim, the function returns
NULL, safely matching zero rows.
Limitations and requirements
- Requirements: A service principal configured with an OAuth secret or identity federation policy; a SQL warehouse or compute running Databricks Runtime 19.7 or above.
- Supported surfaces: Databricks JDBC Driver connected to a SQL warehouse, SQL Statement Execution API, and Genie Agents API. Workspace UI SQL editor is not supported.
- Claim constraints: Up to 1,000 printable ASCII characters (including spaces,
\t,\n, and\r). Non-ASCII characters (e.g., accents, emoji) fail with HTTP 400. Claims are not encrypted inside the JWT payload; never store sensitive secrets in them.
- oauth
- service principal
- unity catalog
- abac
- row-level security
Filter data per end user with OAuth custom identity claims
Resumo e explicação gerados por IA a partir da release note oficial. Em caso de dúvida, a documentação oficial da plataforma prevalece.
Relacionadas
- DatabricksBeta
Conector do SurveyMonkey chega ao Lakeflow Connect no Databricks
O Lakeflow Connect agora conta com conector nativo para o SurveyMonkey em Beta, permitindo ingestão incremental de pesquisas, respostas e contatos com governança no Unity Catalog.
lakeflow connect · surveymonkey - DatabricksBeta
Lakeflow Connect adiciona conector do Oracle Eloqua em Beta
O Lakeflow Connect agora oferece um conector gerenciado em Beta para o Oracle Eloqua, permitindo ingestão incremental de dados de marketing governados pelo Unity Catalog.
lakeflow connect · oracle eloqua - DatabricksBeta
Ingira métricas do GA4 com o novo conector do Lakeflow Connect
O Lakeflow Connect ganha conector gerenciado em Beta para o Google Analytics 4, permitindo ingestão incremental de relatórios agregados via API com governança no Unity Catalog.
lakeflow connect · google analytics