HomeCase studiesMulti-Tenant Identity and Access Management Platform Built...

Case study · London, United Kingdom

Multi-Tenant Identity and Access Management Platform Built with Java, Spring Boot, and PostgreSQL

Enterprise SSO, RBAC & Directory Governance

Growing SaaS platforms and regulated enterprises struggle when authentication, role hierarchies, and external directory provisioning fragment across dozens of legacy microservices. We engineered a multi-tenant Identity and Access Management platform in Java, Spring Boot, and PostgreSQL supporting OIDC, SAML 2.0, SCIM 2.0 lifecycle sync, and fine-grained RBAC/ABAC policy evaluation. Built for strict tenant isolation and deterministic session revocation, the platform centralizes login flows, MFA enforcement, and cryptographic audit trails across web consoles and API consumers.

Industry
Enterprise SSO, RBAC & Directory Governance
Solution
A modular Java and Spring Boot authorization server paired with PostgreSQL row-isolated schemas, delivering federated SSO, SCIM provisioning, and low-latency policy evaluation over web and API.
Platforms
Web & API
Stack
Java · Spring Boot · PostgreSQL · Redis · OAuth2 / OIDC · SAML 2.0
Location
London, United Kingdom · delivered remotely
Role
Engineering, with the team behind for mobile and QA

Delivered remotely for a business based in London, United Kingdom. Names withheld by agreement.

Project Overview

Authentication rarely stays simple once an application moves upmarket. Every enterprise buyer arrives with its own identity provider, conditional MFA policies, custom SAML metadata, and automated offboarding rules. Teams that patch together ad-hoc JWT middleware, separate admin user tables, and brittle CSV user imports soon discover permission drift, orphaned accounts after employee departures, and fragile login flows.

Designed for regulated financial and B2B software environments in London, we built a multi-tenant Identity and Access Management (IAM) platform on Java, Spring Boot, and PostgreSQL. The platform unifies OIDC/OAuth 2.1 authentication, SAML 2.0 enterprise federation, SCIM 2.0 directory synchronization, and hierarchical RBAC/ABAC authorization behind a clean web administration console and low-latency APIs.

Identity & Governance Bottlenecks

Prior to unifying identity infrastructure, engineering and security teams faced four recurring failure modes:

  • Orphaned contractor access: Manual deprovisioning left terminated users holding valid refresh tokens across peripheral internal tools.
  • Protocol fragmentation: Separate homegrown integrations handled SAML assertions, OAuth client credentials, and API keys with inconsistent expiration and audit behavior.
  • Coarse permission models: Flat admin/member flags could not express multi-organization hierarchies, read-only auditor scopes, or resource-specific attribute constraints.
  • Unsafe schema sharing: Multi-tenant APIs relied purely on developer discipline to append tenant filters, creating constant anxiety over cross-account leakage.

Architectural Strategy

We treated identity as centralized cryptographic truth paired with decentralized fast verification. Rather than routing every microservice call through a heavy database join, Spring Boot issues short-lived asymmetrically signed tokens carrying compact tenant and role claims, while critical mutations and token refreshes consult Redis session epochs and PostgreSQL policy tables.

PostgreSQL serves as the authoritative graph for organizations, users, federated IdP bindings, and nested permission sets, protected by Row-Level Security. Redis complements relational durability by absorbing high-frequency checks—PKCE code verifiers, SAML replay nonces, MFA brute-force counters, and instantaneous revocation flags.

Core Capabilities

  • Federated Enterprise SSO: Supports SAML 2.0 and OIDC federation per tenant, complete with domain-discovery routing, JIT provisioning, and IdP-initiated or SP-initiated flows.
  • SCIM 2.0 Automated Lifecycle: Exposes compliant /Users and /Groups endpoints so Okta, Entra ID, and Ping workflows create, update, and suspend accounts automatically.
  • Hierarchical RBAC & ABAC Engine: Evaluates inherited organization roles alongside contextual attributes such as IP allowlists, MFA freshness, and workspace ownership.
  • Phishing-Resistant MFA: Natively enforces FIDO2/WebAuthn passkeys and TOTP authenticators with step-up verification before sensitive billing or key-management actions.
  • Tamper-Evident Audit Logging: Records every login, consent grant, role assignment, and failed assertion with correlation IDs ready for SIEM export.

Technical Architecture

Inbound authentication requests pass through domain-routing filters in Spring Boot that resolve tenant branding, active identity providers, and MFA mandates before initiating PKCE or SAML assertion handshakes. Upon verification, tokens mint via KMS-protected signing keys while session state updates atomically in PostgreSQL and Redis.

Flow: Client / Enterprise IdP → Spring Boot Domain Resolver → SAML 2.0 / OIDC + WebAuthn Verifier → PostgreSQL RLS Directory & Role Graph → KMS-Backed RS256/ES256 Token Mint → Redis Session Epoch & Revocation Cache → React Admin Console & Downstream APIs

Downstream microservices validate bearer JWTs locally using cached JWKS public keys for routine reads, while hitting Spring Boot's lightweight introspection or policy-evaluation API when high-sensitivity operations demand immediate revocation awareness.

Technology Stack

