Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@mposolda
Copy link
Contributor

@mposolda mposolda commented Aug 17, 2023

…ute instead of configured value of Kerberos realm in User federation

closes #20045

This PR addresses issue when single LDAP/Kerberos provider allows to authenticate users from multiple kerberos realms (which are in trust among each other). It does somehow what is mentioned here #20045 (comment) . Despite the last point with the fallback between multiple LDAP storage providers, which is different issue and handled in the PR #22531 (Both are related to trust scenarios, but that one is multiple LDAP providers to single kerberos realm when this one is possibly single LDAP provider to multiple Kerberos realms).

The SPNEGOAuthenticator returns whole authenticated kerberos principal without cutting realm from it, so LDAP provider is able to lookup proper user based on the kerberos principal. The LDAP attribute where Kerberos principal is saved unfortunately differs among LDAP servers, so added configuration option Kerberos principal attribute to have some flexibility here.

The KerberosFederationProvider uses whole authenticated principal instead of just username chained with configured realm, which ensures that correct realm is used.

For backwards compatibility, when the attribute is left empty, it sticks to the previous behaviour and tries to find the LDAP user with same username as the prefix of kerberos principal without realm. This might be needed as it is possible that some LDAP servers don't support specific attribute with kerberos principal name (however looks that all LDAP servers we support have this).

@ahus1 Could you please review from the store team or delegate to someone?
@ssilvert Could you please review the UI related changes or delegate to someone from the UI team?
@andymunro Could you please review documentation changes?
@miquelsi Adding you as reviewer too as this can be needed to be tested with our LDAP pipeline though to make sure it works with all our LDAP servers. It's possible that some new things would need to be added to the properties files, which we use in LDAP pipeline. For MSAD, the property file might need:

idm.test.kerberos.principal.ldap.attribute=userPrincipalName

And for RHDS/FreeIPA maybe something like this (not 100% sure about the attribute name in RHDS, just tried FreeIPA):

idm.test.kerberos.principal.ldap.attribute=krbPrincipalName

@mposolda mposolda requested review from a team as code owners August 17, 2023 13:10
@mposolda mposolda requested a review from a team August 17, 2023 13:10
@mposolda mposolda requested a review from a team as a code owner August 17, 2023 13:10
@mposolda mposolda self-assigned this Aug 17, 2023
@cypress
Copy link

cypress bot commented Aug 17, 2023

1 flaky test on run #8715 ↗︎

0 527 48 0 Flakiness 1

Details:

Merge 5b85a0a into 7c013e8...
Project: Keycloak Admin UI Commit: f098b5c8fc ℹ️
Status: Passed Duration: 21:07 💡
Started: Aug 29, 2023 6:19 PM Ended: Aug 29, 2023 6:40 PM
Flakiness  cypress/e2e/realm_settings_general_tab_test.spec.ts • 1 flaky test • chrome

View Output Video

Test Artifacts
Realm settings general tab tests > Test all general tab switches Output Screenshots

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings.

jonkoops
jonkoops previously approved these changes Aug 21, 2023
Copy link
Contributor

@jonkoops jonkoops left a comment

Choose a reason for hiding this comment

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

Changes on the client side look good to me.

Copy link
Contributor

@sguilhen sguilhen left a comment

Choose a reason for hiding this comment

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

From a storage perspective, the changes also look good to me

@mposolda
Copy link
Contributor Author

mposolda commented Aug 29, 2023

@sguilhen @jonkoops Thanks for the review of the storage and UI!

…ute instead of configured value of Kerberos realm in User federation

closes keycloak#20045
@mposolda mposolda force-pushed the 20045-kerberos-principal-rebase branch from 73cef0e to 5b85a0a Compare August 29, 2023 17:28
Copy link
Contributor Author

@mposolda mposolda left a comment

Choose a reason for hiding this comment

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

@pedroigor I've rebased the PR and also updated per your suggestion. Could you please review again?

Copy link
Contributor

@ahus1 ahus1 left a comment

Choose a reason for hiding this comment

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

Approving as of @sguilhen's review

@jonkoops
Copy link
Contributor

Looks like this PR has enough approval to be merged. Are we still waiting on a specific reviewer?

@ahus1
Copy link
Contributor

ahus1 commented Aug 30, 2023

@jonkoops - the first comment asks for feedback from @andymunro about the docs, and from @miquelsi about testing other LDAP servers. While docs could be handled in a follow-up PR, I'm hesitant about the test around the other LDAP servers.

If the test configurations for other LDAP servers could be handled in another PR should be decided by @mposolda or @miquelsi.

@mposolda
Copy link
Contributor Author

Thanks everyone for the review!

@ahus1 I agree that documentation can be addressed in a follow-up if needed. Regarding testing, I've tested with our LDAP pipeline and created the PR to our LDAP configuration (will send the details offline).

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use an original domain name of Kerberos Principal in UserModel attribute instead of configured value of Kerberos realm in User federation

5 participants