Wise Hustlers — Digital Product & App Development Studio Logo
Get Consultation
By Wise Hustler Admin•11/16/2026•32 min read

Keycloak vs. Authentik in 2026: Self-Hosted Enterprise IAM Architecture & 3-Year TCO Teardown

Keycloak vs. Authentik in 2026: Self-Hosted Enterprise IAM Architecture & 3-Year TCO Teardown

# Keycloak vs Authentik: Self-Hosted Enterprise IAM Architecture & 3-Year TCO Teardown

Summary: Choose Keycloak if your organization mandates true multi-tenant realm isolation, certified FAPI profiles, and a zero-licensing-cost Apache 2.0 footprint maintained by experienced Kubernetes platform engineers. Choose Authentik if you prioritize rapid developer velocity, lightweight forward-auth outposts for microservices, and native SCIM provisioning, provided your team budgets for commercial open-core licensing ($5/user/month for workforce accounts) as internal seat counts scale.

---

Enterprise engineering teams face an expensive identity reckoning. Commercial Software-as-a-Service (SaaS) Identity and Access Management (IAM) vendors such as Auth0 (by Okta) and Ping Identity structure pricing around Monthly Active Users (MAUs), user tiers, and premium enterprise add-on modules. While entry-level self-service plans start at accessible monthly tiers, total subscription commitments escalate rapidly as organizations scale past 25,000 MAUs and mandate enterprise features—such as multi-tenant SAML federation connections, custom vanity domains, enterprise directory synchronization, and real-time audit log streaming to SIEM platforms. In enterprise architectures, these capabilities require transitioning from self-service tiers into custom quote-based enterprise contracts, where annual commitments routinely climb into high five-figure or six-figure ranges as user concurrency grows.

Consequently, engineering leaders are reprioritizing self-hosted, cloud-native identity fabrics. Two open-source platforms dominate modern evaluation cycles: Keycloak, the battle-tested runtime backed by Red Hat and re-architected on the Quarkus framework; and Authentik, the modern, flow-driven identity provider built on Python ASGI and Go outposts.

Evaluating these platforms requires looking past landing page feature checklists. Deploying self-hosted IAM at enterprise scale involves complex operational realities: distributed session replication, ingress buffer tuning, directory synchronization races, and shifting open-core monetization boundaries.

This guide delivers an architectural teardown, reproducible load-testing methodology, migration failure modes, and a 3-year Total Cost of Ownership (TCO) model comparing Keycloak, Authentik, and commercial SaaS alternatives.

---

6-Criteria Technical Comparison Matrix

The following matrix benchmarks Keycloak and Authentik across the six architectural vectors critical to enterprise production stability.

Evaluation CriterionKeycloak (v26+ Quarkus Engine)Authentik (v2024.x / 2026 Engine)Production Impact & Trade-Offs
Authentication Protocol FidelityStrict / Hardened Compliance: Full SAML 2.0 (encrypted assertions, artifact binding, eIDAS-aligned profiles), OIDC Core 1.0, OAuth 2.1, and certified FAPI 1.0/2.0 Advanced profiles.Modern / Standard: Robust OIDC/OAuth 2.0, standard SAML 2.0 Service Provider and Identity Provider flows. Omits specialized government or banking FAPI profiles.Keycloak is widely adopted in regulated banking, government, and high-assurance federation. Authentik reliably satisfies standard modern web and SaaS architectures built on standard OIDC and SAML 2.0 protocols.
Reverse Proxy & Forward-Auth ArchitectureSidecar / Gateway Adapter Model: Legacy gatekeeper proxy deprecated; relies on Envoy external auth filters, OAuth2-Proxy sidecars, or APISIX/Kong API gateway plugins.Native Go Outposts: First-class Forward-Auth and Reverse-Proxy outposts deployable as standalone Kubernetes Pods or embedded cluster services.Authentik significantly reduces developer integration time for legacy applications lacking native OIDC code-level hooks.
Multi-Tenant Realm IsolationHardware-Grade Logical Isolation: Distinct "Realms" with independent cryptographic keys, user databases, identity providers, and admin roles.Single-Namespace Group / Brand Model: Unified tenant model using Brands, Flow bindings, and RBAC policies within a shared database scope.Keycloak permits true B2B SaaS isolation (tenants cannot traverse realms). Authentik requires policy-level segregation logic.
Runtime Engine & FootprintQuarkus JVM (Java 21+): High cold-start memory (~450MB–800MB base RSS), exceptionally high sustained throughput, advanced JIT/AOT optimization.Polyglot (Python ASGI + Go + Celery + Redis): Fast cold start, modular footprint (~300MB base), but bounded by Python GIL on CPU-heavy flow evaluations.Keycloak excels at sustained high-RPS token exchanges. Authentik scales horizontally via decoupled Go outposts and Celery workers.
Directory Sync & SCIM ProvisioningLDAP/AD Federation + SCIM 2.0 (via SPIs): Deep, continuous periodic Active Directory/Kerberos sync; native SCIM requires custom or enterprise extensions.Native SCIM 2.0 Inbound/Outbound: Built-in SCIM protocols for Okta/Entra ID provisioning out of the box; flexible LDAP synchronization engine.Authentik provides faster out-of-the-box SaaS employee lifecycle automation; Keycloak requires architectural assembly for end-to-end SCIM.
Licensing Model & Enterprise Costs100% Free & Open Source (Apache 2.0): Upstream project has zero artificial paywalls. Optional commercial support via Red Hat Build of Keycloak.Open Core: Core platform is open source (GPLv3). Authentik Enterprise introduces a dual-pricing model ($5.00/user/month for internal workforce accounts, $0.02/user/month for external customer SSO accounts; billed annually) for compliance reporting, RADIUS outposts, and SLA support.Authentik introduces steep budgetary steps for large-scale employee bases. Keycloak shifts 100% of expenditure into infrastructure and platform engineering.

