Skip to content

Authelia vs authentik vs Keycloak: which SSO to self-host

Authelia, authentik and Keycloak differ on OIDC versus forward auth, SAML, who owns the user directory and memory use. Compare them and test all three.

Pick Authelia when your apps have no OIDC client of their own and a reverse proxy already fronts everything — it is one Go binary doing forward auth. Pick authentik when you need SAML, an LDAP server, RADIUS or SCIM, or when people must self-register — it has the widest protocol surface of the three and is the only one that does forward auth and native OIDC equally well. Pick Keycloak when Active Directory is the source of truth, you need a realm per tenant, or you need authorization decisions finer than “is logged in”. Everything below is the evidence behind those three sentences, including the commands to test-drive all three yourself.

What you’ll accomplish

  • Sort every app into forward auth or native OIDC — the fork that decides the product far more often than the feature matrix does.
  • Read a side-by-side on protocols, directory ownership, MFA, footprint, admin UX and upgrade burden, without vendor framing.
  • Stand up a throwaway instance of each and reach its login page, so the decision rests on something you have seen.
  • Prove the provider you picked genuinely works — discovery document, a real token, reachable signing keys, a forward-auth probe.
  • Know the failure modes that show up in the first month, and the one that shows up at the worst possible moment.

Prerequisites

  • Versions used here. Keycloak 26.7.x (26.7.2, August 2026), Authelia 4.39.x (4.39.20, May 2026), authentik 2026.8 — authentik uses calendar versioning, so a “2026.8” tag is a release line, not a patch.
  • Docker, curl and jq, plus a host with roughly 4 GB free if you intend to run all three side by side.
  • A parent domain you control, with the protected apps on subdomains of it — gitea.example.com, auth.example.com. Session-cookie SSO is scoped to a shared parent, and a split domain layout is far harder to retrofit than to plan.
  • A reverse proxy you already run. Authelia documents integrations for Caddy, Envoy, HAProxy, NGINX, SWAG, NGINX Proxy Manager, Skipper and Traefik. If none of these fronts your apps, Authelia is a bigger project than it looks.
  • One thing to know before you start. Authelia’s OpenID Connect 1.0 provider is still an open beta — OpenID Certified for several conformance profiles and in production use, but without stability guarantees, and still shipping deliberate breaking changes. Authelia has no SAML provider at all; SAML 2.0 sits in the planning section of its roadmap, not in a release.

How it works

Two entirely different mechanisms put a user behind a login in front of a self-hosted app, and each product implements at least one. Which one your estate needs decides this comparison more often than any feature does.

In forward auth, the reverse proxy intercepts the request and makes an internal subrequest to the identity provider before it proxies anything upstream. A 200 means let it through; a 401 means redirect the browser to the login portal. On success the identity provider returns headers — Authelia’s set is Remote-User, Remote-Groups, Remote-Email and Remote-Name — which the proxy copies onto the upstream request. The app is never modified and never learns SSO exists. That is Authelia’s default mode, and what authentik’s Proxy provider outposts do.

In native OIDC, the application itself is an OpenID Connect client. It redirects the browser to the identity provider, receives an authorization code back, exchanges it for tokens on a back channel, and validates the ID token against the provider’s JWKS. No proxy configuration is involved. Gitea, Grafana, Nextcloud and most modern software can do this.

Two stacked sequence diagrams comparing forward auth and native OIDC. In the forward auth panel the browser requests the app, the reverse proxy makes a subrequest to Authelia at the authz endpoint, receives a 200 with Remote-User and Remote-Groups headers, then forwards the original request to an unchanged application. In the native OIDC panel the browser requests the app, the app returns a 302 to the identity provider authorization endpoint, the user logs in with MFA, the provider redirects back with a code, and the app exchanges it for tokens verified against JWKS.

Forward auth is proxy config you write once per app, but the app gets a username in a header and nothing else — no scopes, no groups claim, no logout it can initiate. Native OIDC is per-app client registration, but the app gets identity it can act on. Authelia was built for forward auth first, with OIDC as the beta bolt-on; authentik does both natively; Keycloak has no forward-auth mode at all, so fronting an app that cannot speak OIDC means adding something like Traefik with oauth2-proxy in between — a third moving part to run and upgrade.

