fix: use short name from authToLocal rules as Kerberos authenticated identity#19434
Open
JWuCines wants to merge 1 commit into
Open
fix: use short name from authToLocal rules as Kerberos authenticated identity#19434JWuCines wants to merge 1 commit into
JWuCines wants to merge 1 commit into
Conversation
FrankChen021
reviewed
May 8, 2026
Member
FrankChen021
left a comment
There was a problem hiding this comment.
I have reviewed the code for correctness, edge cases, concurrency, and integration risks; no issues found.
This is an automated review by Codex GPT-5
f356ce0 to
ab60c25
Compare
FrankChen021
reviewed
May 9, 2026
Member
FrankChen021
left a comment
There was a problem hiding this comment.
Reviewed 5 of 5 changed files for correctness, edge cases, security, and integration risks; no issues found.
This is an automated review by Codex GPT-5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The Kerberos authenticator was using
token.getName()(the full Kerberos principal, e.g.,user@EXAMPLE.COM) instead oftoken.getUserName()(the short name, e.g.,user) when constructing theAuthenticationResultidentity. This caused the authenticated identity to bypassauthToLocalname mapping rules, resulting in users being unable to authenticate when authorizer rules reference short names.Fixed the identity used in AuthenticationResult
Changed
KerberosAuthenticatorto usetoken.getUserName()instead oftoken.getName()when setting theAuthenticationResultidentity. This is consistent with:getRemoteUser()already returnstoken.getUserName()in the same filterDruidKerberosAuthenticationHandlercreates the token withnew AuthenticationToken(userName, clientPrincipal, getType())whereuserNameis the result ofKerberosName.getShortName()(i.e., theauthToLocal-mapped name)authToLocalconfiguration property, which exists to map Kerberos principals to local user names for authorizationAdded unit tests
Added
KerberosAuthenticatorFilterTest(4 tests) andDruidKerberosAuthenticationHandlerTokenTest(6 tests) to verify that:AuthenticationToken.getUserName()returns the short name andgetName()returns the full principalAuthenticationResultidentity uses the short name across simple principals, service principals, and customauthToLocalrulesUpdated documentation
Added a "User identity and
authToLocalrules" section to the Kerberos extension documentation explaining that the short name is used for authorization, with an upgrade note for users who may have authorizer rules referencing full Kerberos principals.Release note
The Kerberos authenticator now correctly uses the short name derived from
authToLocalrules as the authenticated user identity, instead of the full Kerberos principal. If you have authorizer rules that reference full Kerberos principals (e.g.,user@EXAMPLE.COM), update them to use the short name (e.g.,user) after upgrading.Key changed/added classes in this PR
KerberosAuthenticatorKerberosAuthenticatorFilterTestDruidKerberosAuthenticationHandlerTokenTestThis PR has: