All integrations
Spring Data JPA
Data filtering

Authorization-aware data filtering for Spring Data JPA

Convert Cerbos query plans into native Spring Data JPA filters, return only the data your users are authorized to see.

Extend Spring Data JPA roles

Extend Spring Data JPA roles

Fine-grained access controls extending the roles defined in Spring Data JPA

Enrich with context

Enrich with context

Request-time attribute-based authorization enables more contextual access controls

Avoid token bloat

Avoid token bloat

Independent authorization logic avoids bloated tokens and workarounds

How Cerbos works with Spring Data JPA

When users should only see a subset of data, traditional approaches filter results in application code, leading to duplicated logic, inconsistencies, and performance problems at scale.

Cerbos query plan evaluation converts your authorization policies into native Spring Data JPA filters. Instead of fetching all data and filtering after the fact, your database only returns rows the user is authorized to see.

The same YAML policies that control API-level access now drive data-level filtering, one source of truth for who can see what, managed by product and security teams without touching application code.

How Cerbos filters data in Spring Data JPA

  1. Define authorization policies in YAML, Write resource policies that describe who can see which records, using roles and attributes.
  2. Request a query plan from Cerbos, Your application calls the PlanResources API, and Cerbos returns an abstract query plan.
  3. Convert the plan to a native Spring Data JPA filter, Map the Cerbos query plan to a Spring Data JPA query predicate so filtering happens at the data layer.
  4. Database returns only authorized rows, The query executes with the authorization filter baked in, no post-fetch filtering required.

FAQ

How does Cerbos filter data in Spring Data JPA?

Cerbos evaluates your authorization policies and produces a query plan. The Spring Data JPA adapter converts that plan into a native query filter, so your database only returns rows the user is authorized to see.

Does this replace application-level authorization checks?

Data filtering complements API-level checks. Cerbos handles both, the same policies that control who can access an endpoint also determine which rows are visible at the data layer.

Cerbos + Spring Data JPA

  • Cerbos policies converted to native Spring Data JPA query filters
  • Database returns only rows the principal is authorized to see
  • One source of truth for API and data-level access control
  • Filtering happens at the query level, not post-fetch

What is Cerbos?

Cerbos is an end-to-end enterprise authorization software for Zero Trust environments and AI-powered systems. It enforces fine-grained, contextual, and continuous authorization across apps, APIs, AI agents, MCP servers, services, and workloads.

Cerbos consists of an open-source Policy Decision Point, Enforcement Point integrations, and a centrally managed Policy Administration Plane (Cerbos Hub) that coordinates unified policy-based authorization across your architecture. Enforce least privilege & maintain full visibility into access decisions with Cerbos authorization.