Keycloak Kerberos and SPNEGO desktop SSO

Keycloak can sign in domain-joined desktop users transparently through Kerberos and SPNEGO, but the design depends on your directory, network and FIPS requirements.

On this page

When Keycloak Kerberos and SPNEGO desktop SSO fits your estate

Kerberos and SPNEGO fit when staff sign in to domain-joined Windows desktops with Active Directory accounts and expect internal web applications behind Keycloak to open without a second password prompt. Keycloak can accept Kerberos tickets through SPNEGO negotiation, and this works alongside LDAP or Active Directory user federation, which supplies the directory accounts that the ticket identifies. In practice, the browser presents a ticket for a Keycloak service principal, Keycloak validates it against the keytab it holds, and the authenticated principal is mapped to a user in the realm. The Keycloak server administration guide documents the Kerberos and federation settings, and you should confirm the exact configuration for your Keycloak version there before designing around it.

Choose Kerberos over standard login forms only when the desktops are managed, the browsers can be configured for Windows-integrated sign-in, and the applications are used from that estate. Standard forms, with passwords, MFA or passkeys, remain the right path for contractors, personal or unmanaged devices, macOS and Linux workstations, and mobile users. Most estates end up with both: Kerberos as the silent first attempt, with the login form as the fallback when no ticket is presented. Before you commit, check with your Active Directory team that the service principal name, DNS records and time synchronization are correct, and decide which browser policy will allow the negotiation for each internal host. Those checks determine whether sign-in is transparent or fails with an unexplained prompt.

How Kerberos combines with LDAP or Active Directory federation

Active Directory Domain Services stores users, computers and other objects, replicates directory data to every domain controller in a domain, and acts as the Kerberos key distribution center for that domain. In most organizations with domain-joined Windows desktops, the password hash and the Kerberos keys for each user already live here, so Keycloak should read identities from this source rather than create a second set of credentials. Keycloak's LDAP user federation reads the directory for profile attributes and group membership, while its Kerberos provider validates the SPNEGO ticket that the browser presents. Both point at the same accounts, which is why a single user record can satisfy both paths.

  • Federation as the user source: Configure LDAP or Active Directory user federation in the realm so Keycloak imports and updates accounts from the domain rather than storing passwords itself.
  • Principal matching: The Kerberos principal in the ticket, usually the user principal name, must map to a federated username. Check the username attribute mapping before enabling SPNEGO.
  • Service principal and keytab: Create a service account for Keycloak in the domain, register the HTTP service principal for the Keycloak host name, and export a keytab for the server.
  • Entra ID is a separate source: Microsoft describes Entra ID as the cloud evolution of AD DS, and organizations synced with Microsoft Entra Connect may hold cloud copies whose credentials do not support Kerberos. Confirm which directory the desktops actually authenticate against.

Confirm with your directory team which domain controllers Keycloak will query and how the service account is scoped.

Configuration options and when each fits

This table compares the main design choices for Kerberos and SPNEGO sign-in in Keycloak, including standalone versus federated setups, keytab and principal handling, browser fallback and KDC reachability. Read each row against your directory layout and desktop estate, and treat the trade-offs as questions to settle before build starts.

DecisionOptionTrade-offWhen it fits
Kerberos authenticator roleStandalone Kerberos authenticatorValidates Kerberos tickets but does not supply user attributes or groups on its ownApps only need a confirmed username and you manage profiles elsewhere
Kerberos authenticator roleKerberos linked to LDAP or AD federationAdds directory attributes and group mappings, but adds a second component to configure and testRoles and group-based access must come from Active Directory or LDAP
Keytab handlingKeytab file on the Keycloak host with tight file permissionsSimple to deploy, but the keytab is a long-lived credential that must be rotated and protectedSingle Keycloak host with a clear owner for the keytab file
Keytab handlingKeytab managed through a secrets process with controlled distributionMore process to build, easier to audit and to rotate during key changesSeveral nodes or regulated controls require documented custody of the keytab
Service principal namingService principal matching the public Keycloak hostnameClients must reach Keycloak under the name in the principal or SPNEGO failsUsers sign in through one stable, DNS-resolvable hostname
Service principal namingMultiple names behind a load balancer or reverse proxyEach name needs its own principal and keytab entry, which increases directory administrationSeveral hostnames or a proxy chain front the same Keycloak cluster
Browser policyBrowsers allowed to negotiate SPNEGO for the Keycloak domainSilent sign-in on domain-joined desktops, but the browser allowlist must be managed by the desktop teamManaged desktop fleet where browser policy is centrally controlled
Fallback to formsUsername and password form remains available when negotiation failsUsers on unmanaged or non-domain devices can still sign in, but phishing-resistant controls must be planned separatelyMixed fleet with contractors, personal devices or Linux and macOS clients
KDC reachabilityKeycloak host can reach the KDC and domain controllers directlyTicket validation works in the normal path, but network rules and time sync become operational dependenciesKeycloak sits in a network zone that permits Kerberos and LDAP traffic to the directory
KDC reachabilityKeycloak host cannot reach the KDC directlyRequires a network change, proxying or a different design, which must be reviewed with the directory ownersRestricted segments where directory traffic is limited to approved paths

