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
/Usersand/Groupsendpoints 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.