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

This commit is contained in:
Thomas Darimont 2020-11-25 17:08:03 +01:00 committed by Marek Posolda
parent bcf313f321
commit f76e9cc833

View file

@ -252,6 +252,12 @@ public class UserAttributeLDAPStorageMapper extends AbstractLDAPStorageMapper {
super.setFirstName(firstName);
}
@Override
public void setEmailVerified(boolean verified) {
setLDAPAttribute(UserModel.EMAIL_VERIFIED, Boolean.toString(verified));
super.setEmailVerified(verified);
}
protected boolean setLDAPAttribute(String modelAttrName, Object value) {
if (modelAttrName.equalsIgnoreCase(userModelAttrName)) {
if (UserAttributeLDAPStorageMapper.logger.isTraceEnabled()) {
@ -382,6 +388,15 @@ public class UserAttributeLDAPStorageMapper extends AbstractLDAPStorageMapper {
}
}
@Override
public boolean isEmailVerified() {
if (UserModel.EMAIL_VERIFIED.equalsIgnoreCase(userModelAttrName)) {
return Boolean.parseBoolean(ldapUser.getAttributeAsString(ldapAttrName));
} else {
return super.isEmailVerified();
}
}
@Override
public String getLastName() {
if (UserModel.LAST_NAME.equalsIgnoreCase(userModelAttrName)) {