Setup sequence for Kerberos SPNEGO in Keycloak

This sequence takes a Keycloak realm from directory assessment to verified transparent sign-in, so domain-joined desktops reach applications without a password prompt while other clients still get the normal login page. Each step closes with a check you can run before moving on.

  1. Confirm directory and KDC topology

    Before touching Keycloak, the identity, network and security teams record which Active Directory domain controllers act as the Kerberos Key Distribution Center for the realm, which DNS names clients use to find them, and whether Keycloak will also federate users from LDAP or Active Directory. Confirm the time sync between Keycloak hosts, domain controllers and clients, because Kerberos rejects tickets when clocks drift. The step is done when the team has a written topology diagram and can resolve the KDC and Keycloak hostnames from a test host. Confirm the exact Kerberos realm name (usually the uppercase DNS domain) with the directory team, since it must match later configuration exactly.

  2. Create service principal and keytab

    A directory administrator creates a service principal for the HTTP name of the Keycloak hostname, such as HTTP/sso.example.internal under your Kerberos realm, and exports its key to a keytab file. The keytab should be readable only by the account that runs Keycloak and stored with the same controls as other server secrets. Protect the keytab as a credential, because anyone holding it can impersonate the service. The step is done when the keytab lists the expected principal and encryption types, and a test with the Kerberos client tools on the Keycloak host obtains a service ticket for that principal. Confirm the supported encryption types for your domain with the directory team before export.

  3. Configure the Kerberos provider in the admin console

    In the Keycloak Administration Console, a realm administrator adds a Kerberos user federation provider, sets the Kerberos realm, the server principal and the path to the keytab, and chooses whether Kerberos authentication should be enabled for browser sign-in. If you also federate LDAP or Active Directory, the Kerberos provider is linked to that existing user federation so Kerberos logins resolve to the same directory accounts. Set the mapping and update settings as your design requires. The step is done when the provider saves without error and the provider's test or status check reports a successful connection. The administration guide describes the fields in full, so confirm the current labels in your release before filling them in.

  4. Link Kerberos with directory federation

    Where users exist in Active Directory or LDAP, the realm's LDAP provider and the Kerberos provider must resolve the same user identity. Check that the username attribute, the principal-to-username mapping and any priority order between providers produce one account per person, not duplicates. A realm administrator then signs in as a test user through the realm and confirms that the account shows the expected federation link and attributes. The step is done when a test account authenticated through Kerberos and a password login map to the same Keycloak user. If principal names include a domain suffix, decide the stripping rule now and document it, because mismatched names are the most common cause of duplicate accounts.

  5. Set browser configuration for SPNEGO

    Each client browser must be allowed to send Kerberos tickets to the Keycloak hostname. For domain-joined Windows clients, the team typically adds the Keycloak URL to the Local Intranet zone and the browser's trusted authentication site list, through Group Policy or a managed profile. Confirm the browser versions your organization supports and their Negotiate settings with your desktop team, because the controls differ by browser and operating system. Keycloak's SPNEGO flow only works when the hostname in the URL matches the service principal, so avoid IP addresses and alias names that have no matching principal. The step is done when a domain-joined test machine opens the Keycloak URL and the browser sends the ticket without a prompt.

  6. Test with a domain-joined desktop

    Sign out of Keycloak completely, sign in to a domain-joined desktop with a standard domain account, and open a client application that redirects to the realm. The expected result is that the login completes without a password prompt and the application shows the correct Keycloak user. Repeat with a second domain account, a locked or disabled account and an account from a different group to confirm that access decisions follow your realm policy and that disabled accounts fail. Check the Keycloak event log for the expected login events. The step is done when each test case produces the outcome in your written test plan and the logs match.

  7. Test with a non-domain client

    Test from a machine that is not domain-joined, a browser profile without Kerberos delegation, and a client on a network segment without line of sight to the domain controllers. Confirm that the sign-in falls back to the normal Keycloak login form or to any other configured method, and that the failure does not block users who have no ticket. Also confirm that a machine with a stale or missing ticket gets a clear login page rather than an error loop. The step is done when the fallback works in every test case and the team has recorded the expected behavior for support staff. Keep this result with the rest of the test evidence, because it shows reviewers how the realm behaves when Kerberos is unavailable.

