Skip to content

feat: Add Kerberos support#4640

Open
Jabejixo wants to merge 3 commits intodexidp:masterfrom
Jabejixo:add-kerberos-supportt
Open

feat: Add Kerberos support#4640
Jabejixo wants to merge 3 commits intodexidp:masterfrom
Jabejixo:add-kerberos-supportt

Conversation

@Jabejixo
Copy link
Copy Markdown
Contributor

Overview

Add Kerberos/SPNEGO Single Sign-On support for the LDAP connector, enabling seamless authentication for users in Active Directory/Kerberos environments without requiring password entry.

What this PR does / why we need it

This PR adds optional Kerberos (SPNEGO) authentication to the LDAP connector. When enabled, Dex can authenticate users via the Authorization: Negotiate header on the password login endpoint, completing the OIDC flow without rendering the password form.

Why we need it:

  • Enterprise environments with Active Directory heavily rely on Kerberos for SSO
  • Users on domain-joined machines can authenticate transparently without entering credentials
  • Reduces friction and improves security by leveraging existing Kerberos infrastructure

Key features:

  • Validates SPNEGO tokens using a service keytab
  • Maps Kerberos principals to LDAP usernames (localpart, sAMAccountName, or userPrincipalName)
  • Optional realm validation
  • Configurable fallback to password form when SPNEGO fails
  • Full compatibility with existing LDAP connector functionality

Configuration example:

connectors:
- type: ldap
  id: corp-ldap
  config:
    # ... existing LDAP config ...
    kerberos:
      enabled: true
      keytabPath: /etc/dex/krb5.keytab
      expectedRealm: EXAMPLE.COM
      usernameFromPrincipal: localpart
      fallbackToPassword: false

Special notes for your reviewer

  • The SPNEGOAware interface in connector/spnego.go is designed to be generic, allowing other connectors to implement SPNEGO in the future if needed
  • All Kerberos-specific code is isolated in connector/ldap/kerberos.go for maintainability
  • Comprehensive test coverage included with mock validators

@nabokihms nabokihms added the release-note/new-feature Release note: Exciting New Features label Mar 13, 2026
@nabokihms nabokihms self-requested a review March 13, 2026 12:50
Copy link
Copy Markdown
Member

@nabokihms nabokihms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, looks good. Some minor suggestions. And there are also conflicts.

Comment thread connector/ldap/kerberos.go Outdated
Comment thread connector/ldap/kerberos.go Outdated
Comment thread connector/ldap/kerberos.go Outdated
Comment thread connector/ldap/kerberos.go
Comment thread connector/ldap/kerberos.go Outdated
@nabokihms nabokihms requested a review from sagikazarmark March 17, 2026 12:28
Signed-off-by: Ivan Zvyagintsev <ivan.zvyagintsev@flant.com>
Signed-off-by: Ivan Zvyagintsev <ivan.zvyagintsev@flant.com>
Signed-off-by: Ivan Zvyagintsev <ivan.zvyagintsev@flant.com>
@Jabejixo Jabejixo force-pushed the add-kerberos-supportt branch from d5ff7e9 to d53acc6 Compare March 17, 2026 13:36
@Jabejixo Jabejixo requested a review from nabokihms March 17, 2026 13:42
@nabokihms
Copy link
Copy Markdown
Member

All good from my side here. @sagikazarmark do you have any objections to merging this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note/new-feature Release note: Exciting New Features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants