Skip to content

Bind origin Kerberos/SPNEGO token to the origin service, not the proxy - #2245

Merged
hyperxpro merged 1 commit into
mainfrom
kerberos-origin-spn
Jul 18, 2026
Merged

Bind origin Kerberos/SPNEGO token to the origin service, not the proxy#2245
hyperxpro merged 1 commit into
mainfrom
kerberos-origin-spn

Conversation

@hyperxpro

Copy link
Copy Markdown
Member

Motivation

When a proxy is configured, perConnectionAuthorizationHeader incorrectly builds the origin Kerberos/SPNEGO token using the proxy host instead of the origin host. This generates a service ticket for the proxy's SPN, causing origin authentication to fail and misdirecting the credential.

Modification

Always build the origin token using the origin host (request.getVirtualHost() when set, otherwise request.getUri().getHost()). Proxy authentication remains unchanged and continues to use perConnectionProxyAuthorizationHeader.

Result

Origin Kerberos/SPNEGO authentication now targets the correct SPN even when requests are sent through a proxy. Proxy authentication and direct (non-proxy) behavior remain unchanged.

perConnectionAuthorizationHeader built the origin realm's Negotiate token
against proxyServer.getHost() whenever a proxy was configured, producing a
service ticket for the proxy's SPN. That is a confused deputy: the origin
credential is delivered to, and only usable by, the proxy, while origin
authentication fails. Always target the origin host (virtualHost or the
request host); the proxy realm keeps its own per-connection path.
@hyperxpro
hyperxpro merged commit 3ab4c92 into mainJul 18, 2026
29 of 30 checks passed
@hyperxpro
hyperxpro deleted the kerberos-origin-spn branch July 18, 2026 08:50
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@hyperxpro