How a desktop login flows through Keycloak

The sequence starts when a domain-joined browser reaches Keycloak and receives a SPNEGO challenge. The browser asks the Kerberos KDC for a service ticket for the Keycloak host, then sends it back. Keycloak decrypts the ticket with its keytab, maps the authenticated principal to a user in the LDAP or Active Directory federation provider, and issues tokens to the relying application. If negotiation fails, Keycloak falls back to the login form. Check the keytab, the service principal name and the browser's trusted sites setting first.

Desktop SPNEGO sign-in with Kerberos validation and directory mapping in Keycloak.

Security risks to design around for Kerberos desktop SSO

Kerberos desktop SSO makes Keycloak trust tickets issued by the domain, so the security of the whole sign-in path depends on keytab handling, browser behavior and logging. The cards below cover the decisions and checks that connect those risks in a Keycloak deployment.

Keytab protection and rotation

The Keycloak service principal's keytab lets the server decrypt Kerberos service tickets, so anyone who copies it can impersonate the service. Store the keytab with restricted file permissions on the Keycloak hosts, limit who can read it, and define how it is replaced after a key rotation or staff change. Confirm the rotation steps with your Active Directory team before the first production cutover, and test that the old key stops working.

Trust boundary created by domain tickets

Once Keycloak accepts SPNEGO tokens, any principal that the domain can authenticate becomes a sign-in identity for Keycloak, so the realm's trust in the directory is only as narrow as the accounts that exist there. Review which user populations and realms the Kerberos flow applies to, and decide whether accounts from other domains or trusts should be accepted. Document this boundary so the security team can review it alongside the LDAP or Active Directory federation settings.

Keycloak docs

Browser negotiation allowlists

Browsers send Kerberos tickets only to hosts they consider trusted for negotiation, so a broad allowlist can cause a browser to send credentials to a server outside your control. Limit the allowlist to the Keycloak hostname and any approved internal sites, and set the same policy through your managed browser configuration. Test with each browser your users run, because the setting names and behavior differ between products.

TLS on all communication

Keycloak's production guide calls for TLS on all communication, and this matters more here because SPNEGO tokens and the resulting session are sent over HTTP. Terminate TLS at Keycloak or at a reverse proxy, keep the proxy path restrictions in place, and confirm that the frontend hostname used in browser negotiation matches the certificate. Check that no internal hop or redirect falls back to plain HTTP.

Production guide

Audit of Kerberos-initiated logins

A Kerberos login can look the same as a password login in an application log, so the audit trail must show which authentication path issued each session. Enable login event recording in Keycloak, confirm which login events and identity provider details your settings retain, and forward them to your log platform. Test a sample of transparent sign-ins during rollout, and confirm the retention period with your compliance team.

Why Kerberos does not work under FIPS mode

Keycloak's Kerberos feature is not available in FIPS 140-2 mode, so a regulated estate that requires FIPS cannot use Kerberos and SPNEGO for desktop sign-in. This is a hard boundary, not a configuration choice. Before you design the desktop sign-in path, confirm the current limitation in the Keycloak documentation for FIPS mode and get your assessor to agree that the limitation applies to your build, including which Keycloak version and FIPS library set you run. The restriction affects the whole Kerberos path, so it also removes the LDAP or Active Directory setup that relies on it for transparent sign-in.

The decision comes down to two options. The first keeps the deployment in FIPS mode and moves the sign-in requirement to another method. Passkeys bound to managed devices can reduce password exposure for workforce users, and OIDC or SAML brokering to the directory's federation service can keep users on the corporate identity source while Keycloak stays FIPS compliant. Plan for the extra sign-in step that these methods usually add compared with silent Kerberos, and test it with the user groups that currently rely on transparent sign-in.

The second option runs Kerberos outside a FIPS deployment, which only makes sense after a documented risk review. That review should name the systems that would no longer be FIPS-validated, the data they handle, the compensating controls, and the owner who accepts the residual risk. Ask your assessor whether a separate realm or separate Keycloak deployment for Kerberos users would contain the scope, and confirm that the directory and client configuration you plan to use is supported in that non-FIPS build before committing to it.