Operational Dimension Scorecard

Strategic MetricKeycloakAuthentikVerdict
Raw Throughput PerformanceHigh (5,000+ RPS sustained)Moderate (1,800+ RPS sustained)Keycloak dominates peak token issuance and introspection density.
Developer Velocity & Time-to-ValueModerate (Steep learning curve)High (Intuitive UI, visual flow pipelines)Authentik allows teams to secure internal tools in minutes.
Total Cost of Ownership (3-Year)Capital & SRE intensiveLicense intensive at high workforce seat countsKeycloak wins at large scale; Authentik wins for small-to-mid teams.
Vendor Lock-In VulnerabilityZero (Complete code ownership)Moderate (Open-core feature gates)Keycloak guarantees unconstrained infrastructure portability.
Horizontal ScalabilityComplex (Infinispan clustering)Straightforward (Stateless Web + Redis + Go)Authentik simplifies state management across standard cloud pods.
Day-2 Maintenance BurdenHigh (JVM tuning, cache partitions)Moderate (Multi-service Docker orchestration)Authentik requires less specialized runtime diagnostics.

---

Core Architectural Blueprints: Topology & Execution Engines

The architectural divergence between Keycloak and Authentik reflects their origins: an enterprise Java infrastructure standard re-engineered for containers versus a cloud-native Python and Go application designed for Kubernetes-native environments.

1. Keycloak on Kubernetes: Quarkus Runtime & Infinispan JGroups Cluster

Keycloak migrated from its legacy WildFly application server foundation to Quarkus, dramatically optimizing container startup times and baseline memory usage. However, its high-availability session state model relies on Infinispan, an embedded, distributed in-memory data grid.

flowchart TD
    subgraph Client_Traffic [Client Layer]
        SPA[Single Page App / Mobile]
        B2B[Enterprise SAML IdP]
    end

    subgraph Ingress_Layer [Ingress & Edge Routing]
        ALB[Ingress Controller / TLS 1.3 Termination]
    end

    subgraph Keycloak_Cluster [Keycloak Stateful Fabric on K8s]
        KC1["Keycloak Pod 1 (Quarkus JVM)"]
        KC2["Keycloak Pod 2 (Quarkus JVM)"]
        KC3["Keycloak Pod 3 (Quarkus JVM)"]
        
        ISPN1[("Infinispan Cache Engine")]
        ISPN2[("Infinispan Cache Engine")]
        ISPN3[("Infinispan Cache Engine")]
        
        KC1 <--> ISPN1
        KC2 <--> ISPN2
        KC3 <--> ISPN3
        
        ISPN1 <== "JGroups Discovery (DNS_PING / KUBE_PING)" ==> ISPN2
        ISPN2 <== "Cross-Pod Memory Replication" ==> ISPN3
        ISPN1 <== "Session State Sync" ==> ISPN3
    end

    subgraph Persistence_Layer [State & Identity Storage]
        PG[(PostgreSQL 16 HA Cluster)]
        AD[("Enterprise Active Directory / LDAP")]
    end

    SPA -->|OIDC Auth Code + PKCE| ALB
    B2B -->|SAML 2.0 POST Binding| ALB
    ALB --> KC1
    ALB --> KC2
    ALB --> KC3
    
    KC1 --> PG
    KC2 --> PG
    KC3 --> PG
    
    KC1 -.->|LDAP Federation Provider| AD
    KC2 -.->|User Storage SPI| AD

Keycloak Architectural Mechanics

  • Stateful In-Memory Grid: User sessions, client sessions, offline tokens, and login failures are cached in Infinispan memory distributed caches. Pods discover peers using JGroups over the Kubernetes API (KUBE_PING) or headless services (DNS_PING).
  • Database Schema: Keycloak writes relational identity metadata, credentials (hashed via PBKDF2 or Argon2), realm settings, and client scopes to PostgreSQL.
  • Stateless Execution vs. Stateful Memory: While the Quarkus JVM pods scale horizontally, scaling is bounded by Infinispan partition topologies. Adding or shedding pods triggers cache rebalancing across the JGroups channel.

---

2. Authentik Distributed Engine: ASGI Core, Celery Workers, & Go Outposts

Authentik uses a decoupled microservices architecture. Its control plane separates HTTP ingress handling, background asynchronous jobs, cache orchestration, and edge authentication proxies.

flowchart TD
    subgraph Edge_Traffic [External & Internal Traffic]
        User[End User Browser]
        LegacyApp[Legacy Internal Microservice]
    end

    subgraph Authentik_Control_Plane [Authentik Core Architecture]
        Ingress[Ingress Controller]
        Server["Authentik Server (Python ASGI / Gunicorn)"]
        Worker["Authentik Worker (Celery Fleet)"]
        RedisDB[("Redis 7 (Broker & Session Cache)")]
        AuthPG[(PostgreSQL 16 Primary)]
    end

    subgraph Outpost_Fleet [Edge Forward-Auth Fabric]
        OutpostGo1["Authentik Outpost 1 (Golang Proxy)"]
        OutpostGo2["Authentik Outpost 2 (Golang Proxy)"]
    end

    User -->|OIDC / SAML Flow| Ingress
    Ingress --> Server
    Server <--> RedisDB
    Server --> AuthPG
    Worker <--> RedisDB
    Worker --> AuthPG

    LegacyApp -->|Forward-Auth Check| OutpostGo1
    OutpostGo1 <-->|Internal API / mTLS| Server
    OutpostGo2 <-->|Token Validation| RedisDB

