KEYCLOAK-16464 Allow to map enabled user model attribute to LDAP attribute

This commit is contained in:
Thomas Darimont 2020-12-11 11:35:21 +01:00 committed by Marek Posolda
parent f76e9cc833
commit 2faf809536

View file

@ -240,6 +240,12 @@ public class UserAttributeLDAPStorageMapper extends AbstractLDAPStorageMapper {
super.setEmail(lowercaseEmail);
}
@Override
public void setEnabled(boolean enabled) {
setLDAPAttribute(UserModel.ENABLED, Boolean.toString(enabled));
super.setEnabled(enabled);
}
@Override
public void setLastName(String lastName) {
setLDAPAttribute(UserModel.LAST_NAME, lastName);
@ -388,6 +394,15 @@ public class UserAttributeLDAPStorageMapper extends AbstractLDAPStorageMapper {
}
}
@Override
public boolean isEnabled() {
if (UserModel.ENABLED.equalsIgnoreCase(userModelAttrName)) {
return Boolean.parseBoolean(ldapUser.getAttributeAsString(ldapAttrName));
} else {
return super.isEnabled();
}
}
@Override
public boolean isEmailVerified() {
if (UserModel.EMAIL_VERIFIED.equalsIgnoreCase(userModelAttrName)) {