Limits to confirm in your environment

Several checks decide whether Kerberos and SPNEGO sign-in can be supported end to end. Some depend on product choices and dates outside Keycloak, including the Windows Server releases behind your domain controllers and whether you run the Red Hat build or upstream. Work through these before design sign-off so the sign-in path is not built on an unsupported combination.

Keycloak version and Kerberos support

The Keycloak server administration guide documents Kerberos, and the current upstream release is 26.8.1. Confirm the exact version you will run and check its Kerberos and SPNEGO settings against the documentation for that release. The project plans four minor releases a year, so the version you choose now will need to move forward. Test the negotiate flow on the target version, not only on the version used in a proof of concept, and record which upgrade steps touch the authentication flow.

Server admin guide

Red Hat build versus upstream support

The Red Hat build of Keycloak is Red Hat's supported distribution based on the upstream project, and its product page showed 26.6 as the latest version. Upstream releases can run ahead of it. Ask Red Hat which Kerberos and SPNEGO configurations its subscription covers, how long each build line is supported, and whether the packaged version includes the features you need. With upstream, your team owns patching, testing and vendor escalation, so budget for that work in the quote.

Red Hat build page

Windows Server 2022 support dates

Windows Server 2022 mainstream support ended on October 14, 2026, and extended support ends on October 15, 2031, according to Microsoft's lifecycle page. If your domain controllers or Kerberos-facing services run on this release, the Keycloak go-live will fall under extended support rather than mainstream support. Record that date against your planned rollout, confirm that your patching and change windows can keep up, and decide whether a domain controller upgrade belongs in the same program of work.

Windows Server 2022 lifecycle

Windows Server 2025 lifecycle timelines

Windows Server 2025 became available on November 1, 2024, with mainstream support ending November 14, 2029 and extended support ending November 15, 2034. These dates give a planning horizon for the domain controllers that Keycloak will depend on. Check whether the domain functional level, Kerberos encryption settings and the operating system under Keycloak will stay supported for the same period, since each component may follow a different retirement schedule. Write those dates into the design record.

Windows Server 2025 lifecycle

Client browser configuration

Transparent sign-in works only when each browser sends a Kerberos ticket to Keycloak without prompting the user. Browsers typically need the Keycloak hostname in a trusted intranet or allowlist for Negotiate authentication, and a mismatched hostname or a proxy that alters the Host header can break the handshake. Confirm which browsers and versions your fleet uses, how group policy sets their trust zones, and what users see when they are off the corporate network. Test each browser against the exact public hostname that Keycloak will serve.

Linux and macOS desktop support

Microsoft's comparison notes that Linux machines need third-party tools or a Kerberos realm configuration to authenticate against Active Directory. If some desktops are not domain-joined Windows machines, decide early whether they are in scope. The options include a direct Kerberos realm setup or a cross-forest trust such as the one FreeIPA documents for Active Directory. Excluding them means keeping password or MFA sign-in for those users. Each option carries its own testing and support work, so confirm the supported operating systems in writing before build starts.

FreeIPA trust guide

Questions buyers ask about Kerberos SSO in Keycloak

What drives the cost of Kerberos SSO in Keycloak?

The cost is driven mostly by the number of directory domains, forests and domain controllers involved, the number of browsers and desktop builds to configure, and how many applications must accept the sign-in. Keycloak itself is open source under Apache 2.0, so the spend is labor for planning, configuration and testing, plus any infrastructure you add for the Keycloak servers and databases. If your domain controllers need new or expanded licenses, Windows Server 2025 is licensed per core with a minimum of 16 cores per server and 8 per processor, and Standard and Datacenter editions both need a Client Access License for every user or device that accesses the server, according to Microsoft's Windows Server pricing page. Ask any quote to separate one-time work from recurring support and to list which licensing items it assumes you already own.

How long does a typical scoped Kerberos rollout take?

Duration depends mostly on how many domains and forests sit behind the sign-in, how many browser and desktop configurations must be covered, and how much of the directory design is already documented. A single domain with a standard browser set is a much smaller job than several forests with trusts, mixed Windows and Linux desktops, and browsers that need per-machine policy. Ask for the timeline to be tied to the written scope, with the directory review, service account setup, browser testing and rollback steps listed as separate milestones. The timeline should also name which of these depend on your directory and desktop teams, because their change windows often set the pace.

What does the work need from our directory and desktop teams?