Authentik Architectural Mechanics

  • Core Server (ASGI): Handles administrative requests, flow execution pipelines (Identification, Authentication, MFA, Consent), and authentication UI rendering.
  • Celery Worker Fleet: Executes asynchronous background tasks, including external directory synchronization (LDAP, SCIM), webhook dispatching, email delivery, and audit trail aggregation.
  • Redis Layer: Serves as the message broker for Celery queues and provides transient session key caching.
  • Go Outposts: Lightweight reverse proxies and forward-auth handlers written in Go. Outposts connect back to the Authentik core server over HTTP/WebSocket or direct database connections to validate access tokens at microservice boundaries without forwarding every request through the central Python runtime.

---

Architectural Throughput Profiles & Synthetic Load Modeling

To evaluate architectural throughput limits, platform engineering teams model synthetic load profiles against both engines using open-source benchmarking frameworks such as Grafana k6. Rather than relying on vendor claims, production capacity planning evaluates how Quarkus JVM (Keycloak) and Python ASGI with Go Outposts (Authentik) handle CPU-bound cryptographic operations (JWT assertion signing, Argon2/PBKDF2 password hashing) and database session persistence under sustained concurrency.

Below is a representative architectural profiling baseline and reproducible load-testing harness based on standard Kubernetes deployment parameters (aligned with methodologies from the open-source Keycloak Benchmark repository and Authentik operational scaling guidelines).

Reproducible k6 Load Testing Harness

The following script provides a reproducible test harness for simulating concurrent OIDC Authorization Code exchanges with PKCE:

// k6-oidc-bench.js: Synthetic PKCE Authorization Code Load Test
import http from 'k6/http';
import { check, sleep } from 'k6';
import crypto from 'k6/crypto';

export const options = {
  stages: [
    { duration: '1m', target: 50 },  // Warm-up ramp
    { duration: '3m', target: 200 }, // Sustained concurrency
    { duration: '1m', target: 0 },   // Cool-down
  ],
  thresholds: {
    http_req_duration: ['p(95)<150'], // 95% of requests under 150ms
    http_req_failed: ['rate<0.01'],    // Error rate strictly below 1%
  },
};

function generatePKCE() {
  const verifier = crypto.sha256('benchmark-seed-' + Math.random(), 'hex');
  const challenge = crypto.sha256(verifier, 'base64rawurl');
  return { verifier, challenge };
}

export default function () {
  const { verifier, challenge } = generatePKCE();
  const baseUrl = __ENV.IAM_HOST || 'https://iam.internal.net';
  const clientId = 'benchmark-client';

  // Step 1: Request authorization endpoint with PKCE challenge
  const authUrl = `${baseUrl}/protocol/openid-connect/auth?` +
    `response_type=code&client_id=${clientId}` +
    `&code_challenge=${challenge}&code_challenge_method=S256` +
    `&redirect_uri=https://app.internal.net/callback&scope=openid profile email`;

  const authRes = http.get(authUrl);
  check(authRes, {
    'auth endpoint returns 200': (r) => r.status === 200,
  });

  sleep(0.1);
}

Architectural Profiling Baseline Table

The baseline below illustrates comparative performance metrics captured under an identical synthetic test profile on AWS EKS across 3 worker nodes (c6i.2xlarge: 8 vCPU, 16 GiB RAM) backed by Amazon RDS PostgreSQL 16 (db.m6i.xlarge with 3,000 provisioned IOPS gp3):

Workload ScenarioMetricKeycloak (v26 Quarkus)Authentik (v2024.x)Performance Profile Comparison
OIDC Auth Code + PKCEMax Sustained RPS1,420 RPS580 RPSKeycloak higher sustained RPS
p50 Latency18 ms42 msKeycloak lower median latency
p95 Latency48 ms118 msKeycloak lower tail latency
p99 Latency92 ms265 msKeycloak lower p99 latency
M2M Client CredentialsMax Sustained RPS5,850 RPS1,940 RPSKeycloak higher token issuance throughput
p50 Latency4 ms14 msKeycloak lower median latency
p99 Latency21 ms84 msKeycloak lower p99 latency
Token IntrospectionMax Sustained RPS8,200 RPS3,100 RPSKeycloak higher validation throughput
p99 Latency12 ms45 msKeycloak lower p99 latency
Resource ConsumptionBase Pod RSS Memory512 MiB (JVM committed)280 MiB (Server) + 210 MiB (Worker)Authentik lower idle memory footprint
Peak Load RAM / Replica2.1 GiB (G1 GC stable)850 MiB (Server) / 1.1 GiB (Worker)Authentik lower overall RAM allocation
Cold-Start Ready Time7.8 seconds3.2 secondsAuthentik faster container boot time

Note: Reference architectural profiling baseline modeled on 3x worker nodes (`c6i.2xlarge`) backed by Amazon RDS PostgreSQL 16 (`db.m6i.xlarge` with 3,000 provisioned IOPS gp3). Metrics illustrate comparative runtime performance under simulated synthetic load; real-world production throughput varies based on token signing algorithms (e.g., RS256 vs. EdDSA), user database indexing, network topology, and session cache replication policies.

SYNTHETIC LOGIN THROUGHPUT (OIDC Auth Code + PKCE Sustained RPS)
====================================================================
Keycloak (Quarkus)    [██████████████████████████████████████] 1,420 RPS
Authentik (ASGI+Go)   [███████████████                       ]   580 RPS
====================================================================

M2M TOKEN ISSUANCE (Client Credentials Sustained RPS)
====================================================================
Keycloak (Quarkus)    [██████████████████████████████████████] 5,850 RPS
Authentik (ASGI+Go)   [████████████                          ] 1,940 RPS
====================================================================

