47 String readOnly =
"false";
48 UserStorageProviderModel parent =
new UserStorageProviderModel();
50 parent =
new UserStorageProviderModel(p);
51 LDAPConfig ldapConfig =
new LDAPConfig(parent.getConfig());
52 readOnly = ldapConfig.getEditMode() == UserStorageProvider.EditMode.WRITABLE ?
"false" :
"true";
54 ProviderConfigurationBuilder config = ProviderConfigurationBuilder.create()
55 .property().name(UserAttributeLDAPStorageMapper.USER_MODEL_ATTRIBUTE)
56 .label(
"User Model Attribute")
57 .helpText(
"Name of the UserModel property or attribute you want to map the LDAP attribute into. For example 'firstName', 'lastName, 'email', 'street' etc.")
58 .type(ProviderConfigProperty.STRING_TYPE)
60 .property().name(UserAttributeLDAPStorageMapper.LDAP_ATTRIBUTE).label(
"LDAP Attribute").helpText(
"Name of mapped attribute on LDAP object. For example 'cn', 'sn, 'mail', 'street' etc.")
61 .type(ProviderConfigProperty.STRING_TYPE)
63 .property().name(UserAttributeLDAPStorageMapper.READ_ONLY).label(
"Read Only")
64 .helpText(
"Read-only attribute is imported from LDAP to UserModel, but it's not saved back to LDAP when user is updated in Keycloak.")
65 .type(ProviderConfigProperty.BOOLEAN_TYPE)
66 .defaultValue(readOnly)
68 if (parent.isImportEnabled()) {
70 property().name(UserAttributeLDAPStorageMapper.ALWAYS_READ_VALUE_FROM_LDAP).label(
"Always Read Value From LDAP")
71 .helpText(
"If on, then during reading of the LDAP attribute value will always used instead of the value from Keycloak DB")
72 .type(ProviderConfigProperty.BOOLEAN_TYPE).defaultValue(
"false").add();
74 config.property().name(UserAttributeLDAPStorageMapper.IS_MANDATORY_IN_LDAP).label(
"Is Mandatory In LDAP")
75 .helpText(
"If true, attribute is mandatory in LDAP. Hence if there is no value in Keycloak DB, the empty value will be set to be propagated to LDAP")
76 .type(ProviderConfigProperty.BOOLEAN_TYPE)
77 .defaultValue(
"false").add()
78 .property().name(UserAttributeLDAPStorageMapper.IS_BINARY_ATTRIBUTE).label(
"Is Binary Attribute")
79 .helpText(
"Should be true for binary LDAP attributes")
80 .type(ProviderConfigProperty.BOOLEAN_TYPE)
81 .defaultValue(
"false").add();
82 return config.build();