LDAP Import: KERBEROS_PRINCIPAL not updated when UserPrincipal changes and KERBEROS_PRINCIPAL was null on creation

Closes #41520


(cherry picked from commit 79fc97056e22ebfd6a8f87a83f9e01a000441ac1)

Signed-off-by: Martin Kanis <mkanis@redhat.com>
This commit is contained in:
Martin Kanis 2025-08-01 12:55:12 +02:00 committed by GitHub
parent 4699ea0662
commit 4e699e10da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -39,7 +39,7 @@ public class KerberosPrincipalAttributeMapper extends AbstractLDAPStorageMapper
if (kerberosPrincipalAttribute != null) {
String localKerberosPrincipal = user.getFirstAttribute(KERBEROS_PRINCIPAL);
String ldapKerberosPrincipal = ldapUser.getAttributeAsString(kerberosPrincipalAttribute);
if (ldapKerberosPrincipal != null && localKerberosPrincipal != null) {
if (ldapKerberosPrincipal != null) {
// update the Kerberos principal stored in DB as user's attribute if it doesn't match LDAP
if (!ldapKerberosPrincipal.equals(localKerberosPrincipal)) {
user.setSingleAttribute(KERBEROS_PRINCIPAL, ldapKerberosPrincipal);