Runtime Profile Analysis: JVM HotSpot vs. Python ASGI Event Loops

The comparative profile data highlights structural engine trade-offs:

1. The Quarkus Advantage Under Heavy Cryptographic Load: Minting JWT tokens, verifying PBKDF2/Argon2 password hashes, and signing assertions require compute-heavy cryptographic primitives. Java 21's HotSpot engine utilizes vectorized CPU instructions (AVX-512) and highly optimized native crypto libraries (SunEC, OpenSSL via Quarkus native wrappers). Once warmed up, Keycloak executes token operations with minimal garbage collection overhead.

2. The Python Concurrency Bottleneck: Authentik handles flow logic via Python ASGI running under Uvicorn/Gunicorn. Despite asynchronous event loops, CPU-bound operations—such as token signing and complex policy parsing—encounter the Python Global Interpreter Lock (GIL) within individual worker processes. While Authentik offloads proxy duties to its Go outposts, any request executing an authentication flow must traverse the Python core, capping throughput per CPU core earlier than Keycloak.

---

Deep-Dive Criterion Analysis

1. Protocol Fidelity: SAML 2.0, OIDC, and OAuth 2.1

Keycloak: Regulated Compliance and Deep Federation

Keycloak was built to meet strict institutional authentication standards. Its SAML 2.0 implementation is among the most complete in the software industry, supporting:

  • Encrypted SAML assertions using AES-GCM and RSA-OAEP.
  • Signed SAML assertions and metadata exchange with automated key rollover.
  • SOAP-based artifact resolution bindings.
  • Direct alignment with high-assurance standards: OAuth 2.1, Financial-grade API (FAPI 1.0/2.0 Advanced), and mutual TLS (mTLS) client certificate-bound access tokens (RFC 8705).

If an enterprise must federate with legacy government gateways (eIDAS-compliant SAML endpoints), military smart cards (CAC/PIV via X.509 client certificate authentication), or open banking APIs, Keycloak supports these natively through configuration rather than custom code.

Authentik: Flexible Stage-Based Execution Engine

Authentik abstracts authentication into an extensible pipeline: Flows, Stages, and Policies.

  • A flow can combine an Identification Stage, followed by an Authenticator Validation Stage, evaluated against an Expression Policy written directly in Python syntax.
  • Authentik fully complies with core OIDC and OAuth 2.0 standards, including PKCE and device authorization grants.
  • Its SAML 2.0 provider functions reliably with standard service providers (such as Salesforce, Google Workspace, and AWS IAM Identity Center). However, edge-case enterprise SAML profiles—such as specific artifact resolution profiles or complex SAML attribute transformation matrices—require Python execution stage scripts rather than native toggle switches.

---

2. Reverse Proxy Integration: Forward-Auth Outposts vs. Sidecars

Securing internal microservices, dashboards (Grafana, Prometheus, ArgoCD), and legacy monoliths that lack native OIDC client libraries is a major enterprise requirement.

Authentik Forward-Auth Flow:
[User Request] ---> [Traefik / NGINX Ingress] 
                            |
                    (Forward Auth Check)
                            v
                [Authentik Go Outpost] ---> Validated (Injects X-authentik-username)
                            |
[Request Forwarded to Upstream App] <----+

Authentik Native Go Outposts

Authentik treats the reverse proxy as a first-class citizen. Its Go-based Outposts operate in two distinct modes:

1. Forward-Auth Mode: Connects to edge ingress controllers (Traefik, NGINX Ingress, Envoy, Caddy). Ingress sends an internal HTTP sub-request to the outpost (/outpost.goauthentik.io/auth/traefik). If the session cookie is valid, the outpost responds with HTTP 200 and injects identity headers (X-authentik-username, X-authentik-email, X-authentik-groups).

2. Reverse Proxy Mode: The outpost acts as the direct edge proxy, terminating TLS, enforcing MFA flows, and proxying validated traffic directly to internal containers.

Because the outposts are compiled Go binaries, container profiling typically observes a baseline memory footprint of approximately 30MB to 50MB RSS per idle or low-traffic instance—scaling with active connection concurrency and TCP buffer allocations—handling thousands of concurrent health checks and validations without routing traffic through the Python application server.

Keycloak Sidecar Ecosystem

Keycloak deprecated its internal HTTP proxy adapter ("Keycloak Gatekeeper" / Louketo) several years ago. To achieve forward-auth or reverse-proxy protection with Keycloak, platform engineers must introduce third-party components:

  • Deploying and configuring OAuth2-Proxy alongside each upstream service.
  • Implementing an Envoy external authorization filter (ext_authz) communicating with an external OIDC token validator.
  • Configuring ingress API gateways (Kong, Apache APISIX) with custom Lua plugins.

This architectural decision keeps Keycloak lean, but shifts significant operational overhead onto your Kubernetes infrastructure team.

---

3. Multi-Tenant Realm Isolation Models

Multi-tenancy requirements differ sharply between B2B SaaS platforms and internal corporate IT.

Keycloak Realm Architecture (Hard Isolation):
[Keycloak Instance]
   ├── Realm "Internal-Staff"  ---> Custom DB User Federation, SSO Session Keys, Admin Role A
   ├── Realm "Customer-Tenant-A" --> Distinct OIDC Clients, Keys, Custom Login Theme, Admin Role B
   └── Realm "Customer-Tenant-B" --> Isolated SAML IdP (Okta), Zero Cross-Realm Visibility

Authentik Brand/Flow Model (Unified Namespace):
[Authentik Instance]
   └── [Single Namespace Database]
          ├── Brand: Tenant A (CSS / Domain / Flow Binding)
          ├── Brand: Tenant B (CSS / Domain / Flow Binding)
          └── Policy Filtering Engine (RBAC rules segmenting access)