Authelia vs authentik vs Keycloak, side by side

Every row is a place where the three genuinely differ. Rows near the top change the answer; rows near the bottom only change what it costs you.

Authelia 4.39authentik 2026.8Keycloak 26.7
OIDC / OAuth2Open beta; OpenID Certified for several profiles, no stability guaranteeGenerally availableGenerally available
SAML 2.0None — planning section of the roadmapProvider and sourceProvider, plus brokering
LDAPConsumes a directory you run, as first factorConsumes one and serves one, via an LDAP outpostFederates AD and LDAP as source of truth
Forward authNative, and the primary designProxy provider outpostsNone; needs oauth2-proxy or similar in front
Other protocols—RADIUS, SCIM, WS-Fed, RAC; outbound provisioning to Entra ID and Google WorkspaceIdentity brokering, token exchange
User directoryDoes not own it: YAML file or your LDAPOwns it: PostgreSQL store, federation optionalOwns it: own database, federation optional
Self-registrationNo — there is nowhere to put a new userYes, with designated enrolment and recovery flowsYes, per realm
MFATOTP, WebAuthn, Duo pushTOTP, WebAuthn, static recovery codes, SMS, DuoTOTP/HOTP, WebAuthn including passwordless, recovery codes
Documented footprintUnder 30 MB idle, but argon2id reserves 64 MiB per login by default, up to 2 GiB on the recommended profile2 CPU cores and 2 GB RAM, across four containers~1250 MB base per pod at 10,000 cached sessions; ~70% of the container limit goes to heap
Admin UXNo admin UI at all: YAML on disk, authelia config validate as the safety netWeb admin with a visual flow designer; YAML blueprintsAdmin console, Admin REST API, kcadm.sh
Upgrade burdenSwap the binary; breaking config changes are flagged, and the OIDC beta ships deliberate onesMonthly CalVer trains; migrations run in the worker at startMajor versions carry DB migrations and a kc.sh build step
SuitsProxy-fronted estates with an existing directory, no SAMLMixed estates needing both auth models plus self-serviceAD-backed or multi-tenant orgs with ops capacity

Pick Authelia if…

  • Most of your apps have no OIDC client and already sit behind NGINX, Traefik, Caddy or HAProxy.
  • Your users already exist in an LDAP directory you run, or a YAML file is honestly enough.
  • You want the whole identity configuration in version control, reviewable as a diff.
  • Nobody self-registers, and you are confident you will never need SAML.

Pick authentik if…

  • You need SAML, an LDAP server, RADIUS or SCIM, but Active Directory is not your source of truth.
  • Your estate is mixed — some apps speak OIDC, some need forward auth — and you would rather run one product.
  • People must self-register, recover their own passwords, or be invited through a flow you designed.
  • You want a web console somebody other than you can operate on a bad day.

Pick Keycloak if…

  • Active Directory or LDAP is authoritative and federation is not negotiable.
  • You need tenant isolation at the realm level, or brokering to external identity providers.
  • You need authorization finer than “is logged in” — resources, scopes and policies.
  • You have room for a JVM, a real database, and major upgrades carrying schema migrations.

Decision tree for choosing a self-hosted identity provider. The first question asks whether you need SAML 2.0, an LDAP server, RADIUS or SCIM. Answering yes leads to a question about AD/LDAP federation, realm-per-tenant and fine-grained authorization, which routes to Keycloak or to authentik. Answering no leads to a question about self-registration and whether the identity provider owns the user directory, routing to authentik or to Authelia. A footprint panel underneath lists documented memory figures for all three.

Step-by-step

Work the questions in order, then test-drive what survives.

  1. Inventory what your apps actually speak. Not what the marketing page says — what the auth section of the docs says. Sort every app into “has an OIDC client”, “has SAML”, “has LDAP bind”, “has nothing but its own login form”.

    printf '%-24s %s\n' APP PROTOCOL
    printf '%-24s %s\n' gitea oidc
    printf '%-24s %s\n' grafana oidc
    printf '%-24s %s\n' proxmox 'ldap or oidc'
    printf '%-24s %s\n' 'internal-admin-panel' none

    If “none” is most of the list, forward auth does the real work and the OIDC surface is secondary. If it is empty, Authelia’s main advantage does not apply to you.

  2. Answer the deciding questions, in order. Protocols first: needing SAML 2.0, an LDAP server, RADIUS or SCIM eliminates Authelia outright. If that was yes, ask the enterprise-IdP question — AD or LDAP federation as source of truth, a realm per tenant, or authorization beyond “is logged in” — which is what justifies Keycloak’s weight over authentik. If protocols was no, ask instead who owns the directory: authentik has enrolment, recovery and unenrolment flows, while Authelia has self-service password reset but nowhere to put a new user. The decision tree above is the same logic in one picture.

  3. Sanity-check the memory budget last. It is the question people ask first and almost never the one that decides. Compare the footprint row in the table above against what the host actually has free.

    free -h

    The available column is the number that matters. Idle footprint is not the constraint — password hashing and cached sessions are.

  4. Test-drive Keycloak. It is the fastest of the three to get onto a login page.

    docker run --rm -p 127.0.0.1:8080:8080 \
      -e KC_BOOTSTRAP_ADMIN_USERNAME=admin \
      -e KC_BOOTSTRAP_ADMIN_PASSWORD=admin \
      quay.io/keycloak/keycloak:26.7.2 start-dev

    Success looks like a startup line reporting the server is running in development mode, and an admin console at http://localhost:8080/admin. Production build steps: Deploy Keycloak for self-hosted IAM.

  5. Test-drive authentik. It wants a compose file and two generated secrets.

    wget https://docs.goauthentik.io/compose.yml
    echo "PG_PASS=$(openssl rand -base64 36 | tr -d '\n')" >> .env
    echo "AUTHENTIK_SECRET_KEY=$(openssl rand -base64 60 | tr -d '\n')" >> .env
    docker compose pull && docker compose up -d

    Success is four containers healthy — server, worker, PostgreSQL and the cache — and an initial setup page on port 9000 where you set the password for the built-in akadmin user. Full walkthrough: Deploy authentik for self-hosted SSO.

  6. Test-drive Authelia. Authelia will not start without a configuration file, so the useful first command is the validator rather than the server.

    docker run --rm -v "$PWD/configuration.yml:/config/configuration.yml" \
      docker.io/authelia/authelia:latest \
      authelia config validate --config /config/configuration.yml

    Success is the validator exiting quietly. Every complaint it prints is a line you would otherwise debug from a crash loop — which is why this comes before docker compose up.

Validate it works

These four checks separate “the container is running” from “the identity provider works”.

Fetch the discovery document. Every OIDC provider publishes one, at a different path per product: Keycloak scopes it to a realm, authentik to an application slug, Authelia serves it from its own issuer root.

curl -s http://localhost:8080/realms/master/.well-known/openid-configuration | jq '.issuer, .jwks_uri'
curl -s https://authentik.example.com/application/o/grafana/.well-known/openid-configuration | jq '.issuer, .token_endpoint'
curl -s https://auth.example.com/.well-known/openid-configuration | jq '.issuer, .code_challenge_methods_supported'

The issuer must match, character for character, what the client app has configured. A trailing slash, http against https, or an internal hostname where the browser sees an external one all produce the same symptom: the app rejects an otherwise valid token.

Get a real token, not a login page. On a throwaway Keycloak this is one call.

