expertSystem Design Questions

Design a multi-tenant SaaS authorization model where each customer organization's data must stay fully isolated.

Embed a tenant_id claim in every issued token (via a dedicated Authorization Server realm/configuration per tenant, or a custom claim mapper), and enforce it at multiple layers as defense-in-depth: method-level @PreAuthorize/@PostFilter checks scoped by tenant_id, repository queries that always filter by the current tenant, and ideally database-level row-level security or separate schemas so even a code-level bug can't leak cross-tenant data.

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

Continue to Design a step-up authentication flow requiring extra verification (e.g., an OTP) only for high-value operations like a large fund transfer, without forcing re-login for everything.← Back to all Spring Security questions