TenantLayer
A library for implementing and verifying tenant data isolation in Spring Boot and Postgres.
What does it do?
Developers add dependencies and configuration, then set policies for each table to apply tenant isolation. The library offers row-level security, per-tenant schemas, and per-tenant database strategies, with configuration to choose a strategy. It also describes carrying tenant information through Kafka messages and asynchronous work, beyond requests. Isolation tests run against real Postgres and Kafka, and deliberately changing the implementation checks that the tests fail. Using row-level security requires care with the permissions assigned to the database connection role.
Key features
- Isolates tenant data with Postgres row-level security
- Supports per-schema and per-database tenant strategies
- Switches isolation strategies through configuration
- Carries tenant information through Kafka production and consumption
- Tests isolation using real Postgres and Kafka