-
Notifications
You must be signed in to change notification settings - Fork 24.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Kerberos] Add authorization realms support to Kerberos realm #32392
[Kerberos] Add authorization realms support to Kerberos realm #32392
Conversation
This commit allows Kerberos realm to delegate `User` creation to configured authorization realms. If no authorization realms are configured, then Kerberos realm uses native role mapper to resolve User.
Pinging @elastic/es-security |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't seem to add the new setting in KerberosRealmSettings
This commit adds missing authorization settings in Kerberos realm settings.
Thanks, @tvernum. I have addressed your review comment. Please review when you get some time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a couple of comments. Otherwise LGTM
if (delegatedRealms.hasDelegation()) { | ||
delegatedRealms.resolve(username, ActionListener.wrap(result -> { | ||
if (result.isAuthenticated() && userPrincipalNameToUserCache != null) { | ||
userPrincipalNameToUserCache.put(username, result.getUser()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to cache here. The delegated realm resolved the user and it should be caching it. The kerberos realm will never use the cache entry that we add
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, I too did not want to add caching here but thought it would be consistent with others. I will remove it. Thank you.
@@ -101,13 +107,20 @@ protected void assertSuccessAuthenticationResult(final User expectedUser, final | |||
is(equalTo(KerberosAuthenticationToken.NEGOTIATE_AUTH_HEADER_PREFIX + outToken))); | |||
} | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: drop this extra line
Removed the caching in case delegated realms are used for user resolution.
@elasticmachine, test this please. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM too Yogesh!
This commit allows Kerberos realm to delegate
User
resolutionto configured authorization realms. If Kerberos realm is not configured
with any authorization realms then it uses the native role mapper to
resolve User.