TOKEN=$(curl -s -X POST \
  -d 'client_id=admin-cli' -d 'username=admin' -d 'password=admin' \
  -d 'grant_type=password' \
  http://localhost:8080/realms/master/protocol/openid-connect/token | jq -r '.access_token')
echo "$TOKEN" | cut -d. -f2 | tr '_-' '/+' | base64 -d 2>/dev/null | jq '.iss, .exp, .preferred_username'

You should see the issuer, an expiry and the username. base64 may print a padding warning; the JSON still prints. If .access_token came back null, read the whole response body — the error is in it.

Confirm the signing keys are reachable.

curl -s http://localhost:8080/realms/master/protocol/openid-connect/certs | jq '.keys[].kid'

Expect one or more key IDs. If this is unreachable from the application’s own network namespace — not just your laptop — every OIDC login fails with a signature error that says nothing about networking.

Probe the forward-auth endpoint. Authelia’s authorization endpoints live under /api/authz/: the NGINX integration uses /api/authz/auth-request, the Traefik one /api/authz/forward-auth. An unauthenticated probe should be refused.

curl -s -o /dev/null -w '%{http_code}\n' \
  -H 'X-Forwarded-Proto: https' \
  -H 'X-Forwarded-Host: gitea.example.com' \
  -H 'X-Forwarded-Uri: /' \
  https://auth.example.com/api/authz/auth-request

Expect 401. A 200 here without a session cookie means the endpoint answers yes to everyone — worse than being down. Repeat with -b and a valid session cookie for a 200; add -D - to see the Remote-User and Remote-Groups headers the proxy copies upstream.

Troubleshooting

  • Authelia gets OOM-killed during login, then works fine when idle. The under-30 MB figure is true of the idle process. Password verification is Argon2id and allocates the configured amount per hash: the file backend defaults to memory: 65536 (64 MiB), the password reference recommends m=2097152 (2 GiB) for its “recommended” profile, and the Kubernetes page says to budget 1 GB. Size the container against authentication_backend.file.password.argon2.memory, not the idle figure — and parallelism: 4 means concurrent logins stack.

  • Forward-auth headers are trusted from anywhere. If the upstream accepts Remote-User from any source, anything reaching the container directly — a published port, another container on the same Docker network, a docker exec — can set it and become an administrator. The proxy must strip inbound copies of every identity header before adding its own, and the upstream must be reachable only through the proxy. This is the most common way a correctly configured SSO setup turns out to be no SSO at all.

  • Redirect loop between the app and the login portal. Almost always the session cookie domain. Authelia requires domain under session.cookies to be a valid suffix of, or exact match for, the hostname in authelia_url — so auth.example.com and example.com both work for a portal at https://auth.example.com, but a cookie scoped to example.com is never sent to app.example.net. Fix the domain layout; no header works around it.

  • Keycloak was fine in the lab and lost every realm on restart. start-dev runs on the dev-file database, which Keycloak’s documentation says is unsuitable for production. Move to PostgreSQL, MariaDB, MySQL, SQL Server or Oracle — and back it up, because losing that database locks you out of everything downstream at once.

  • authentik’s discovery URL returns 404. The OIDC discovery path includes the application slug, not the provider name: /application/o/<app-slug>/.well-known/openid-configuration. Several slugs are reserved because they collide with global endpoints — authorize, token, device, userinfo, introspect and revoke — so an application slug of token produces a confusing 404 rather than a validation error.

When this is the wrong approach

Self-hosting the identity provider means you own the availability of every login in the estate. If it is down, nothing works, and the blast radius of a bad upgrade is the whole company. That is a reasonable trade when the requirement is that the user directory not sit in third-party SaaS. It is a poor trade when the honest driver is a subscription line item — a hosted provider with an SLA costs less than the on-call rotation you are about to create.

Two narrower boundaries. If the estate is a handful of internal tools behind a VPN and nobody outside the team authenticates, mutual TLS or a proxy-level basic-auth gate solves the real problem with far fewer moving parts. And if you need outbound SCIM into B2B SaaS, or SAML for a partner integration, Authelia is not a candidate however attractive its footprint — pick authentik or Keycloak at the start rather than migrating a live user directory six months in.

Official documentation: Authelia — OpenID Connect 1.0 Provider roadmap and Keycloak — concepts for memory and CPU sizing.

If this is the kind of work you’d rather never own again, it’s the daily job of Managed Cloud Ops — book an infrastructure review.