Keycloak: Hard Logical Realm Boundaries

Keycloak utilizes the concept of Realms. A realm is a completely isolated security domain:

  • Cryptographic signing keys (RS256, ES256) are unique per realm.
  • Users in Realm A cannot authenticate against applications registered in Realm B.
  • Independent external identity provider federation (e.g., Tenant A federates with Azure AD; Tenant B federates with PingFederate).
  • Realm-scoped administrators: A customer admin can be granted privileges to manage users and roles inside Realm A without viewing metadata from any other tenant.

Authentik: Logical Policy Segmentation

Authentik operates on a unified security domain model. While it supports Brands (customizing domains, logos, and default flows) and fine-grained Role-Based Access Control (RBAC):

  • Users and objects share a unified database namespace.
  • Creating tenant isolation requires careful construction of Groups, Brands, and Expression Policies.
  • If an enterprise requires multi-tenant isolation where tenant administrators manage their own SAML enterprise connections independently, Authentik's unified architecture introduces administrative leakage risks.

---

4. Directory Sync & SCIM 2.0 Provisioning

Automated user lifecycle management (Joiner, Mover, Leaver) is a standard architectural best practice to satisfy access control and rapid deprovisioning criteria under security audit frameworks such as SOC 2 Type II and ISO/IEC 27001.

  • Authentik: Includes native support for SCIM 2.0 (System for Cross-domain Identity Management) both as a client and a service provider. Enterprise directories (Entra ID, Okta) can push user updates, group changes, and deprovisioning webhooks straight into Authentik. Authentik can also push SCIM updates downstream into SaaS applications. Its background synchronization engine is driven by Celery workers, keeping heavy directory imports isolated from user login flows.
  • Keycloak: Excels at direct, read-through or periodic LDAP / Active Directory User Federation. It can sync thousands of users directly from on-premise AD domain controllers over LDAPS, mapping nested groups and Kerberos tickets smoothly. However, native SCIM 2.0 is not part of Keycloak Core. To support SCIM, teams must either purchase commercial extensions, maintain third-party open-source Keycloak SPIs (Service Provider Interfaces), or deploy an intermediary provisioning gateway.

---

5. Commercial Open-Core Licensing Considerations

Licensing strategy dictates whether an IAM platform remains an asset or becomes a budgetary liability as user bases scale.

Keycloak: 100% Apache 2.0

Keycloak is governed by the Apache 2.0 license. Every feature—multi-datacenter clustering, custom user storage SPIs, cryptographic credential storage, auditing, and multi-realm support—is included in the open-source repository. There are no enterprise feature flags, no user-count restrictions, and no hidden telemetry paywalls. Red Hat monetizes Keycloak by bundling it as the "Red Hat Build of Keycloak" within Red Hat OpenShift and RHEL subscriptions, ensuring that the upstream codebase remains enterprise-grade and unencumbered.

Authentik: Open Core Monetization Model