Kerberos SSO depends on the directory team and the desktop team more than on the Keycloak team. The directory team must confirm the Active Directory or LDAP structure, provide a service account with the right permissions, create a Kerberos service principal and keytab for the Keycloak host, and confirm time synchronization and DNS names are correct. The desktop team must confirm which machines are domain-joined, which browsers are in use, and how browser trust settings are delivered, usually through Group Policy on Windows. Keycloak's configuration should be coordinated with both teams before any test begins, so that changes to domain controllers and client machines are approved and recorded.

Can our internal team set up Kerberos SSO in Keycloak alone?

An internal team with Active Directory, Keycloak and browser administration experience can often do it alone, provided it has time for testing and a clear rollback. The hard parts are rarely the Keycloak settings themselves. They are the keytab and principal setup, browser trust across many desktop builds, and fallback behavior when a machine is off the domain or a user reaches Keycloak from outside the network. Teams without recent Kerberos experience usually benefit from an outside review of the design before changes reach production. DeployOpen plans, implements, integrates and documents self-hosted platforms in your own infrastructure, so a fixed-scope engagement can cover the build while your team keeps ownership of the directory.

Does FIPS mode change whether Kerberos SSO works?

Yes, and this decision should be settled before any build starts. Keycloak's Kerberos feature does not work when Keycloak runs in FIPS 140-2 mode, so an organization that needs FIPS mode for its Keycloak servers cannot use Kerberos and SPNEGO sign-in on those same servers. Teams with both requirements usually need a separate design, such as a non-FIPS Keycloak instance dedicated to desktop sign-in, or a different sign-in path. Confirm the current Kerberos and FIPS limits in the Keycloak documentation for your release before you commit to a design, and ask your compliance team which controls the FIPS decision must satisfy.

What goes wrong most often with Kerberos SSO?

Most failures trace to a small set of causes: incorrect DNS or service principal names, keytab files that do not match the account's current key version, clock drift between machines, and browsers that do not send Kerberos tokens because they do not trust the Keycloak hostname. Mixed environments add risk when Linux machines or users outside the domain expect the same behavior. Build a test matrix that covers each browser and desktop build, a user who is off the domain, and an account that has changed its password, and record which fallback sign-in path each case uses. Confirm these checks with your directory team before go-live.

Does Kerberos SSO need a federation layer like AD FS or Entra Connect?

Not necessarily. Keycloak can federate directly with LDAP and Active Directory and use Kerberos for transparent desktop sign-in, which covers on-premises applications that Keycloak protects. Microsoft's comparison notes that Active Directory needs a federation system such as AD FS for SaaS apps, and that organizations already using Microsoft Entra Connect sync identities to Microsoft Entra ID. Decide whether Entra ID or another upstream identity provider is part of the design, because that choice changes which sign-in paths you test and which accounts must be kept in sync.

How DeployOpen scopes Kerberos SPNEGO work

Kerberos and SPNEGO work is scoped as a fixed engagement agreed in writing before any configuration starts. The written scope should name the Keycloak realm or realms that will accept Kerberos sign-in, the directory those users come from (Active Directory or another LDAP source), the browsers and operating systems in use, the Kerberos service principal and keytab handling, and the fallback path for machines that are not domain-joined. Each of these decides what gets built and tested, so each should appear in the quote before the work begins. Ask for the scope to state which components are configured in Keycloak and which belong to the directory team, because the keytab, service account and SPN changes usually sit with the people who run Active Directory.

DeployOpen configures the Keycloak side inside your own infrastructure, on the servers, cloud accounts or data center networks you already operate. That covers the Kerberos and LDAP or Active Directory federation settings, the authentication flow that negotiates SPNEGO, the browser configuration guidance for domain-joined desktops, and the reverse proxy and hostname settings that Kerberos depends on. Testing covers domain-joined clients that should sign in without a prompt and non-domain clients that should fall back to the normal login form, with both paths checked against the same realm. Ask how the test matrix is defined, which browsers and client builds are included, and whether a retest is part of the fixed price.

Every engagement ends with documentation handed over to your team, covering the configuration as built, the keytab rotation steps, the browser policy settings and a short runbook for the failure cases that generate support tickets. Ongoing support, upgrades and retesting after Keycloak or directory changes are available as a retainer, which you can add once the initial scope closes. Before you request a quote, confirm your Keycloak version against the current release on the Keycloak website and confirm with your security team whether the deployment must run in FIPS mode, because Kerberos does not work under FIPS mode and that decision changes the whole scope.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.