Category Technology detail
Core IAM Engine Java 21 and Spring Boot services handling token issuance, federation, and policy checks
Relational Store PostgreSQL persisting tenant directories, role graphs, signing keys, and audit logs
Session & Revocation Redis holding active refresh-token revocation sets, OTP rate limits, and JWKS caches
Federation Layer SAML 2.0 assertion consumers and OpenID Connect / OAuth 2.1 Authorization Code + PKCE
Directory Sync SCIM 2.0 server endpoints automating enterprise IdP user and group lifecycle updates
MFA Providers WebAuthn / FIDO2 passkey verification alongside TOTP authenticator enrollment
Admin Console React portal for tenant branding, SSO metadata exchange, and role-matrix governance
Key Management Asymmetric RS256/ES256 key-rotation scheduler backed by encrypted KMS key wrapping
Audit Pipeline Append-only PostgreSQL event ledger streaming structured auth logs to SIEMs

Engineering Trade-offs & Solutions

Engineering Challenge Solution & Trade-off
Stateless JWTs remain valid until expiry even after an employee is suspended Kept access token TTLs brief and paired refresh-token rotation with a Redis user-epoch check; trades slight Redis dependency on refresh paths for immediate cross-app cutoff.
Evaluating deeply nested org-to-workspace RBAC graphs slows every request Precomputed transitive role closures on role-change commits inside PostgreSQL and embedded compact permission scopes in session claims; shifts work to rare write paths so reads stay flat.
Supporting custom SAML IdP quirks without weakening XML security Isolated SAML parsing behind strict schema checks, XXE disabling, and per-tenant certificate pinning; increases onboarding validation strictness while closing signature-wrapping vectors.
Separate databases per enterprise tenant complicate migrations and connection pooling Chose shared PostgreSQL schemas enforced by database-level Row-Level Security policies, balancing operational simplicity with cryptographic and query-layer tenant boundaries.

Security & Cryptographic Controls

Identity infrastructure sits directly on the attack surface, so defensive defaults govern every layer. Passwords—where local fallback authentication is enabled—hash via Argon2id with tuned memory parameters, while refresh tokens store only SHA-256 digests so a database snapshot never yields usable bearer credentials.

All OAuth flows enforce PKCE (S256) and exact redirect URI matching without wildcard subdomains. Signing key pairs rotate on an automated cadence using envelope encryption wrapped by cloud KMS keys, and strict rate limiting in Redis shields login, token, and OTP endpoints against credential-stuffing bursts.

Performance & High Availability

Authentication spikes hit predictably at Monday morning shift changes and automated CI token renewals. Running Spring Boot on Java 21 virtual threads lets blocking I/O against PostgreSQL and external OIDC userinfo endpoints scale cleanly without thread-pool starvation.

Read-heavy directory lookups and JWKS metadata distributions route through PostgreSQL read replicas and Redis caches, while connection pooling via HikariCP guards primary database stability. Zero-downtime schema migrations and dual-key JWKS publishing ensure continuous availability across rolling deployments.

Operational Outcomes

Consolidating authentication, enterprise federation, and authorization policies into one dedicated Java and PostgreSQL platform strengthened both developer velocity and security posture:

  • Eliminated orphaned access: SCIM 2.0 synchronization paired with Redis session epochs ensures enterprise offboarding immediately cuts off active application sessions.
  • Faster enterprise onboarding: Self-service SAML and OIDC configuration inside the React portal replaced weeks of manual engineering tickets per customer integration.
  • Consistent authorization semantics: Product teams rely on one audited RBAC/ABAC decision engine instead of maintaining divergent permission checks across services.
  • Audit-ready compliance posture: Immutable authentication logs and enforced MFA policies streamline external SOC 2 and UK financial regulatory reviews.

01 — Questions

asked about this kind of project

How do you support instant session revocation when using stateless JWT access tokens?

Access tokens remain deliberately short-lived while refresh-token rotation and high-privilege admin actions validate against a compact Redis revocation bitmask keyed by session ID and user epoch. Whenever an admin disables an account or changes roles, bumping the user epoch immediately invalidates downstream refreshes.

How is tenant isolation enforced inside a shared PostgreSQL deployment?

Every tenant-scoped table carries an indexed tenant_id column paired with PostgreSQL Row-Level Security policies populated from the verified request context. Identity pools, custom SAML certificates, and password policies never cross tenant boundaries even if an application query omits a filter.

Why build a custom Spring Boot IAM core rather than embedding an off-the-shelf identity wrapper?

The organization required deeply nested workspace-level RBAC hierarchies, custom attribute-based conditions tied to billing tiers, and seamless per-tenant domain branding—requirements that forced brittle sync scripts and duplicate user tables around generic standalone IdPs.

How are SAML 2.0 XML signature attacks and replay vulnerabilities prevented?

The SAML assertion parser enforces strict schema validation, disables external XML entity resolution (XXE), pins trusted IdP signing certificates per tenant, validates InResponseTo and audience restrictions, and rejects replayed assertion IDs cached in Redis.

How does key rotation work without breaking active client services mid-request?

Spring Boot publishes both current and upcoming public keys under its JWKS endpoint ahead of rotation. New tokens sign with the active key ID while older keys remain in the verification set until existing token lifetimes expire.

03 — Similar project?

describe what is different about yours

Build yours.

Tell me what exists, what you need and the deadline. Fixed price for a defined scope, or $55/day (8–9 hours work) with a written plan first.

Solitaire Corporate Park, Makarba, Ahmedabad, Gujarat 380015, India · IST (UTC+5:30) · --:-- IST · Mon–Fri 09:00–18:00 IST · US & EU overlap daily

No newsletter, no CRM. Just a reply.