Authentik operates on an open-core model (documented on Authentik's official pricing page). While the core codebase is accessible under the GNU General Public License v3 (GPLv3), Authentik commercializes essential enterprise capabilities under Authentik Enterprise:

  • Workforce Accounts (Internal Users): Billed at $5.00 per user per month (billed annually at $60/user/year). This tier applies to employees, contractors, and administrators accessing the Authentik management interface and application dashboard.
  • External Accounts (Customer / B2C Users): Billed at $0.02 per user per month (billed annually at $0.24/user/year) for external customer identities who utilize SSO authentication without accessing the administrative dashboard.
  • Enterprise Plus: Custom plans starting at $20,000 annually for organizations requiring custom contracts, dedicated enterprise SLAs, and FedRAMP/FIPS compliance assistance.
  • Gated Features: The Enterprise edition gates advanced capabilities, including dedicated RADIUS outposts, Chrome Enterprise Device Trust, advanced compliance and audit reporting (such as password history enforcement and audit exports), priority SLA support, and direct enterprise directory governance (e.g., automated Entra ID and Google Workspace sync).
  • The Financial Consideration: For an internal workforce spanning 500 employees, the annual software license cost is $30,000, which compares favorably against commercial SaaS solutions like Okta. However, organizations managing thousands of internal staff members must account for ongoing per-seat licensing fees alongside their infrastructure footprint.

---

3-Year Total Cost of Ownership (TCO) Teardown

To model the economic reality of self-hosted vs. SaaS identity platforms, we examine a mid-sized enterprise scaling from 25,000 MAU to 100,000 MAU over a 3-year lifecycle.

TCO Modeling Assumptions & Methodology

To deliver an objective, falsifiable comparison, the model incorporates the following verified data points:

1. Cloud Infrastructure Costs: Modeled using the AWS Pricing Calculator (US East, N. Virginia) assuming multi-AZ high availability:

- 3x AWS EKS managed worker nodes (c6i.2xlarge: 8 vCPU, 16 GiB RAM).

- Amazon RDS PostgreSQL 16 Multi-AZ (db.m6i.xlarge with 3,000 provisioned IOPS gp3 storage and automated backups).

- Amazon ElastiCache Redis (cache.m6g.large) for Authentik broker/caching.

- AWS Network Load Balancer (NLB) and NAT Gateway egress/cross-AZ traffic.

2. FTE Labor Allocation & Compensation:

- Sourced from US Senior Site Reliability Engineer / DevOps median base compensation benchmarks ($150,000/year base benchmark per Levels.fyi and US Bureau of Labor Statistics data), applying a standard 5% annual cost-of-labor adjustment ($150,000 in Year 1, $157,500 in Year 2, $165,375 in Year 3).

- Keycloak (0.35 FTE, ~14 hours/week): Covers JVM memory profiling, Infinispan JGroups cache replication tuning, custom Java SPI maintenance, and zero-downtime PostgreSQL schema migrations.

- Authentik (0.20 FTE, ~8 hours/week): Covers Kubernetes Helm chart updates, Celery queue capacity monitoring, Redis cache oversight, and Outpost proxy lifecycle management.

- Commercial SaaS (0.10 FTE, ~4 hours/week): Covers administrative IdP routing, SAML connection provisioning, and API client secret rotations.

3. Software Licenses:

- Keycloak: $0 software licensing fees (100% open source under Apache 2.0).

- Authentik Enterprise: Modeled on a baseline of 500 internal workforce users at $5.00/user/month ($30,000/year) plus external customer SSO users at $0.02/user/month ($6,000/year at 25k MAU up to $24,000/year at 100k MAU), per Authentik's public pricing.

- Commercial SaaS IAM (Auth0 / Okta): Modeled using standard commercial IAM enterprise tiering structures. While entry-level self-service tiers offer predictable base fees, scaling beyond 25,000 MAU while adding required enterprise feature packs—such as dedicated SAML/OIDC enterprise connections, custom domain certificates, real-time event streaming, and a 99.99% availability SLA—shifts organizations into custom enterprise contracts. Modeled here as an illustrative enterprise baseline scaling from ~$28,000/year at 25,000 MAU to ~$112,000/year as MAUs reach 100,000.

3-Year Financial Model Table (Figures in USD)

Cost CategoryYear 1: 25,000 MAUYear 2: 50,000 MAUYear 3: 100,000 MAU3-Year Cumulative Total
KEYCLOAK (APACHE 2.0)
Infrastructure (AWS EKS, RDS HA, Data Transfer)$14,200$18,400$26,500$59,100
Commercial Software Licenses$0$0$0$0
Initial Setup, Architecture & Custom SPI Build$45,000$0$0$45,000
Dedicated SRE / Platform Maintenance (0.35 FTE)$52,500$55,100$57,800$165,400
Major Version Upgrades & Validation Testing$12,000$14,000$16,000$42,000
Keycloak Total$123,700$87,500$100,300$311,500
AUTHENTIK ENTERPRISE
Infrastructure (AWS EKS, RDS, ElastiCache Redis)$12,800$16,200$22,400$51,400
Enterprise Licensing Fees (Workforce + External Tier)$36,000$42,000$54,000$132,000
Initial Deployment & Outpost Ingress Wiring$25,000$0$0$25,000
Platform Maintenance & Operational Labor (0.2 FTE)$30,000$31,500$33,000$94,500
Major Version Upgrades & Maintenance$6,000$7,500$9,000$22,500
Authentik Total$109,800$97,200$118,400$325,400
SAAS IAM (AUTH0 / OKTA)
Base Platform Subscription & MAU Usage Tiers$28,000$54,000$112,000$194,000
Enterprise Federation Packs (SAML/AD Add-ons)$18,000$24,000$36,000$78,000
Initial SaaS Integration & SDK Configuration$15,000$0$0$15,000
Internal Identity Admin / SaaS Configuration (0.1 FTE)$15,000$15,750$16,500$47,250
Ingress / Egress Log Streaming Pipeline Hosting$3,600$4,800$7,200$15,600
SaaS IAM Total$79,600$98,550$171,700$349,850
3-YEAR CUMULATIVE EXPENDITURE COMPARISON (USD)
====================================================================
Keycloak (Apache 2.0)    [█████████████████████████] $311,500
Authentik Enterprise     [██████████████████████████] $325,400
SaaS IAM (Auth0/Okta)    [████████████████████████████] $349,850
====================================================================
*Note: Beyond 100,000 MAU, SaaS costs scale aggressively with enterprise
 connection packs, whereas Keycloak costs stabilize into predictable compute.

The Strategic Takeaways of the Financial Teardown

1. The SRE Labor Capitalization Factor: Keycloak incurs higher upfront costs. Writing custom Quarkus SPIs, tuning Infinispan replication parameters, and architecting zero-downtime rolling database upgrades requires experienced platform engineering time. However, once established, Keycloak's software licensing cost remains zero dollars indefinitely.

2. The Authentik Velocity Trade-off: Authentik requires significantly fewer engineering hours during Year 1 due to its intuitive user interface, built-in SCIM, and streamlined Go outpost architecture. For organizations operating primarily on external consumer accounts, the $0.02/user/month rate remains highly cost-effective, though high-density workforce environments must account for the $5/seat/month licensing baseline.

3. The SaaS Scaling Curve: Auth0 or Okta appear cheaper in Year 1 for low user counts. But as organizations cross the 50,000 MAU threshold and require enterprise B2B features, SaaS pricing compounds aggressively. By Year 3, SaaS solutions become the most expensive operational path.

---

4 Concrete Production Migration Failure Modes

Migrating between IAM architectures or operating self-hosted platforms at enterprise scale introduces subtle failure modes that standard integration tests rarely surface.

1. Infinispan Distributed Cache Split-Brain & Session Eviction (Keycloak)

The Failure Scenario

During a rolling upgrade or network partition on Kubernetes, the Infinispan cluster running inside the Keycloak Quarkus pods splits into isolated partitions. When JGroups heartbeats fail across availability zones:

  • Split-brain occurs: Pod 1 & 2 form Cluster Partition A; Pod 3 forms Cluster Partition B.
  • A user authenticates against Pod 1. Subsequent requests routed to Pod 3 by the ingress controller fail because the user session does not exist in Partition B's local cache.
  • The user is kicked back to the login screen, triggering session drops and spiking authentication queries to the underlying PostgreSQL database.
[K8s Pod 1] <--- JGroups Heartbeat Failed ---> [K8s Pod 3]
(Partition A)                                 (Partition B)
Session ID: 9f8a2                             Session ID: NOT FOUND
Result: HTTP 401 / Forced Re-Authentication Loop

Root Cause Analysis

By default, Keycloak ships with a distributed cache configuration configured for two owners (owners="2"). If Kubernetes terminates pods faster than Infinispan can migrate state, or if the jgroups-kubernetes discovery protocol encounters DNS delays, cluster consistency degrades.

Engineering Remediation

Configure explicit JGroups health checks, increase the discovery timeout, and tune the cross-pod cache configuration in your custom cache-ispn.xml:

<distributed-cache name="sessions" owners="3" mode="SYNC" remote-timeout="20000">
    <locking acquire-timeout="10000" concurrency-level="1000"/>
    <transaction mode="NON_XA" locking="PESSIMISTIC"/>
    <memory>
        <off-heap size="1073741824" eviction-type="MEMORY"/>
    </memory>
</distributed-cache>

Ensure Kubernetes sets terminationGracePeriodSeconds to at least 90 seconds, allowing Keycloak to gracefully rebalance cache partitions prior to SIGKILL.

---

2. OIDC Token Header Bloat Exceeding Ingress Buffer Limits

The Failure Scenario

An enterprise integrates Keycloak or Authentik with Active Directory. Employees belonging to 150+ corporate security groups authenticate via OIDC. Upon redirection to an upstream application, the user receives an immediate HTTP 502 Bad Gateway or HTTP 431 Request Header Fields Too Large error from the edge proxy (NGINX, Envoy, or AWS ALB).

Root Cause Analysis

The IAM provider is configured to inject the complete array of user groups and role claims directly into the ID Token and Access Token. When an enterprise user belongs to dozens or hundreds of corporate security groups and each group claim is encoded directly into the token payload, the resulting Base64-encoded JWT or serialized session cookie can expand significantly, frequently exceeding 8KB to 16KB+. Standard reverse proxies and load balancers enforce strict default request header buffer ceilings:

  • NGINX default: client_header_buffer_size 1k; large_client_header_buffers 4 8k;
  • AWS Application Load Balancer: Maximum 16KB header limit (hard ceiling).

Engineering Remediation

1. Sanitize Token Mappers: Never map raw LDAP/AD groups directly into tokens. Map only application-specific functional roles.

2. Switch to Backend Introspection: For microservices requiring extensive group lists, return a minimal token containing only the user subject (sub), and require services to fetch expanded claims out-of-band via the /userinfo or introspection endpoint.

3. Ingress Buffer Tuning: If large tokens are unavoidable, explicitly adjust ingress annotations:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: upstream-application-ingress
  annotations:
    nginx.ingress.kubernetes.io/proxy-buffer-size: "16k"
    nginx.ingress.kubernetes.io/proxy-buffers-number: "8"
    nginx.ingress.kubernetes.io/client-header-buffer-size: "16k"

---

3. SCIM Synchronization Race Conditions During Automated Deprovisioning

The Failure Scenario

An employee is terminated. An automated HR system (Workday) triggers a real-time SCIM DELETE or PATCH active=false call through Entra ID / Okta into Authentik or Keycloak. Simultaneously, the user's active laptop attempts to refresh an existing access token using a long-lived refresh token.

Due to database replica lag or asynchronous Celery worker processing queues:

  • The refresh token request hits an un-invalidated session cache before the SCIM deprovisioning event completes its relational transaction.
  • The refresh token mints a brand-new, valid 60-minute JWT.
  • The terminated employee retains unauthorized API access long after the HR system marked them as revoked.

Root Cause Analysis

Authentik processes directory sync operations asynchronously through its Celery worker queue to prevent web thread blocking. If the worker queue experiences latency, or if database read-write replicas experience replication lag (e.g., AWS Aurora replication lag > 150ms), session invalidation events execute out of sequence with token validation requests.

Engineering Remediation

Enforce transactional session revocation:

1. Ensure identity revocation endpoints bypass asynchronous worker queues and execute synchronously against the primary database.

2. In Authentik, bind an immediate session invalidation policy to the SCIM receiver:

"""Purge active sessions and token caches upon user deactivation."""
if not user.is_active:
    from authentik.core.models import AuthenticatedSession
    AuthenticatedSession.objects.filter(user=user).delete()
    from django.core.cache import cache
    cache.delete(f"user_tokens_{user.pk}")
    return True
return True

3. In Keycloak, configure short access token lifespans (5 minutes maximum) and enforce the "Revoke Refresh Token" policy on every token exchange.

---

4. Authentik Outpost mTLS Certificate Rotation Outages

The Failure Scenario

Authentik Outposts deployed as standalone Kubernetes pods suddenly drop all incoming traffic to internal tools. Logs display SSL/TLS handshake failures:

x509: certificate signed by unknown authority or remote error: tls: bad certificate.

Every internal microservice protected by the forward-auth outpost becomes inaccessible simultaneously.

Root Cause Analysis

Standalone Go Outposts communicate with the central Authentik server using mutual TLS (mTLS) to securely retrieve configuration updates and validate tokens. Authentik utilizes an internal Certificate Authority (CA) with a fixed expiration window. If automated certificate renewal hooks fail—or if the Outpost pods fail to pick up rotated certificates without a process restart—the mTLS connection drops, severing the outpost from its validation core.

Engineering Remediation

1. Decouple outpost TLS management from internal ad-hoc generation by integrating cert-manager directly with Kubernetes:

apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: authentik-outpost-tls
  namespace: authentik
spec:
  secretName: authentik-outpost-cert
  duration: 2160h # 90 days
  renewBefore: 360h # 15 days
  issuerRef:
    name: enterprise-vault-issuer
    kind: ClusterIssuer
  commonName: outpost.authentik.internal
  dnsNames:
    - outpost.authentik.internal

2. Implement automated pod restarts upon secret modification using tools like Stakater Reloader, ensuring Go outpost processes never run with stale in-memory certificates.

---

Strategic Decision Framework & Wise Hustlers Advisory

Selecting the right identity foundation requires aligning your engineering culture, compliance posture, and budget trajectory.

                    DECISION ARCHITECTURE FLOWCHART
                                   |
         Do you require regulated FAPI, strict SAML 2.0 eIDAS,
         or true multi-tenant isolated B2B customer realms?
                                  / \
                                 /   \
                              YES     NO
                              /         \
                             v           v
                     Choose KEYCLOAK     Do you need rapid forward-auth
                                         wiring for internal services and
                                         native out-of-the-box SCIM 2.0?
                                                / \
                                               /   \
                                            YES     NO
                                            /         \
                                           v           v
                                    Choose AUTHENTIK    Choose KEYCLOAK
                               (Budget for Enterprise   (For complete 
                                at >500 employee seats)  zero-license scale)

When to Standardize on Keycloak

  • You operate in regulated environments: Fintech, healthcare, banking, or defense sectors requiring FAPI, mTLS token bindings, or strict compliance standards.
  • You run multi-tenant B2B SaaS: You need customer-specific realms with distinct cryptographic signing keys, isolated admin permissions, and custom enterprise IdP connections per tenant.
  • You have Kubernetes platform engineering maturity: Your team possesses seasoned SREs who understand Java runtime parameters, GC tuning, and distributed cache partition recovery.
  • You require absolute zero license lock-in: You refuse to pay per-user software license fees regardless of how large your employee or consumer base expands.

When to Standardize on Authentik

  • Your primary driver is internal workforce SSO & developer speed: You need to secure dozens of internal web dashboards, legacy applications, and microservices rapidly using forward-auth outposts.
  • You require out-of-the-box SCIM 2.0: You want automated onboarding and offboarding connected directly to Okta, Entra ID, or Google Workspace without writing custom Java SPIs.
  • Your team is Python/Go-centric: You want an identity platform where engineers can read the source code, author custom policies in Python, and inspect clean PostgreSQL tables without navigating JVM stack traces.
  • Your user scale fits the pricing model: You are managing a workforce under 500 employees, or your organization has already approved the $5/user/month budget for Authentik Enterprise support while maintaining low-cost external customer accounts.

---

Accelerate Your IAM Transformation with Wise Hustlers

Migrating an enterprise identity plane while sustaining zero downtime is one of the most critical challenges an engineering organization can undertake. A misconfigured token cache, an unindexed database query, or an ingress buffer failure can halt access across your entire application fleet.

At Wise Hustlers, our principal systems architects specialize in mission-critical distributed systems, custom identity platform implementations, and high-performance cloud infrastructure. Whether you need an end-to-end architectural audit of your Keycloak clustering topology, a high-throughput migration off expensive SaaS vendors, or custom authentication gateway extensions, explore our Custom Software & Architecture Services to de-risk your deployment and secure your infrastructure.

---

Frequently Asked Questions (FAQ)

Can Keycloak or Authentik completely replace commercial SaaS like Okta or Auth0?

Yes. Both platforms provide the core functionality required for enterprise SSO: OIDC, SAML 2.0, Multi-Factor Authentication (TOTP, WebAuthn/FIDO2 passkeys), external social logins, and directory synchronization. The trade-off is operational ownership: commercial SaaS vendors manage uptime, multi-region replication, and infrastructure scaling behind an SLA. With Keycloak or Authentik, your platform engineering team owns database maintenance, ingress tuning, certificate rotation, and high availability.

How do Keycloak and Authentik handle database scaling under millions of identities?

Keycloak scales efficiently to millions of identities when backed by a tuned PostgreSQL instance with sufficient connection pooling (e.g., PgBouncer) and read replicas for user federation lookup. Keycloak caches hot user sessions in Infinispan memory, keeping baseline database read load predictable. Authentik similarly relies on PostgreSQL for persistent storage and Redis for active session key-value caching. For write-heavy workloads (such as bulk SCIM imports or mass password migrations), both engines require read-write connection splitting and careful indexing of user attribute tables.

Is Authentik truly open-source or is there an open-core consideration?

Authentik's core is open source under GNU General Public License v3 (GPLv3), providing complete OIDC/SAML providers, flow pipelines, and forward-auth outposts for free. However, it operates an open-core commercial model. Features essential to large corporate compliance teams—such as RADIUS outposts, enterprise governance reporting, Chrome Enterprise Device Trust, and dedicated SLA support—are gated behind Authentik Enterprise ($5/user/month for workforce accounts and $0.02/user/month for external customer accounts). If your architecture depends on these enterprise features, you must account for commercial licensing fees.

What are the engineering prerequisites for maintaining Keycloak in production?

Running Keycloak reliably at enterprise scale requires:

1. Kubernetes proficiency: Managing stateful rollouts, headless discovery services, and resource requests/limits.

2. Infinispan & JGroups diagnostics: The ability to inspect and troubleshoot distributed cache topologies, split-brain scenarios, and network partition recovery.

3. JVM observability: Experience profiling HotSpot memory usage (heap vs. off-heap allocations), tuning garbage collectors (G1GC), and diagnosing thread contention under peak load.

Teams lacking Java/JVM operational experience often find Authentik's polyglot Python and Go architecture significantly more accessible to operate.

---

Sources

Related articles