-
Notifications
You must be signed in to change notification settings - Fork 7.9k
map default proper given name attribute #35943
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
base: main
Are you sure you want to change the base?
Conversation
|
Your suggested change changes the LDAP mapper The |
|
Yes, thanks for the hint. |
1005245 to
f434112
Compare
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.
Unreported flaky test detected, please review
Unreported flaky test detectedIf the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR. org.keycloak.testsuite.actions.RequiredActionPriorityTest#executeRequiredActionWithCustomPriorityAppliesSamePriorityToSessionAndUserActionsorg.keycloak.testsuite.actions.RequiredActionPriorityTest#executeRequiredActionsWithDefaultPriorityorg.keycloak.testsuite.actions.RequiredActionPriorityTest#setupTotpAfterUpdatePassword |
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.
Unreported flaky test detected, please review
Unreported flaky test detectedIf the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR. org.keycloak.testsuite.actions.RequiredActionPriorityTest#executeRequiredActionWithCustomPriorityAppliesSamePriorityToSessionAndUserActionsorg.keycloak.testsuite.actions.RequiredActionPriorityTest#executeRequiredActionsWithDefaultPriorityorg.keycloak.testsuite.actions.RequiredActionPriorityTest#setupTotpAfterUpdatePasswordorg.keycloak.testsuite.organization.admin.OrganizationInvitationLinkTest#testInviteNewUserRegistrationCustomRegistrationFloworg.keycloak.testsuite.federation.ldap.noimport.LDAPProvidersIntegrationNoImportTest#testFullNameMapperWriteOnlyorg.keycloak.testsuite.federation.ldap.noimport.LDAPProvidersIntegrationNoImportTest#testImpossibleToChangeNonLDAPMappedAttributesorg.keycloak.testsuite.federation.ldap.noimport.LDAPProvidersIntegrationNoImportTest#testSearchorg.keycloak.testsuite.federation.ldap.noimport.LDAPProvidersIntegrationNoImportTest#testSearchWithCustomLDAPFilterorg.keycloak.testsuite.federation.ldap.noimport.LDAPProvidersIntegrationNoImportTest#caseInSensitiveImportorg.keycloak.testsuite.federation.ldap.noimport.LDAPProvidersIntegrationNoImportTest#caseInsensitiveSearchorg.keycloak.testsuite.federation.ldap.noimport.LDAPProvidersIntegrationNoImportTest#deleteFederationLinkorg.keycloak.testsuite.federation.ldap.noimport.LDAPProvidersIntegrationNoImportTest#ldapPasswordChangeWithAccountConsoleorg.keycloak.testsuite.federation.ldap.noimport.LDAPProvidersIntegrationNoImportTest#ldapPasswordChangeWithAdminEndpointAndRequiredActionorg.keycloak.testsuite.federation.ldap.noimport.LDAPProvidersIntegrationNoImportTest#loginLdaporg.keycloak.testsuite.federation.ldap.noimport.LDAPProvidersIntegrationNoImportTest#loginLdapWithDirectGrantorg.keycloak.testsuite.federation.ldap.noimport.LDAPProvidersIntegrationNoImportTest#loginLdapWithEmailorg.keycloak.testsuite.federation.ldap.noimport.LDAPProvidersIntegrationNoImportTest#registerExistingLdapUserorg.keycloak.testsuite.federation.ldap.noimport.LDAPProvidersIntegrationNoImportTest#registerUserLdapSuccessorg.keycloak.testsuite.federation.ldap.noimport.LDAPProvidersIntegrationNoImportTest#testAlwaysReadValueFromLdapCachedorg.keycloak.testsuite.federation.ldap.noimport.LDAPProvidersIntegrationNoImportTest#testAlwaysReadValueFromLdapNoCacheorg.keycloak.testsuite.federation.ldap.noimport.LDAPProvidersIntegrationNoImportTest#testCacheUserorg.keycloak.testsuite.federation.ldap.noimport.LDAPProvidersIntegrationNoImportTest#testCaseSensitiveAttributeNameorg.keycloak.testsuite.federation.ldap.noimport.LDAPProvidersIntegrationNoImportTest#testCommaInUsernameorg.keycloak.testsuite.federation.ldap.noimport.LDAPProvidersIntegrationNoImportTest#testEmailVerifiedFromImportorg.keycloak.testsuite.federation.ldap.noimport.LDAPProvidersIntegrationNoImportTest#testHardcodedAttributeMapperTestorg.keycloak.testsuite.federation.ldap.noimport.LDAPProvidersIntegrationNoImportTest#testHardcodedGroupMapperorg.keycloak.testsuite.federation.ldap.noimport.LDAPProvidersIntegrationNoImportTest#testHardcodedRoleMapperorg.keycloak.testsuite.federation.ldap.noimport.LDAPProvidersIntegrationNoImportTest#testImportExistingUserFromLDAPorg.keycloak.testsuite.federation.ldap.noimport.LDAPProvidersIntegrationNoImportTest#testLDAPUserDeletionImportorg.keycloak.testsuite.federation.ldap.noimport.LDAPProvidersIntegrationNoImportTest#testLDAPUserRefreshCacheorg.keycloak.testsuite.federation.ldap.noimport.LDAPProvidersIntegrationNoImportTest#testReadonlyorg.keycloak.testsuite.federation.ldap.noimport.LDAPProvidersIntegrationNoImportTest#testRemoveFederatedUserorg.keycloak.testsuite.federation.ldap.noimport.LDAPProvidersIntegrationNoImportTest#testSearchWithPartiallyCachedUserorg.keycloak.testsuite.federation.ldap.noimport.LDAPProvidersIntegrationNoImportTest#testSyncRegistrationEmailRDNDefaultValueorg.keycloak.testsuite.federation.ldap.noimport.LDAPProvidersIntegrationNoImportTest#testSyncRegistrationEmailRDNNoDefaultorg.keycloak.testsuite.federation.ldap.noimport.LDAPProvidersIntegrationNoImportTest#testSyncRegistrationForceDefaultorg.keycloak.testsuite.federation.ldap.noimport.LDAPProvidersIntegrationNoImportTest#testSyncRegistrationOfforg.keycloak.testsuite.federation.ldap.noimport.LDAPProvidersIntegrationNoImportTest#testUserAttributeLDAPStorageMapperHandlingUsernameLowercasing |
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.
Unreported flaky test detected, please review
Unreported flaky test detectedIf the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR. org.keycloak.testsuite.actions.RequiredActionPriorityTest#executeRequiredActionWithCustomPriorityAppliesSamePriorityToSessionAndUserActionsorg.keycloak.testsuite.actions.RequiredActionPriorityTest#executeRequiredActionsWithDefaultPriorityorg.keycloak.testsuite.actions.RequiredActionPriorityTest#setupTotpAfterUpdatePasswordorg.keycloak.testsuite.organization.admin.OrganizationInvitationLinkTest#testInviteNewUserRegistrationCustomRegistrationFlow |
|
I don't get these flaky tests... perhaps someone from the maintainers can explain what happens here? "Port already in use"??? |
pedroigor
left a comment
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.
Thanks, @dasniko. I'm not sure why we have been using CN to map the first name. We probably need a bit of history from @sguilhen, @mposolda or @rmartinc.
For me, your proposal makes more sense and I'm wondering what is the idea behind this entire block https://github.com/keycloak/keycloak/blob/main/federation/ldap/src/main/java/org/keycloak/storage/ldap/LDAPStorageProviderFactory.java#L342-L382.
I think we need to change that one too.
| UserAttributeLDAPStorageMapper.IS_MANDATORY_IN_LDAP, "true"); | ||
| realm.addComponentModel(mapperModel); | ||
|
|
||
| if (editMode == UserStorageProvider.EditMode.WRITABLE) { |
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.
If Edit Mode is READ_ONLY we still want to map this attribute from LDAP, don't we? Or is there a reason to have it only if writable?
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'm not 100% sure.
When READ_ONLY we have the first and last name as name information from single mappers coming from LDAP. fullname is not a real user attribute in Keycloak, this is always composed of first and lastname. So, IMHO this is only required in WRITEABLE mode, but I might be wrong here.
Yes, this makes probably sense. Before we start to change this, we should clarify what we want to achieve. TBH, I don't have that extensive knowledge of LDAP and even less on ActiveDirectory... |
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.
Unreported flaky test detected, please review
Unreported flaky test detectedIf the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR. org.keycloak.testsuite.actions.RequiredActionPriorityTest#executeRequiredActionWithCustomPriorityAppliesSamePriorityToSessionAndUserActionsorg.keycloak.testsuite.actions.RequiredActionPriorityTest#executeRequiredActionsWithDefaultPriorityorg.keycloak.testsuite.actions.RequiredActionPriorityTest#setupTotpAfterUpdatePasswordorg.keycloak.testsuite.organization.admin.OrganizationInvitationLinkTest#testInviteNewUserRegistrationCustomRegistrationFlow |
|
Btw, errors does not seem related and I found that the test |
I'm also learning more about this area/component but the That block assumes the vendor is AD without even checking if the vendor is actually AD. In general, I think we should:
[1] https://datatracker.ietf.org/doc/html/rfc4519#section-2.12 |
Unreported flaky test detectedIf the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR. org.keycloak.testsuite.actions.RequiredActionPriorityTest#executeRequiredActionWithCustomPriorityAppliesSamePriorityToSessionAndUserActionsorg.keycloak.testsuite.actions.RequiredActionPriorityTest#executeRequiredActionsWithDefaultPriorityorg.keycloak.testsuite.actions.RequiredActionPriorityTest#setupTotpAfterUpdatePassword |
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.
Unreported flaky test detected, please review
I don't understand why [1] https://datatracker.ietf.org/doc/html/rfc4519#section-2.3 |
|
@pedroigor I pushed the refactoring of the |
Same here. But I think for historical reasons, not sure if still valid, it is the case for some MSAD deployments. We need some input here from @mposolda or @sguilhen ...
For some vendors yes but MSAD works differently, I think. IIRC, |
Signed-off-by: Niko Köbler <[email protected]>
Signed-off-by: Niko Köbler <[email protected]>
pedroigor
left a comment
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.
@dasniko The changes to that "block" makes sense to me.
| UserAttributeLDAPStorageMapper.IS_MANDATORY_IN_LDAP, "true"); | ||
| realm.addComponentModel(mapperModel); | ||
|
|
||
| // For AD deployments with "sAMAccountName" as username and writable, we need to map "cn" as username as well (this is needed so we can register new users from KC into LDAP). |
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.
Just wondering if this mapper is about making sure there is a value set for CN when creating users given that firstName and lastName might be optional.
If so, I think the mapper for CN might involve a specific logic to check whether the first and last names are optional and if so, fallback to the username value. Instead of mapping to a single attribute. This logic should not be specific to AD, I think, and other vendors will have the same mapper.
This is kinda what the FullNameLDAPStorageMapper does but it does make much sense to put the fullname into the username on KC side.
|
@pedroigor Is there anything I can/shall do currently? Or are we waiting just for some input from @mposolda and @sguilhen? I initially "only" wanted to change this wrong default mapping between first- and common name. IMHO this is, what my PR does. Any further change should be done in a separate PR/issue!? |
|
Sorry for the late reply @pedroigor and @dasniko . I think the changes here make sense. I'm not aware of any historical reason for mapping the @rmartinc Do you have anything to add here? |
|
Hi @pedroigor , how do we want to proceed here with this issue/PR? |
closes #35941